laravel-ide-helper
laravel-ide-helper copied to clipboard
Macro on JsonResource not detected
Versions:
- ide-helper Version: 2.12.3
- Laravel Version: 9.23.0
- PHP Version: 8.1
Description:
When adding a macro on a JsonResource (which gets Macroable via the trait DelegatesToResource) it is not picked up by the ide-helper.
When adding the exact same macro to the Str class (as a test to see if the macro definition itself is faulty) it is picked up.
Steps To Reproduce:
Add a macro in the AppServiceProvider boot method:
JsonResource::macro('wantsRelation', function(string $relation_name, mixed $value, mixed $default = null): mixed {
...
})
No macro is detected.
Add same macro on the Str class:
Str::macro('wantsRelation', function(string $relation_name, mixed $value, mixed $default = null): mixed {
...
})
and the macro is detected.