php-stubs / wp-cli-stubs

WP-CLI function and class declaration stubs for static analysis.
https://packagist.org/packages/php-stubs/wp-cli-stubs
MIT License
23 stars 2 forks source link

Add WP_CLI constants #6

Closed kallookoo closed 3 years ago

kallookoo commented 3 years ago

Hi, I use this stubs by the constants are missing like WP_CLI, WP_CLI_VERSION, etc... Is possible to include? Thanks

szepeviktor commented 3 years ago

Hello! It is possible but I'd like to keep the stubs file clean.

szepeviktor commented 3 years ago

WP-CLI function and class declaration stubs for static analysis.

szepeviktor commented 3 years ago

"clean" in OOP sense, not in WordPress sense

szepeviktor commented 3 years ago

And yes, I know WP-CLI suggests defined('WP_CLI') https://github.com/wp-cli/wp-cli/blob/master/php/wp-cli.php#L4 Please create tests/phpstan/constants.php and put WP_CLI in there.

szepeviktor commented 3 years ago

And it feels bad to choose one way:

kallookoo commented 3 years ago

Ok, I created another php with missings to include inside the vscode. Thanks

szepeviktor commented 3 years ago

You may need to add it to dynamicConstantNames: https://phpstan.org/config-reference#constants