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

WordPress extensions for PHPStan ⛏️

Results 21 phpstan-wordpress issues
Sort by recently updated
recently updated
newest added

This implements part of #106. I'm learning more about PHPStan internals as I work on this, so it's going to take some time 😄 . Once everything's working and covered...

Contributions are welcome! ``` Code Coverage Report: 2022-06-01 21:26:20 Summary: Classes: 13.64% (3/22) Methods: 53.23% (33/62) Lines: 32.20% (133/413) SzepeViktor\PHPStan\WordPress\ApplyFiltersDynamicFunctionReturnTypeExtension Methods: 66.67% ( 2/ 3) Lines: 91.67% ( 11/ 12)...

help wanted

I'm planning on working on some rules that check the use of `add_action()` and `add_filter()` when the action or filter is from WordPress core. [The wp-hooks library](https://github.com/johnbillion/wp-hooks) facilitates this, and...

@szepeviktor [PHPStan 1.6 added support for conditional return types in docblocks](https://phpstan.org/blog/phpstan-1-6-0-with-conditional-return-types), eg `@return ($as_float is true ? float : string)`. Some of the dynamic return type extensions (eg. `CurrentTimeDynamicFunctionReturnTypeExtension`) could...

```neon stubFiles: - tests/phpstan/wordpress-override.stub ``` ```php

Return type extension for `WP_Query->query()` and `WP_Query->get_posts()`. As `get_posts()` ultimately calls `WP_Query->query()` and `WP_Query->get_posts()`, they all share the same return type pattern. Not sure if you want to combine them...

In the WordPress core test suite the following assertion methods are available: * `$this->assertNotWPError()` * `$this->assertWPError()` It would be great if this extension treated these methods as type-narrowing functions, so...

This doesn't work, but I don't know why. Ref: https://phpstan.org/user-guide/stub-files

Should we ditch `void` in the EchoKey and the EchoParameter extensions and use `null` instead? Technically there is no such thing as void in PHP. However, as of PHP 7.1.0...

Will be handled via https://github.com/php-stubs/wordpress-stubs/. See https://github.com/php-stubs/wordpress-stubs/pull/127. Will most likely require wordpress-stubs v6.4.0. Todo: bump version in composer.json. Related #181