Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/php-stubs/wp-cli-stubs
WP-CLI function and class declaration stubs for static analysis.
https://github.com/php-stubs/wp-cli-stubs
Last synced: 5 days ago
JSON representation
WP-CLI function and class declaration stubs for static analysis.
- Host: GitHub
- URL: https://github.com/php-stubs/wp-cli-stubs
- Owner: php-stubs
- License: mit
- Created: 2020-08-03T11:50:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-12-13T15:52:38.000Z (about 1 month ago)
- Last Synced: 2025-01-07T07:10:07.356Z (12 days ago)
- Language: PHP
- Homepage: https://packagist.org/packages/php-stubs/wp-cli-stubs
- Size: 769 KB
- Stars: 25
- Watchers: 4
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WP-CLI Stubs
[![Build Status](https://app.travis-ci.com/php-stubs/wp-cli-stubs.svg?branch=master)](https://app.travis-ci.com/php-stubs/wp-cli-stubs)
This package provides stub declarations for [WP-CLI](https://wp-cli.org/) functions, classes and interfaces.
These stubs can help plugin and theme developers leverage static analysis tools like [PHPStan](https://github.com/phpstan/phpstan), which are unable to parse WP-CLI as it is not clean OOP code.Stubs are generated directly from the [source](https://wp-cli.org/) using [giacocorsiglia/stubs-generator](https://github.com/GiacoCorsiglia/php-stubs-generator).
### Requirements
- PHP >=7.1
### Installation
Require this package as a development dependency with [Composer](https://getcomposer.org).
```bash
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.
```neon
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
```