This package provides a PHPStan extension for Polylang and Polylang Pro. It should be used in combination with Polylang Stubs.
- PHP 8+
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-stubsInclude 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.phpThe 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