From dc8ace909810544a71d40abcc92d3bcf42d25dfd Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Fri, 16 Feb 2024 08:41:04 +0100 Subject: [PATCH] Added CustomFieldBehavior to make phpstan happy --- lib/craft/behaviors/CustomFieldBehavior.php | 33 +++++++++++++++++++++ lib/craft/bootstrap.php | 3 ++ phpstan.neon | 7 +++-- src/Scout.php | 3 +- 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 lib/craft/behaviors/CustomFieldBehavior.php create mode 100644 lib/craft/bootstrap.php diff --git a/lib/craft/behaviors/CustomFieldBehavior.php b/lib/craft/behaviors/CustomFieldBehavior.php new file mode 100644 index 0000000..cfb7dc6 --- /dev/null +++ b/lib/craft/behaviors/CustomFieldBehavior.php @@ -0,0 +1,33 @@ +element; $baseElement = ElementHelper::rootElementIfCanonical($element); if ($baseElement) { + /** @phpstan-var UrlManager $urlManager */ if (!$baseElement->hasMethod('searchable') || !$baseElement->shouldBeSearchable()) { return; } @@ -171,7 +172,7 @@ function(ElementEvent $event) { ->push( new IndexElement([ 'id' => $baseElement->id, - 'siteId' => $baseElement->site ? $baseElement->site->id : null + 'siteId' => $baseElement->site ? $baseElement->site->id : null, ]) ); } else {