# WordPress Extensions for PHPStan

> Static analysis for WordPress plugins and themes with PHPStan

Source: https://talira.ai/catalog/wordpress-extensions-for-phpstan-tn90qpfs
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Plugin
- Categories: [developer tools / type checking](https://talira.ai/categories/developer-tools/type-checking), [languages / php](https://talira.ai/categories/languages/php)
- Licence: MIT[^1]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source (MIT).
- Free tier: yes[^1]
- Backed by: [Viktor Szépe](https://talira.ai/orgs/viktor-szepe.md)

WordPress Extensions for PHPStan lets [PHPStan](https://talira.ai/catalog/phpstan-5dffx9mn.md) analyse [WordPress](https://talira.ai/catalog/wordpress-2n64j3nh.md) plugins and themes. It loads the php-stubs/wordpress-stubs package, adds dynamic return types for WordPress functions the stubs don't cover, defines some WordPress core constants, and reads the docblocks WordPress puts before `apply_filters()` and `do_action()` calls, treating the first `@param` as the type. It's installed with Composer as szepeviktor/phpstan-wordpress.

## Links

- GitHub: https://github.com/szepeviktor/phpstan-wordpress

## Problems it solves

- run PHPStan on my WordPress plugin without errors about unknown WordPress functions
- catch type errors in my WordPress theme's PHP before it ships
- get PHPStan to understand the types passed through WordPress filters

## Features

- loads php-stubs/wordpress-stubs
- dynamic return types for WordPress functions the stubs don't cover
- defines some WordPress core constants
- reads apply_filters() and do_action() docblocks, treating the first @param as the type

## Trust

Overall: 0.43 out of 1.
Signals: maintenance 0.62, adoption 0.51, momentum 0.20, community 0.49, backing 0.30, extensibility 0.00.

- last commit 28 days ago
- 3 commits in the last 90 days
- latest release v2.0.4 3 months ago
- 336 GitHub stars
- 16 contributors
- accepts sponsorship (Github)
- backed by Viktor Szépe

## Related

- Works with [PHPStan](https://talira.ai/catalog/phpstan-5dffx9mn.md)
- Works with [WordPress](https://talira.ai/catalog/wordpress-2n64j3nh.md)

## Alternatives

- [PHPStan](https://talira.ai/catalog/phpstan-5dffx9mn.md): PHP static analysis that finds bugs without running your code
- [Phan](https://talira.ai/catalog/phan-f1p4xx25.md): A static analyzer for PHP that minimizes false positives
- [Larastan](https://talira.ai/catalog/larastan-gxbmk034.md): Adds code analysis to Laravel, improving developer productivity and code quality
- [Psalm](https://talira.ai/catalog/psalm-fwm4fe8q.md): Free and open source static analysis tool for finding errors in PHP code

## Sources

[^1]: https://github.com/szepeviktor/phpstan-wordpress/blob/2.x/LICENSE (checked 29 Nov 2026)
