From 5d7751de1a5f3b529a21e5ff3487368cdee29b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 22 Sep 2026 14:44:16 +0200 Subject: [PATCH 1/3] IBX-12654: Added ibexa/phpstan to the PHPStan configuration --- composer.json | 1 + phpstan.neon | 1 + 2 files changed, 2 insertions(+) diff --git a/composer.json b/composer.json index 333898a..93dd702 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "require-dev": { "ibexa/code-style": "~2.0.0", "ibexa/doctrine-schema": "~6.0.x-dev", + "ibexa/phpstan": "~6.0.x-dev", "ibexa/rector": "~6.0.x-dev", "matthiasnoback/symfony-dependency-injection-test": "^6.0", "phpstan/phpstan": "^2.0", diff --git a/phpstan.neon b/phpstan.neon index d080f65..2441358 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,7 @@ includes: - phpstan-baseline.neon - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-symfony/extension.neon + - vendor/ibexa/phpstan/extension.neon parameters: level: 8 From f364512a4ea173f60cd142f7d0c02850fd724a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 22 Sep 2026 14:45:54 +0200 Subject: [PATCH 2/3] IBX-12654: Fixed dynamic calls to static methods --- .../contracts/Model/Suggestion/SuggestionCollectionTest.php | 4 ++-- .../EventListener/ContentSuggestionSubscriberTest.php | 6 +++--- tests/lib/QueryType/SearchQueryTypeTest.php | 2 +- .../Suggestion/SuggestionCollectionNormalizerTest.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/contracts/Model/Suggestion/SuggestionCollectionTest.php b/tests/contracts/Model/Suggestion/SuggestionCollectionTest.php index a576150..2d214f9 100644 --- a/tests/contracts/Model/Suggestion/SuggestionCollectionTest.php +++ b/tests/contracts/Model/Suggestion/SuggestionCollectionTest.php @@ -26,8 +26,8 @@ public function testCollection(): void self::assertInstanceOf(MutableArrayList::class, $collection); self::assertInstanceOf(SuggestionCollection::class, $collection); - $contentMock = $this->createStub(Content::class); - $contentTypeMock = $this->createStub(ContentType::class); + $contentMock = self::createStub(Content::class); + $contentTypeMock = self::createStub(ContentType::class); $collection->append(new ContentSuggestion(10, $contentMock, $contentTypeMock, '1/2/3', [new Location()])); $collection->append(new ContentSuggestion(20, $contentMock, $contentTypeMock, '1/3/5', [new Location()])); diff --git a/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php b/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php index 7983eb1..d3ed89f 100644 --- a/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php +++ b/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php @@ -155,7 +155,7 @@ private function getSearchServiceMock(): SearchService ->method('findContent')->willReturnCallback(function (Query $query): SearchResult { $this->capturedQuery = $query; - return new SearchResult(['searchHits' => [$this->createStub(SearchHit::class)]]); + return new SearchResult(['searchHits' => [self::createStub(SearchHit::class)]]); }); return $searchServiceMock; @@ -191,8 +191,8 @@ private function getSearchHitToContentSuggestionMapperMock(): SearchHitToContent ->willReturn( new ContentSuggestionModel( 10.0, - $this->createStub(Content::class), - $this->createStub(ContentType::class), + self::createStub(Content::class), + self::createStub(ContentType::class), '1/2/3', [ new Location(['id' => 1, 'path' => [1, 2, 3]]), diff --git a/tests/lib/QueryType/SearchQueryTypeTest.php b/tests/lib/QueryType/SearchQueryTypeTest.php index bf3d540..dec201c 100644 --- a/tests/lib/QueryType/SearchQueryTypeTest.php +++ b/tests/lib/QueryType/SearchQueryTypeTest.php @@ -41,7 +41,7 @@ final class SearchQueryTypeTest extends TestCase protected function setUp(): void { $this->searchService = $this->createMock(SearchService::class); - $this->sortingDefinitionRegistry = $this->createStub(SortingDefinitionRegistryInterface::class); + $this->sortingDefinitionRegistry = self::createStub(SortingDefinitionRegistryInterface::class); $this->queryType = new SearchQueryType( $this->searchService, $this->sortingDefinitionRegistry diff --git a/tests/lib/Serializer/Normalizer/Suggestion/SuggestionCollectionNormalizerTest.php b/tests/lib/Serializer/Normalizer/Suggestion/SuggestionCollectionNormalizerTest.php index fbfe9b4..84cf26b 100644 --- a/tests/lib/Serializer/Normalizer/Suggestion/SuggestionCollectionNormalizerTest.php +++ b/tests/lib/Serializer/Normalizer/Suggestion/SuggestionCollectionNormalizerTest.php @@ -30,7 +30,7 @@ protected function setUp(): void public function testNormalize(): void { - $suggestionItemMock = $this->createStub(Suggestion::class); + $suggestionItemMock = self::createStub(Suggestion::class); $suggestionCollection = new SuggestionCollection([$suggestionItemMock]); $suggestionCollection->increaseTotalCount(100); From c6cc8d92c6ecfb06710ae2fd1e08bc29aafa101d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 22 Sep 2026 14:47:54 +0200 Subject: [PATCH 3/3] IBX-12654: Fixed issues reported by ibexa/phpstan rules --- src/bundle/Form/DataTransformer/UsersTransformer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bundle/Form/DataTransformer/UsersTransformer.php b/src/bundle/Form/DataTransformer/UsersTransformer.php index 133390a..bca2e4a 100644 --- a/src/bundle/Form/DataTransformer/UsersTransformer.php +++ b/src/bundle/Form/DataTransformer/UsersTransformer.php @@ -14,6 +14,8 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; +use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; +use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -76,14 +78,14 @@ public function reverseTransform(mixed $value): SearchUsersData $searchService = $this->searchService; - $result = $this->repository->sudo(static function () use ($searchService, $filter) { + $result = $this->repository->sudo(static function () use ($searchService, $filter): SearchResult { return $searchService->findContent(new Query([ 'filter' => $filter, ])); }); return new SearchUsersData( - array_map(static function (SearchHit $searchHit) { + array_map(static function (SearchHit $searchHit): ValueObject { return $searchHit->valueObject; }, $result->searchHits), $value