Giter Site home page Giter Site logo

php-stubs / wp-cli-stubs Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 2.0 725 KB

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

Home Page: https://packagist.org/packages/php-stubs/wp-cli-stubs

License: MIT License

Shell 0.23% PHP 99.77%

wp-cli-stubs's People

Contributors

mte90 avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wp-cli-stubs's Issues

WordPress Stubs require is outdated

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.

v2.8.0 has an abstract problem

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

Add WP_CLI constants

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

Return type of WP_CLI\Iterators\CSV::count() should either be compatible with Countable::count(): int

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. ๐Ÿ™

Does not Find Bar and other Utils classes

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

PHPStan doesn't find the WP CLI stubs in scanFiles

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.

Release new version for dependency

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?

Generate script fails on some bash environments

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.
  1. Definition files are not updated.
  2. Removing the --header flag in the command generates everything correctly but does not include the expected file header.

Tested with

  1. GNU bash, version 5.1.16(1)-release (x86_64-pc-msys)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.