php-stubs / wp-cli-stubs Goto Github PK
View Code? Open in Web Editor NEWWP-CLI function and class declaration stubs for static analysis.
Home Page: https://packagist.org/packages/php-stubs/wp-cli-stubs
License: MIT License
WP-CLI function and class declaration stubs for static analysis.
Home Page: https://packagist.org/packages/php-stubs/wp-cli-stubs
License: MIT License
WP_CLI\Formatter::display_items
has Iterator
(without the \
) set as the type of its parameter $items
, expanding to WP_CLI\Iterator
.
Hi,
The current version of the WordPress stubs is 6.0 and the require of the composer.json not support it.
Please, update the composer require.
PHP Fatal error: Class WP_CLI\Bootstrap\IncludeFallbackAutoloader contains 1 abstract method
and must therefore be declared abstract or implement the remaining methods
(WP_CLI\Bootstrap\AutoloaderStep::get_autoloader_paths) in
/home/travis/build/php-stubs/wp-cli-stubs/wp-cli-stubs.php on line 337
PHP CLI Tools are used when writing WP-CLI commands; for eg for creating progress bar - https://github.com/wp-cli/php-cli-tools/tree/master
Hi,
I use this stubs by the constants are missing like WP_CLI, WP_CLI_VERSION, etc...
Is possible to include?
Thanks
Hey, first, thanks for making this! It makes my life happier.
I've stumbled on the following error when running it with Psalm on PHP 8.1:
Fatal error: During inheritance of Countable: Uncaught RuntimeException: PHP Error: Return type of WP_CLI\Iterators\CSV::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/m1r0/Projects/sensei/vendor/php-stubs/wp-cli-stubs/wp-cli-stubs.php:2467 in /Users/m1r0/Projects/sensei/vendor/vimeo/psalm/src/Psalm/Internal/ErrorHandler.php:66
Let me know if you need more info. Thanks. ๐
It does not find WP CLI Utils classes, giving reports such as this:
Call to method finish() on an unknown class WP_CLI\Utils\cli\progress\Bar.
Call to method finish() on an unknown class WP_CLI\Utils\NoOp.
Call to method tick() on an unknown class WP_CLI\Utils\cli\progress\Bar.
etc
WP_CLI\Utils
itself is stubbed, but not the classes underneath it
https://packagist.org/packages/wp-cli/wp-cli is @ 2.6.0
gettext+i18n-command
The readme says to include wp-cli-stubs.php (and the other files) under scanFiles. I have this:
parameters:
scanFiles:
- vendor/php-stubs/wp-cli-stubs/wp-cli-stubs.php
- vendor/php-stubs/wp-cli-stubs/wp-cli-i18n-stubs.php
- vendor/php-stubs/wp-cli-stubs/wp-cli-commands-stubs.php
But I have a class that extends WP_CLI_Command, and when analyzing that file I get:
Class WP_CLI_Command not found.
Only if I include it under bootstrapFiles does it work.
I'm not sure whether to report this on phpstan or here. Or if just something has changed not reflected in the documentation.
Could you release a new version bc of:
php-stubs/wp-cli-stubs[v2.5.0, ..., v2.6.0] require php-stubs/wordpress-stubs ^4.7 || ^5.0 -> found php-stubs/wordpress-stubs[v4.7.14, ..., v4.9.20, v5.0, ..., v5.9.5] but it conflicts with your root composer.json require (^6.0).
when using this with the WP stubs separately.
Are the wordpress-stubs really required to be a dependency for the CLI stubs?
While you're at it, would it be possible to regenerate stubs for CLI 2.7.0?
When running the generate.sh
script on Windows Bash the --header text gets transformed into a multi line argument when pass and breaks the command.
Running
bash -x ./generate.sh
Shows the following in terminal.
+ HEADER='/**
* Generated stub declarations for WP-CLI
* @see https://wp-cli.org/
* @see https://github.com/php-stubs/wp-cli-stubs
*/'
+ FILE=wp-cli-stubs.php
+ FILE_PKGS=wp-cli-commands-stubs.php
+ FILE_I18N=wp-cli-i18n-stubs.php
+ set -e
+ test -f wp-cli-stubs.php
+ test -f wp-cli-commands-stubs.php
+ test -f wp-cli-i18n-stubs.php
+ test -d source/vendor/wp-cli
+ '[' '!' -d vendor ']'
++ dirname ./generate.sh
+ ./vendor/bin/generate-stubs --include-inaccessible-class-nodes --force --finder=finder.php '--header=/**
* Generated stub declarations for WP-CLI
* @see https://wp-cli.org/
* @see https://github.com/php-stubs/wp-cli-stubs
*/' --functions --classes --interfaces --traits --out=wp-cli-stubs.php
<?php
/**
namespace cli {
... Definitions outputted below here.
--header
flag in the command generates everything correctly but does not include the expected file header.Tested with
GNU bash, version 5.1.16(1)-release (x86_64-pc-msys)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.