skaut / wordpress-stubs
High quality stubs for WordPress functions and classes
Installs: 26 507
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 6
Open Issues: 0
Requires
- php: ^7.0 || ^8.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phan/phan: ^5.0
- phpstan/phpstan: ^1.4
- slevomat/coding-standard: ^8.14
- squizlabs/php_codesniffer: ^3.0
- wp-coding-standards/wpcs: ^3.0
Suggests
- phan/phan: A static analyzer for PHP
- phpstan/phpstan: PHPStan - PHP Static Analysis Tool
- dev-master
- 2.8.1
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.1
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.0
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.1
- 1.19.0
- 1.18.1
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- 0.2.0
- 0.1.1
- 0.1.0
- dev-phan-wordpress-stubs
This package is auto-updated.
Last update: 2024-12-20 16:13:50 UTC
README
This repo contains stubs for WordPress functions and classes to be used with phan or phpstan. This allows for better type-checking of a codebase as the stubs all have type information.
Alternatives
php-stubs/wordpress-stubs
The php-stubs/wordpress-stubs
project uses stubs that are exported directly from WordPress source code. That means that the stubs are more complete and updated quicker. On the other hand, a lot of functions and classes are documented poorly in WordPress and array types are almost never typed properly (i. e. just array<mixed>
). This package has all the stubs created by hand, so they are much more precise.
Installation
$ composer require --dev skaut/wordpress-stubs
Add to your .phan/config.php
:
return [ 'directory_list' => [ 'vendor/skaut/wordpress-stubs/stubs' ], 'exclude_analysis_directory_list' => [ 'vendor/skaut/wordpress-stubs/stubs' ] ];
Add to your phpstan.neon
:
parameters: scanDirectories: - vendor/skaut/wordpress-stubs/stubs scanFiles: - vendor/skaut/wordpress-stubs/stubs/WordPress/functions.php dynamicConstantNames: - WP_DEBUG - ...
(you have to list dynamic constants yourself)
Completeness
The stubs are not complete. If you spot any missing functions or classes, please open an issue.