wpsyntex / polylang-phpstan
Polylang extension for PHPStan
Installs: 46 920
Dependents: 4
Suggesters: 1
Security: 0
Stars: 4
Watchers: 2
Forks: 1
Open Issues: 1
pkg:composer/wpsyntex/polylang-phpstan
Requires
- php: ^8.0
- szepeviktor/phpstan-wordpress: ^2.0
- wpsyntex/polylang-stubs: dev-master
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2026-02-03 15:08:44 UTC
README
This package provides a PHPStan extension for Polylang and Polylang Pro. It should be used in combination with Polylang Stubs.
Requirements
- PHP 8+
Installation
Require this package as a development dependency with Composer.
Tip
polylang/polylang-stubs is optional but strongly recommended.
composer require --dev wpsyntex/polylang-phpstan composer require --dev wpsyntex/polylang-stubs
Configuration
Adding the extension
Include the extension and stubs in the PHPStan configuration file.
Important
Prior to version 2.1 (included), polylang/polylang-stubs is automatically loaded.
Starting from version 2.2, it must be configured manually.
includes: - vendor/wpsyntex/polylang-phpstan/extension.neon parameters: stubFiles: - vendor/wpsyntex/polylang-stubs/polylang-stubs.php
Opt in to WordPress stubs overrides
The stubs/wordpress-override.php file provides corrected type definitions for specific WordPress functions that have imprecise or incorrect type hints in the standard WordPress stubs (currently sanitize_key(), maybe_serialize(), and sanitize_text_field()).
stubFiles: - vendor/wpsyntex/polylang-phpstan/stubs/wordpress-override.php