Download the PHP package onepix/wordpress-stubs without Composer
On this page you can find all versions of the php package onepix/wordpress-stubs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download onepix/wordpress-stubs
More information about onepix/wordpress-stubs
Files in onepix/wordpress-stubs
Package wordpress-stubs
Short Description WordPress function and class declaration stubs for static analysis.
License MIT
Homepage https://github.com/0zd0/wordpress-stubs
Informations about the package wordpress-stubs
WordPress Stubs
It provides stub declarations for WordPress core functions, classes, interfaces, globals, hooks. These stubs can help plugin and theme developers leverage static analysis tools like PHPStan.
The stubs are generated from @johnpbloch's package using onepix/wordpress-stubs-generator.
Requirements
- PHP 8.1+
Installation
Require this package as a development dependency with Composer.
Alternatively you may download wordpress-stubs.phpstub
directly.
Usage with PHPStan
The package szepeviktor/phpstan-wordpress
depends on phpstan/phpstan
and this one.
Please do read
that package's README
and see the example
directory over there.
Usage with Psalm
Update your Psalm config to include this section.
Furthermore ensure WordPress core is not included in <projectFiles>
.
Usage in Intellisense
If your IDE has trouble parsing all of WordPress you may find the stubs useful for enabling code completion and related features. For example there are instructions for usage with VSCode's Intelephense extension.
Versioning
This package is versioned to match the WordPress version from which the stubs are generated.
Generating stubs for a different WordPress version
- Run modern PHP version
- Clone this repository and
cd
into it - Update
"johnpbloch/wordpress": "x.x.x"
insource/composer.json
with the desired version - Run
composer update
- And run
./generate.sh
The wordpress-stubs.phpstub
file should now be updated.