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 4 years ago)
- Default Branch: main
- Last Pushed: 2025-10-15T16:14:36.000Z (9 months ago)
- Last Synced: 2025-10-16T11:30:36.206Z (9 months ago)
- Topics: glotpress, phpstan, static-analysis, stubs, wordpress
- Language: PHP
- Homepage: https://packagist.org/packages/pedro-mendonca/glotpress-stubs
- Size: 467 KB
- Stars: 0
- Watchers: 1
- 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.3 or ^8.0
### 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
```