Skip to content

Commit c10d2e6

Browse files
authored
Merge branch 'master' into master
2 parents 24653d2 + 6e26f22 commit c10d2e6

14 files changed

+200
-425
lines changed

.github/workflows/run-integration-tests.yml

+19-6
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,22 @@ jobs:
5757
- name: Execute meta run
5858
run: |
5959
cd sample
60-
php artisan ide-helper:meta
60+
php artisan ide-helper:meta -v
6161
6262
- name: Check file existence
6363
run: |
6464
ls sample/_ide_helper.php
6565
ls sample/.phpstorm.meta.php
6666
67-
- name: Check file count in logs
67+
- name: Check logs
6868
run: |
69-
if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ];then exit 1;fi
69+
if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ]; then
70+
for logfile in sample/storage/logs/*; do
71+
echo "-- $logfile --"
72+
cat $logfile
73+
done
74+
exit 1
75+
fi
7076
7177
php-laravel-integration-tests:
7278
runs-on: ubuntu-20.04
@@ -115,13 +121,20 @@ jobs:
115121
- name: Execute meta run
116122
run: |
117123
cd sample
118-
php artisan ide-helper:meta
124+
php artisan ide-helper:meta -v
119125
120126
- name: Check file existence
121127
run: |
122128
ls sample/_ide_helper.php
123129
ls sample/.phpstorm.meta.php
124130
125-
- name: Check file count in logs
131+
132+
- name: Check logs
126133
run: |
127-
if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ];then exit 1;fi
134+
if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ]; then
135+
for logfile in sample/storage/logs/*; do
136+
echo "-- $logfile --"
137+
cat $logfile
138+
done
139+
exit 1
140+
fi

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
88
### Added
99
- Add support for Attribute accessors with no backing field or type hinting [#1315 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1338).
1010

11+
### Fixed
12+
- Handle PHP 8.1 deprecation warnings when passing `null` to `new \ReflectionClass` [#1351 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1351)
13+
14+
1115
2022-03-06, 2.12.3
1216
------------------
1317

@@ -30,6 +34,7 @@ All notable changes to this project will be documented in this file.
3034
### Added
3135
- Add support for custom casts that using `Castable` [#1287 / binotaliu](https://github.com/barryvdh/laravel-ide-helper/pull/1287)
3236
- Added Laravel 9 support [#1297 / rcerljenko](https://github.com/barryvdh/laravel-ide-helper/pull/1297)
37+
- Added option `additional_relation_return_types` for custom relations that don't fit the typical naming scheme
3338

3439
2022-01-03, 2.11.0
3540
------------------

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
This package generates helper files that enable your IDE to provide accurate autocompletion.
1212
Generation is done based on the files in your project, so they are always up-to-date.
1313

14+
It supports Laravel 8+ and PHP 7.3+
15+
1416
- [Installation](#installation)
1517
- [Usage](#usage)
1618
- [Automatic PHPDoc generation for Laravel Facades](#automatic-phpdoc-generation-for-laravel-facades)
@@ -279,6 +281,26 @@ For those special cases, you can map them via the config `custom_db_types`. Exam
279281
],
280282
```
281283

284+
#### Custom Relationship Types
285+
286+
If you are using relationships not built into Laravel you will need to specify the name and returning class in the config to get proper generation.
287+
288+
```php
289+
'additional_relation_types' => [
290+
'externalHasMany' => \My\Package\externalHasMany::class
291+
],
292+
```
293+
294+
Found relationships will typically generate a return value based on the name of the relationship.
295+
296+
If your custom relationships don't follow this traditional naming scheme you can define its return type manually. The available options are `many` and `morphTo`.
297+
298+
```php
299+
'additional_relation_return_types' => [
300+
'externalHasMultiple' => 'many'
301+
],
302+
```
303+
282304
#### Model Hooks
283305

284306
If you need additional information on your model from sources that are not handled by default, you can hook in to the

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"php": "^7.3 || ^8.0",
2424
"ext-json": "*",
2525
"barryvdh/reflection-docblock": "^2.0.6",
26-
"composer/pcre": "^1 || ^2 || ^3",
26+
"composer/class-map-generator": "^1.0",
2727
"doctrine/dbal": "^2.6 || ^3",
2828
"illuminate/console": "^8 || ^9",
2929
"illuminate/filesystem": "^8 || ^9",

config/ide-helper.php

+13
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,19 @@
304304
*/
305305
'additional_relation_types' => [],
306306

307+
/*
308+
|--------------------------------------------------------------------------
309+
| Additional relation return types
310+
|--------------------------------------------------------------------------
311+
|
312+
| When using custom relation types its possible for the class name to not contain
313+
| the proper return type of the relation. The key of the array is the relationship
314+
| method name. The value of the array is the return type of the relation.
315+
| e.g. `'relationName' => 'many'`.
316+
|
317+
*/
318+
'additional_relation_return_types' => [],
319+
307320
/*
308321
|--------------------------------------------------------------------------
309322
| Run artisan commands after migrations to generate model helpers

0 commit comments

Comments
 (0)