phpstan-symfony icon indicating copy to clipboard operation
phpstan-symfony copied to clipboard

Adding support for OptionsResolver component

Open benjaminmal opened this issue 2 years ago • 4 comments

It will be nice to support the OptionsResolver component. By supporting I mean:

  • Resolving the type / prototype of each defined options
  • Check if the values given in the options array match the allowed types / values
  • Check if there are missing required options
  • Check if the user use deprecated options
  • Check if the user use the correct object type hinting when using a closure. Given the context, OptionsResolver or Options.
  • Resolve the pure array keys and value types (nowaday there are some Argument of an invalid type mixed supplied for foreach, only iterables are supported. or Cannot access offset '{offset}' on mixed. and many others errors)

What do you think about that?

benjaminmal avatar Nov 18 '21 17:11 benjaminmal

Feel free to modernize the extension and contribute it here 😊

ondrejmirtes avatar Nov 18 '21 17:11 ondrejmirtes

@ondrejmirtes I will try to work on it when I'll have time to :)

benjaminmal avatar Nov 21 '21 18:11 benjaminmal

I'm also concerned, I'd like to contribute to this!

@ondrejmirtes I forked and cloned the repo but I'm a bit lost: classes from PHPStan are missing so I get errors in VSCode (Undefined type 'PHPStan\Testing\TypeInferenceTestCase'. for instance). Therefore, I don't benefit from the IDE.

Is it the good way to start developing on phpstan (clone + composer install)?

tom-combet avatar Jul 15 '22 16:07 tom-combet

@tom-combet If you use PhpStorm IDE then the classes can be seen. They're defined inside phpstan.phar in vendor/phpstan/phpstan.

ondrejmirtes avatar Jul 20 '22 12:07 ondrejmirtes