phpstan-symfony
phpstan-symfony copied to clipboard
Adding support for OptionsResolver component
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
orOptions
. - 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.
orCannot access offset '{offset}' on mixed.
and many others errors)
What do you think about that?
Feel free to modernize the extension and contribute it here 😊
@ondrejmirtes I will try to work on it when I'll have time to :)
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 If you use PhpStorm IDE then the classes can be seen. They're defined inside phpstan.phar in vendor/phpstan/phpstan
.