From bb7575cb6fc4d10329b9d344f7435cbc6e69b595 Mon Sep 17 00:00:00 2001 From: Serhii Shliakhov Date: Thu, 10 Oct 2024 11:11:01 +0100 Subject: [PATCH 1/2] Fix MixedTest.php --- tests/Unit/MixedTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/Unit/MixedTest.php b/tests/Unit/MixedTest.php index 6e165535..fc324887 100644 --- a/tests/Unit/MixedTest.php +++ b/tests/Unit/MixedTest.php @@ -13,12 +13,21 @@ public function test_search_signature() { $searchable = new ReflectionClass(Searchable::class); $searchableParameters = $searchable->getMethod('search')->getParameters(); - $searchableDoc = $searchable->getMethod('search')->getDocComment(); + $searchableDoc = $this->stripStaticFromReturnType($searchable->getMethod('search')->getDocComment()); + $mixed = new ReflectionClass(MixedSearch::class); $mixedParameters = $mixed->getMethod('search')->getParameters(); - $mixedDoc = $mixed->getMethod('search')->getDocComment(); + $mixedDoc = $this->stripStaticFromReturnType($mixed->getMethod('search')->getDocComment()); $this->assertEquals($searchableParameters, $mixedParameters); $this->assertEquals($searchableDoc, $mixedDoc); } + + /** + * Helper method to remove "static" from the @return line in the doc comment. + */ + private function stripStaticFromReturnType($doc) + { + return preg_replace('/@return\s+\\\\Laravel\\\\Scout\\\\Builder/', '@return \Laravel\Scout\Builder', $doc); + } } From 329d8438541aa7d1f6cda16238727c65b3a48322 Mon Sep 17 00:00:00 2001 From: Serhii Shliakhov Date: Thu, 10 Oct 2024 11:12:25 +0100 Subject: [PATCH 2/2] Clean up --- tests/Unit/MixedTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/MixedTest.php b/tests/Unit/MixedTest.php index fc324887..2870ed82 100644 --- a/tests/Unit/MixedTest.php +++ b/tests/Unit/MixedTest.php @@ -17,7 +17,7 @@ public function test_search_signature() $mixed = new ReflectionClass(MixedSearch::class); $mixedParameters = $mixed->getMethod('search')->getParameters(); - $mixedDoc = $this->stripStaticFromReturnType($mixed->getMethod('search')->getDocComment()); + $mixedDoc = $mixed->getMethod('search')->getDocComment(); $this->assertEquals($searchableParameters, $mixedParameters); $this->assertEquals($searchableDoc, $mixedDoc);