barryvdh / laravel-ide-helper

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

Deprecation warnings on ReflectionClass conctructor while generating Meta #1371

Closed zlodes closed 2 years ago

zlodes commented 2 years ago

Versions:

Description:

[2022-08-31 10:50:54] local.WARNING: 
ReflectionClass::__construct(): Passing null to parameter #1 ($objectOrClass) of type object|string is deprecated in /path/to/project/vendor/barryvdh/laravel-ide-helper/src/Console/MetaCommand.php on line 98   

[2022-08-31 10:50:54] local.WARNING: 
ReflectionClass::__construct(): Passing null to parameter #1 ($objectOrClass) of type object|string is deprecated in /path/to/project/vendor/barryvdh/laravel-ide-helper/src/Console/MetaCommand.php on line 98  

ReflectionClass::__construct signature from PHPStorm stubs:

/**
 * Constructs a ReflectionClass
 *
 * @link https://php.net/manual/en/reflectionclass.construct.php
 * @param class-string<T>|T $objectOrClass Either a string containing the name of
 * the class to reflect, or an object.
 * @throws ReflectionException if the class does not exist.
 */
public function __construct(#[LanguageLevelTypeAware(['8.0' => 'object|string'], default: '')] $objectOrClass) {}

Steps To Reproduce:

  1. Enable Laravel deprecation logging
  2. Run php artisan ide-helper:meta
zlodes commented 2 years ago

Seems that is's already resolved in master branch...

Duplicates: https://github.com/barryvdh/laravel-ide-helper/pull/1279