barryvdh / laravel-ide-helper

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

Fix deprecation warning #1279

Closed jdanino closed 2 years ago

jdanino commented 2 years ago

Summary

Fixed a deprecation warning because of a nullable parameter to the reflection class constructor by adding and emtyp string as a default.

ReflectionClass::__construct(): Passing null to parameter #1 ($objectOrClass) of type object|string is deprecated

Type of change

rrpadilla commented 2 years ago

Hi @barryvdh, confirming this fixed the deprecation warning. Thanks.

ReflectionClass::__construct(): Passing null to parameter #1 ($objectOrClass) 
of type object|string is deprecated in 
/vendor/barryvdh/laravel-ide-helper/src/Console/MetaCommand.php on line 98
barryvdh commented 2 years ago

If it's null, it wouldn't make sense to try to make a reflection of it, right?

mfn commented 2 years ago

Agreed, if the line above

$concrete = $this->laravel->make($abstract);

produces null in $concrete, something else is weird

mfn commented 2 years ago

Superseded by https://github.com/barryvdh/laravel-ide-helper/pull/1351 which gives more details what's going on and does not silently coerce null into '', thank you though for this PR 🙏🏼