From 8505ddd7d2aab28612eaf58d95109f182736a28a Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Fri, 6 Mar 2026 01:53:54 +0200 Subject: [PATCH] fix: phpstan errors --- inc/Modules/Search/Search.php | 2 +- phpstan.neon.dist | 2 ++ phpstan/stubs/wordpress-extended.php | 29 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 phpstan/stubs/wordpress-extended.php diff --git a/inc/Modules/Search/Search.php b/inc/Modules/Search/Search.php index 1f78c26..1c86492 100644 --- a/inc/Modules/Search/Search.php +++ b/inc/Modules/Search/Search.php @@ -38,7 +38,7 @@ final class Search implements Registrable { * * @var bool|null */ - private ?bool $is_search_enabled; + private ?bool $is_search_enabled = null; /** * {@inheritDoc} diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e6a6409..686cc88 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -21,6 +21,8 @@ parameters: max: 80500 bootstrapFiles: - onesearch.php + stubFiles: + - phpstan/stubs/wordpress-extended.php paths: - onesearch.php - uninstall.php diff --git a/phpstan/stubs/wordpress-extended.php b/phpstan/stubs/wordpress-extended.php new file mode 100644 index 0000000..67fb99d --- /dev/null +++ b/phpstan/stubs/wordpress-extended.php @@ -0,0 +1,29 @@ + $onesearch_algolia_highlights Highlighted search snippets from Algolia. + * @property string $onesearch_site_url URL of the site this post belongs to. + * @property string $onesearch_site_name Name of the site this post belongs to. + * @property string $onesearch_remote_post_author_display_name Remote author display name. + * @property string $onesearch_remote_post_author_link Remote author posts URL. + * @property string $onesearch_remote_post_author_gravatar Remote author avatar URL. + * @property int $onesearch_original_id Original post ID on remote site. + * @property array $onesearch_remote_taxonomies Taxonomies from remote site. + */ + class WP_Post { + } +}