https://github.com/pedro-mendonca/glotpress-stubs
@GlotPress function and class declaration stubs for static analysis.
https://github.com/pedro-mendonca/glotpress-stubs
glotpress phpstan static-analysis stubs wordpress
Last synced: 2 months ago
JSON representation
@GlotPress function and class declaration stubs for static analysis.
- Host: GitHub
- URL: https://github.com/pedro-mendonca/glotpress-stubs
- Owner: pedro-mendonca
- License: mit
- Created: 2021-12-16T09:14:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-26T00:00:10.000Z (9 months ago)
- Last Synced: 2024-11-24T09:35:29.252Z (7 months ago)
- Topics: glotpress, phpstan, static-analysis, stubs, wordpress
- Language: PHP
- Homepage: https://packagist.org/packages/pedro-mendonca/glotpress-stubs
- Size: 425 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GlotPress Stubs
GlotPress function and class declaration stubs for static analysis.
[](https://packagist.org/packages/pedro-mendonca/glotpress-stubs)
[](https://packagist.org/packages/pedro-mendonca/glotpress-stubs/stats)
[](https://github.com/pedro-mendonca/glotpress-stubs/blob/main/LICENSE)
[](https://github.com/sponsors/pedro-mendonca)This package provides stub declarations for [GlotPress](https://glotpress.blog) 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 GlotPress as it is not clean OOP code.Stubs are generated directly from the [source](https://github.com/GlotPress/GlotPress-WP) using [php-stubs/generator](https://github.com/php-stubs/generator).
### Requirements
- PHP >=7.2
### Installation
Require this package as a development dependency with [Composer](https://getcomposer.org).
```bash
composer require --dev pedro-mendonca/glotpress-stubs
```Alternatively you may download `glotpress-stubs.php` directly.
### Usage in PHPStan
Include all stubs in PHPStan configuration file.
You can remove the `# WordPress Stubs` lines if you already use [WordPress extensions for PHPStan](https://github.com/szepeviktor/phpstan-wordpress).```yaml
parameters:
scanFiles:
# WordPress Stubs
- %rootDir%/../../php-stubs/wordpress-stubs/wordpress-stubs.php
# GlotPress Stubs
- %rootDir%/../../pedro-mendonca/glotpress-stubs/glotpress-stubs.php
```