szepeviktor / phpstan-wordpress

WordPress extensions for PHPStan ⛏️
https://packagist.org/packages/szepeviktor/phpstan-wordpress
MIT License
267 stars 26 forks source link

Fix AssertWpErrorTypeSpecifying extensions #127

Closed herndlm closed 1 year ago

herndlm commented 1 year ago

Viktor you were right, this was autoloader related. PHPStan needs to be able to cleanly autoload this class in order to fire the extensions. This is my first hacky approach to fix that autoloading with some kind of stub class copied into the tests folder.

The rest are just tiny fixes for the extensions themselves.

Refs: https://github.com/szepeviktor/phpstan-wordpress/pull/124 CC @swissspidy

szepeviktor commented 1 year ago

All green 🟢 What to do now??

szepeviktor commented 1 year ago

Only 1 thing (2 occurrences)

- $yes = $yes;
+ $yes = $_GET['yes'];

Would it be possible?

herndlm commented 1 year ago

Should be possible. The type is specified via phpdoc and overwritten anyways. I'm just not in front of the computer anymore, so feel free to adapt if you want

herndlm commented 1 year ago

Also the diff I produced on one test file is not needed and could be reverted. Sorry, I was in a hurry and missed that.. The class Foo thing..

szepeviktor commented 1 year ago

Thank you Martin!