Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/Modules/Search/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class Search implements Registrable {
*
* @var bool|null
*/
private ?bool $is_search_enabled;
private ?bool $is_search_enabled = null;

/**
* {@inheritDoc}
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ parameters:
max: 80500
bootstrapFiles:
- onesearch.php
stubFiles:
- phpstan/stubs/wordpress-extended.php
paths:
- onesearch.php
- uninstall.php
Expand Down
29 changes: 29 additions & 0 deletions phpstan/stubs/wordpress-extended.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php // phpcs:disable -- This is a stub file
/**
* Extends WP_Query and WP_Post with OneSearch dynamic properties for PHPStan analysis.
*/

namespace {
/**
* Extended WP_Query with OneSearch dynamic properties.
*
* @property bool $is_algolia_search Whether this is an Algolia-powered search query.
*/
class WP_Query {
}

/**
* Extended WP_Post with OneSearch dynamic properties.
*
* @property array<string, string> $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<string, mixed> $onesearch_remote_taxonomies Taxonomies from remote site.
Comment thread
justlevine marked this conversation as resolved.
*/
class WP_Post {
}
}
Loading