From fbab0d290effbb2231e633dd5bc1e1d67f4fe5bd Mon Sep 17 00:00:00 2001 From: Hug0-Drelon Date: Wed, 12 Nov 2025 10:46:58 +0100 Subject: [PATCH 1/3] Add WordPress stubs override. --- stubs/wordpress-override.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 stubs/wordpress-override.php diff --git a/stubs/wordpress-override.php b/stubs/wordpress-override.php new file mode 100644 index 0000000..b9ebcf6 --- /dev/null +++ b/stubs/wordpress-override.php @@ -0,0 +1,24 @@ +|object $data + * @return scalar + */ +function maybe_serialize( $data ) {} + +/** + * Accepts anything and returns a string. @see {_sanitize_text_field()}. + * + * @param mixed $str + * @return string + */ +function sanitize_text_field( $str ) {} From a4a2b0d809c9acdffee7869f8874c592e01b914a Mon Sep 17 00:00:00 2001 From: Hug0-Drelon Date: Wed, 12 Nov 2025 10:50:20 +0100 Subject: [PATCH 2/3] Update readme. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 335245e..647dc19 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,10 @@ parameters: bootstrapFiles: - vendor/wpsyntex/polylang-stubs/polylang-stubs.php ``` + +Use WordPress stubs override. + +```yaml + stubFiles: + - vendor/wpsyntex/polylang-stubs/polylang-stubs.php +``` From 3094d81338f520552419d200a4b2f5ba90f25551 Mon Sep 17 00:00:00 2001 From: Hug0-Drelon Date: Wed, 12 Nov 2025 10:53:07 +0100 Subject: [PATCH 3/3] Fix exemple in readme. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 647dc19..52b728f 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ parameters: - vendor/wpsyntex/polylang-stubs/polylang-stubs.php ``` -Use WordPress stubs override. +Opt-in for WordPress stubs override. ```yaml stubFiles: - - vendor/wpsyntex/polylang-stubs/polylang-stubs.php + - vendor/wpsyntex/polylang-phpstan/stubs/wordpress-override.php ```