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

WordPress extensions for PHPStan ⛏️

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

This PR adds a dynamic function return type extension for `wp_tag_cloud()`. I have made several updates to the extension since the initial draft: * It now only checks for an...

```php remove_action('wp_enqueue_scripts', [$theme, 'wp_common_block_scripts_and_styles']); ``` This triggered no error on level 5. How could that be? ps. `wp_common_block_scripts_and_styles` is a global function from core

help wanted

**Reproduce:** ```php add_filter('filter', function($one, $two) { return 123; }, accepted_args: 2); ``` **Expected:** No errors **Actual** ``` Callback expects 2 parameters, $accepted_args is set to 1. ```

enhancement

Hi ! There are two bad copy/paste into WP_Post class : ```php /** * ID of post author. * * A numeric string, for compatibility reasons. * * @since 3.5.0...

Same as `GetTermsDynamicFunctionReturnTypeExtension`, but just for `WP_Term_Query()` See also #48 for `WP_Query` Logic is as follows: https://github.com/WordPress/wordpress-develop/blob/bdc2084b30fd842fe862f656aafd1a7c46c53317/src/wp-includes/class-wp-term-query.php#L314-L339

The `WP_CLI::error()` method [is marked as an early terminating method](https://github.com/szepeviktor/phpstan-wordpress/blob/f7ff091331bc00c5688fe4ce0c4d51d06fa61553/extension.neon#L155), but it doesn't terminate if the `$exit` parameter is set to `false`. Its entry in the `earlyTerminatingMethodCalls` config should be...

`__return_null()` in `add_filter()` causes a `Filter callback return statement is missing.` error. See #220. Is this intended? Note, there is no error with the lowest supported version of PHPStan.

Please help! many errors ``` 530 Property WP_Upgrader::$result (array{source: string, source_files: string, destination: string, destination_name: string, local_destination: string, remote_destination: string, clear_destination: bool}|WP_Error) does not accept default value of type array{}....