php-stubs/wp-cli-stubs

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

Maintainers

👁 szepeviktor

Package info

github.com/php-stubs/wp-cli-stubs

pkg:composer/php-stubs/wp-cli-stubs

Statistics

Installs: 2 779 924

Dependents: 84

Suggesters: 0

Stars: 30

Open Issues: 3

v2.12.0 2025-06-10 09:58 UTC

Requires

Requires (Dev)

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT af16401e299a3fd2229bd0fa9a037638a4174a9d

wordpressstatic analysiswp-cliPHPStan

This package is auto-updated.

Last update: 2026-05-26 12:27:59 UTC


README

👁 Build Status

This package provides stub declarations for WP-CLI functions, classes and interfaces. These stubs can help plugin and theme developers leverage static analysis tools like PHPStan, which are unable to parse WP-CLI as it is not clean OOP code.

Stubs are generated directly from the source using giacocorsiglia/stubs-generator.

Requirements

  • PHP >=7.1

Installation

Require this package as a development dependency with Composer.

composer require --dev php-stubs/wp-cli-stubs

Alternatively you may download wp-cli-stubs.php directly.

Usage in PHPStan

Include all stubs in PHPStan configuration file.

parameters:
 scanFiles:
 - %rootDir%/../../php-stubs/wordpress-stubs/wordpress-stubs.php
 - %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-stubs.php
 - %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-commands-stubs.php
 - %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-i18n-stubs.php
 - %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-tools-stubs.php