barryvdh / laravel-ide-helper

IDE Helper for Laravel
MIT License
14.17k stars 1.16k forks source link

Call to undefined method ReflectionUnionType::getName() in Macro #1281

Open usernotnull opened 2 years ago

usernotnull commented 2 years ago

Adding the following macro:

Builder::macro('whereLike', fn (
    Closure|string|array|Expression $column,
    mixed $value,
    string $boolean = 'and'
) => $this->where($column, 'LIKE', "%$value%", $boolean));

Produces the below error due to the union type of $column:

IDE Helpers generated for Laravel Actions at ./_ide_helper_actions.php Call to undefined method ReflectionUnionType::getName() at vendor/barryvdh/laravel-ide-helper/src/Macro.php:45

I suspect this is related to issue #1129 but the fix has to be applied to macros.