From ef2c78ab4e9c6e82510fabb1fb1fb3865a6509ea Mon Sep 17 00:00:00 2001 From: Petro Kurbatskyi <petro.kurbatskyi@ibexa.co> Date: Thu, 14 Mar 2024 14:21:30 +0100 Subject: [PATCH 01/19] Set up branch to become 5.0 in the future --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 990afad..7bf37af 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ }, "require": { "php": "^7.4 || ^8.0", - "ibexa/core": "~4.6.x-dev", + "ibexa/core": "~5.0.x-dev", "symfony/dependency-injection": "^5.0", "symfony/http-kernel": "^5.0", "symfony/http-foundation": "^5.0", @@ -41,7 +41,7 @@ "phpunit/phpunit": "^9.6", "friendsofphp/php-cs-fixer": "^3.0", "ibexa/code-style": "^1.0", - "ibexa/doctrine-schema": "~4.6.x-dev", + "ibexa/doctrine-schema": "~5.0.x-dev", "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-symfony": "^1.3", @@ -55,7 +55,7 @@ }, "extra": { "branch-alias": { - "dev-main": "4.6.x-dev" + "dev-main": "5.0.x-dev" } }, "config": { From bd6a3300e97290afdc81d853a9597728dd0ad5f5 Mon Sep 17 00:00:00 2001 From: Petro Kurbatskyi <petro.kurbatskyi@ibexa.co> Date: Wed, 27 Mar 2024 15:45:14 +0100 Subject: [PATCH 02/19] Removed repository-wide pull request template --- .github/pull_request_template.md | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 70ff30a..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,18 +0,0 @@ -| Question | Answer -| ------------- | --- -| Tickets | [IBX-XXXXX](https://issues.ibexa.co/browse/IBX-XXXXX) <!-- URLs to JIRA issue(s) (or N/A) --> -| Bug fix? | yes/no -| New feature? | yes/no -| BC breaks? | yes/no -| Tests pass? | yes/no -| Doc needed? | yes/no -| License | [GPL-2.0](https://github.com/ibexa/search/blob/main/LICENSE) -<!-- Keep in mind: Your contribution has to be compatible with GPL-2.0 as well: https://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#GPLModuleLicense --> - - -<!-- Replace this comment with Pull Request description --> - - -#### Checklist: -- [ ] Implement tests -- [ ] Coding standards (`$ composer fix-cs`) From a10a6187c3800e27d31a3c52f58ee4e7e83c19cb Mon Sep 17 00:00:00 2001 From: Andrew Longosz <alongosz@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:00:39 +0200 Subject: [PATCH 03/19] IBX-8119: Upgraded minimum PHP version to 8.3 (#47) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * IBX-8119: Upgraded minimum PHP version to 8.3 * Fixed iterable as array usage in PagerSearchContentToDataMapper --------- Co-authored-by: Paweł Niedzielski <pawel.niedzielski@ibexa.co> --- .github/workflows/ci.yaml | 22 +++++++++---------- composer.json | 19 ++++++++-------- .../Mapper/PagerSearchContentToDataMapper.php | 8 ++++--- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1e84876..a0c734b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,13 +10,13 @@ on: jobs: cs-fix: name: Run code style check - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" strategy: matrix: php: - - '8.0' + - '8.3' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup PHP Action uses: shivammathur/setup-php@v2 @@ -26,9 +26,9 @@ jobs: extensions: 'pdo_sqlite, gd' tools: cs2pr - - uses: "ramsey/composer-install@v1" + - uses: ramsey/composer-install@v3 with: - dependency-versions: "highest" + dependency-versions: highest - name: Run code style check run: composer run-script check-cs -- --format=checkstyle | cs2pr @@ -38,19 +38,17 @@ jobs: tests: name: Unit tests - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" timeout-minutes: 15 strategy: fail-fast: false matrix: php: - - '7.4' - - '8.0' - - '8.1' + - '8.3' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup PHP Action uses: shivammathur/setup-php@v2 @@ -60,9 +58,9 @@ jobs: extensions: pdo_sqlite, gd tools: cs2pr - - uses: "ramsey/composer-install@v1" + - uses: ramsey/composer-install@v3 with: - dependency-versions: "highest" + dependency-versions: highest - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" diff --git a/composer.json b/composer.json index 7bf37af..2ecdd73 100644 --- a/composer.json +++ b/composer.json @@ -26,26 +26,26 @@ } }, "require": { - "php": "^7.4 || ^8.0", + "php": " >=8.3", "ibexa/core": "~5.0.x-dev", - "symfony/dependency-injection": "^5.0", - "symfony/http-kernel": "^5.0", - "symfony/http-foundation": "^5.0", + "pagerfanta/pagerfanta": "^2.1", "symfony/config": "^5.0", - "symfony/form": "^5.0", + "symfony/dependency-injection": "^5.0", "symfony/event-dispatcher": "^5.0", - "pagerfanta/pagerfanta": "^2.1", + "symfony/form": "^5.0", + "symfony/http-foundation": "^5.0", + "symfony/http-kernel": "^5.0", "symfony/serializer": "^5.4" }, "require-dev": { - "phpunit/phpunit": "^9.6", "friendsofphp/php-cs-fixer": "^3.0", "ibexa/code-style": "^1.0", "ibexa/doctrine-schema": "~5.0.x-dev", + "matthiasnoback/symfony-dependency-injection-test": "^4.3", "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-symfony": "^1.3", - "matthiasnoback/symfony-dependency-injection-test": "^4.3" + "phpunit/phpunit": "^9.6" }, "scripts": { "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php --show-progress=dots", @@ -59,6 +59,7 @@ } }, "config": { - "allow-plugins": false + "allow-plugins": false, + "sort-packages": true } } diff --git a/src/lib/Mapper/PagerSearchContentToDataMapper.php b/src/lib/Mapper/PagerSearchContentToDataMapper.php index 356866c..6ab6486 100644 --- a/src/lib/Mapper/PagerSearchContentToDataMapper.php +++ b/src/lib/Mapper/PagerSearchContentToDataMapper.php @@ -144,9 +144,11 @@ protected function getContributor(ContentInfo $contentInfo): ?User protected function setTranslatedContentTypesNames(array &$data, array $contentTypeIds): void { // load list of content types with proper translated names - $contentTypes = $this->contentTypeService->loadContentTypeList( - array_unique($contentTypeIds), - $this->userLanguagePreferenceProvider->getPreferredLanguages() + $contentTypes = iterator_to_array( + $this->contentTypeService->loadContentTypeList( + array_unique($contentTypeIds), + $this->userLanguagePreferenceProvider->getPreferredLanguages() + ) ); foreach ($data as $idx => $item) { From 1730825dab399956b4d95d699ea2a4ffe1af20ea Mon Sep 17 00:00:00 2001 From: Andrew Longosz <alongosz@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:18:03 +0200 Subject: [PATCH 04/19] IBX-8139: Dropped class_alias BC layer statements from all classes (#46) For more details see https://issues.ibexa.co/browse/IBX-8139 and https://github.com/ibexa/search/pull/46 Key changes: * Dropped class_alias BC layer from production code * [Composer] Dropped legacy namespaces from autoload section --- composer.json | 9 ++------- src/bundle/Controller/SearchController.php | 2 -- .../DependencyInjection/Configuration/Parser/Search.php | 2 -- .../Configuration/Parser/SearchView.php | 2 -- src/bundle/DependencyInjection/IbexaSearchExtension.php | 2 -- .../ChoiceLoader/ConfiguredLanguagesChoiceLoader.php | 2 -- src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php | 2 -- src/bundle/Form/Data/SearchData.php | 2 -- src/bundle/Form/Data/SearchUsersData.php | 2 -- .../Form/DataTransformer/DateIntervalTransformer.php | 2 -- src/bundle/Form/DataTransformer/UserTransformer.php | 2 -- src/bundle/Form/DataTransformer/UsersTransformer.php | 2 -- src/bundle/Form/Type/ContentTypeChoiceType.php | 2 -- src/bundle/Form/Type/DateIntervalType.php | 2 -- src/bundle/Form/Type/LanguageChoiceType.php | 2 -- src/bundle/Form/Type/SearchType.php | 2 -- src/bundle/Form/Type/SearchUsersType.php | 2 -- src/bundle/Form/Type/SectionChoiceType.php | 2 -- src/bundle/Form/Type/UserType.php | 2 -- src/bundle/IbexaSearchBundle.php | 2 -- src/lib/Mapper/PagerSearchContentToDataMapper.php | 2 -- src/lib/QueryType/SearchQueryType.php | 2 -- src/lib/View/SearchView.php | 2 -- src/lib/View/SearchViewBuilder.php | 2 -- src/lib/View/SearchViewFilter.php | 2 -- src/lib/View/SearchViewProvider.php | 2 -- 26 files changed, 2 insertions(+), 57 deletions(-) diff --git a/composer.json b/composer.json index 2ecdd73..1a4bec0 100644 --- a/composer.json +++ b/composer.json @@ -10,19 +10,14 @@ "psr-4": { "Ibexa\\Search\\": "src/lib/", "Ibexa\\Bundle\\Search\\": "src/bundle/", - "Ibexa\\Contracts\\Search\\": "src/contracts/", - "Ibexa\\Platform\\Bundle\\Search\\": "src/bundle/", - "Ibexa\\Platform\\Search\\": "src/lib/" + "Ibexa\\Contracts\\Search\\": "src/contracts/" } }, "autoload-dev": { "psr-4": { "Ibexa\\Tests\\Bundle\\Search\\": "tests/bundle/", "Ibexa\\Tests\\Contracts\\Search\\": "tests/contracts/", - "Ibexa\\Tests\\Search\\": "tests/lib/", - "Ibexa\\Platform\\Tests\\Contracts\\Search\\": "tests/contracts/", - "Ibexa\\Platform\\Tests\\Bundle\\Search\\": "tests/bundle/", - "Ibexa\\Platform\\Tests\\Search\\": "tests/lib/" + "Ibexa\\Tests\\Search\\": "tests/lib/" } }, "require": { diff --git a/src/bundle/Controller/SearchController.php b/src/bundle/Controller/SearchController.php index 7ee721a..c966871 100644 --- a/src/bundle/Controller/SearchController.php +++ b/src/bundle/Controller/SearchController.php @@ -18,5 +18,3 @@ public function searchAction(SearchView $view): SearchView return $view; } } - -class_alias(SearchController::class, 'Ibexa\Platform\Bundle\Search\Controller\SearchController'); diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Search.php b/src/bundle/DependencyInjection/Configuration/Parser/Search.php index 34957a4..b24f63d 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Search.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Search.php @@ -54,5 +54,3 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn } } } - -class_alias(Search::class, 'Ibexa\Platform\Bundle\Search\DependencyInjection\Configuration\Parser\Search'); diff --git a/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php b/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php index 6e23b1e..f45b90e 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php @@ -15,5 +15,3 @@ class SearchView extends View public const NODE_KEY = 'search_view'; public const INFO = 'Template for displaying main search form and results'; } - -class_alias(SearchView::class, 'Ibexa\Platform\Bundle\Search\DependencyInjection\Configuration\Parser\SearchView'); diff --git a/src/bundle/DependencyInjection/IbexaSearchExtension.php b/src/bundle/DependencyInjection/IbexaSearchExtension.php index b65d179..c5035d5 100644 --- a/src/bundle/DependencyInjection/IbexaSearchExtension.php +++ b/src/bundle/DependencyInjection/IbexaSearchExtension.php @@ -53,5 +53,3 @@ public function prependJMSTranslation(ContainerBuilder $container): void ]); } } - -class_alias(IbexaSearchExtension::class, 'Ibexa\Platform\Bundle\Search\DependencyInjection\IbexaPlatformSearchExtension'); diff --git a/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php b/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php index 4894742..aff0213 100644 --- a/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php +++ b/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php @@ -104,5 +104,3 @@ private function getPriorityOrderedLanguages(): array return array_merge($orderedLanguages, array_values($languagesAssoc)); } } - -class_alias(ConfiguredLanguagesChoiceLoader::class, 'Ibexa\Platform\Bundle\Search\Form\ChoiceLoader\ConfiguredLanguagesChoiceLoader'); diff --git a/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php b/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php index 4e1a1ed..2d7e4f9 100644 --- a/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php +++ b/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php @@ -95,5 +95,3 @@ public function loadValuesForChoices(array $choices, callable $value = null) return $this->loadChoiceList($value)->getValuesForChoices($choices); } } - -class_alias(ContentTypeChoiceLoader::class, 'Ibexa\Platform\Bundle\Search\Form\ChoiceLoader\ContentTypeChoiceLoader'); diff --git a/src/bundle/Form/Data/SearchData.php b/src/bundle/Form/Data/SearchData.php index 133fc81..d3b409b 100644 --- a/src/bundle/Form/Data/SearchData.php +++ b/src/bundle/Form/Data/SearchData.php @@ -231,5 +231,3 @@ public function isFiltered(): bool null !== $subtree; } } - -class_alias(SearchData::class, 'Ibexa\Platform\Bundle\Search\Form\Data\SearchData'); diff --git a/src/bundle/Form/Data/SearchUsersData.php b/src/bundle/Form/Data/SearchUsersData.php index 0753172..ed7af25 100644 --- a/src/bundle/Form/Data/SearchUsersData.php +++ b/src/bundle/Form/Data/SearchUsersData.php @@ -42,5 +42,3 @@ public function setPossibleUsers(array $possibleUsers): void $this->possibleUsers = $possibleUsers; } } - -class_alias(SearchUsersData::class, 'Ibexa\Platform\Bundle\Search\Form\Data\SearchUsersData'); diff --git a/src/bundle/Form/DataTransformer/DateIntervalTransformer.php b/src/bundle/Form/DataTransformer/DateIntervalTransformer.php index 65d6020..541f668 100644 --- a/src/bundle/Form/DataTransformer/DateIntervalTransformer.php +++ b/src/bundle/Form/DataTransformer/DateIntervalTransformer.php @@ -54,5 +54,3 @@ public function reverseTransform($value) ]; } } - -class_alias(DateIntervalTransformer::class, 'Ibexa\Platform\Bundle\Search\Form\DataTransformer\DateIntervalTransformer'); diff --git a/src/bundle/Form/DataTransformer/UserTransformer.php b/src/bundle/Form/DataTransformer/UserTransformer.php index 676c49e..10193b9 100644 --- a/src/bundle/Form/DataTransformer/UserTransformer.php +++ b/src/bundle/Form/DataTransformer/UserTransformer.php @@ -80,5 +80,3 @@ public function reverseTransform($value): ?User } } } - -class_alias(UserTransformer::class, 'Ibexa\Platform\Bundle\Search\Form\DataTransformer\UserTransformer'); diff --git a/src/bundle/Form/DataTransformer/UsersTransformer.php b/src/bundle/Form/DataTransformer/UsersTransformer.php index 4a087ef..a84cb3c 100644 --- a/src/bundle/Form/DataTransformer/UsersTransformer.php +++ b/src/bundle/Form/DataTransformer/UsersTransformer.php @@ -93,5 +93,3 @@ public function reverseTransform($value): SearchUsersData ); } } - -class_alias(UsersTransformer::class, 'Ibexa\Platform\Bundle\Search\Form\DataTransformer\UsersTransformer'); diff --git a/src/bundle/Form/Type/ContentTypeChoiceType.php b/src/bundle/Form/Type/ContentTypeChoiceType.php index a99968c..09cd436 100644 --- a/src/bundle/Form/Type/ContentTypeChoiceType.php +++ b/src/bundle/Form/Type/ContentTypeChoiceType.php @@ -46,5 +46,3 @@ public function configureOptions(OptionsResolver $resolver) ]); } } - -class_alias(ContentTypeChoiceType::class, 'Ibexa\Platform\Bundle\Search\Form\Type\ContentTypeChoiceType'); diff --git a/src/bundle/Form/Type/DateIntervalType.php b/src/bundle/Form/Type/DateIntervalType.php index 1af78ac..6beb1e1 100644 --- a/src/bundle/Form/Type/DateIntervalType.php +++ b/src/bundle/Form/Type/DateIntervalType.php @@ -34,5 +34,3 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->addModelTransformer(new DateIntervalTransformer()); } } - -class_alias(DateIntervalType::class, 'Ibexa\Platform\Bundle\Search\Form\Type\DateIntervalType'); diff --git a/src/bundle/Form/Type/LanguageChoiceType.php b/src/bundle/Form/Type/LanguageChoiceType.php index fc3dad8..1877ab8 100644 --- a/src/bundle/Form/Type/LanguageChoiceType.php +++ b/src/bundle/Form/Type/LanguageChoiceType.php @@ -39,5 +39,3 @@ public function configureOptions(OptionsResolver $resolver): void ]); } } - -class_alias(LanguageChoiceType::class, 'Ibexa\Platform\Bundle\Search\Form\Type\LanguageChoiceType'); diff --git a/src/bundle/Form/Type/SearchType.php b/src/bundle/Form/Type/SearchType.php index a19d909..f853c46 100644 --- a/src/bundle/Form/Type/SearchType.php +++ b/src/bundle/Form/Type/SearchType.php @@ -103,5 +103,3 @@ public function configureOptions(OptionsResolver $resolver) ]); } } - -class_alias(SearchType::class, 'Ibexa\Platform\Bundle\Search\Form\Type\SearchType'); diff --git a/src/bundle/Form/Type/SearchUsersType.php b/src/bundle/Form/Type/SearchUsersType.php index 45d69ca..815645b 100644 --- a/src/bundle/Form/Type/SearchUsersType.php +++ b/src/bundle/Form/Type/SearchUsersType.php @@ -61,5 +61,3 @@ public function configureOptions(OptionsResolver $resolver) ]); } } - -class_alias(SearchUsersType::class, 'Ibexa\Platform\Bundle\Search\Form\Type\SearchUsersType'); diff --git a/src/bundle/Form/Type/SectionChoiceType.php b/src/bundle/Form/Type/SectionChoiceType.php index 7cb1126..8d3cb91 100644 --- a/src/bundle/Form/Type/SectionChoiceType.php +++ b/src/bundle/Form/Type/SectionChoiceType.php @@ -48,5 +48,3 @@ public function getParent(): ?string return ChoiceType::class; } } - -class_alias(SectionChoiceType::class, 'Ibexa\Platform\Bundle\Search\Form\Type\SectionChoiceType'); diff --git a/src/bundle/Form/Type/UserType.php b/src/bundle/Form/Type/UserType.php index 29f275c..d3f6336 100644 --- a/src/bundle/Form/Type/UserType.php +++ b/src/bundle/Form/Type/UserType.php @@ -34,5 +34,3 @@ public function getParent(): ?string return HiddenType::class; } } - -class_alias(UserType::class, 'Ibexa\Platform\Bundle\Search\Form\Type\UserType'); diff --git a/src/bundle/IbexaSearchBundle.php b/src/bundle/IbexaSearchBundle.php index 1dbdb31..b2b8a76 100644 --- a/src/bundle/IbexaSearchBundle.php +++ b/src/bundle/IbexaSearchBundle.php @@ -26,5 +26,3 @@ public function build(ContainerBuilder $container) $core->addConfigParser(new SuggestionParser()); } } - -class_alias(IbexaSearchBundle::class, 'Ibexa\Platform\Bundle\Search\IbexaPlatformSearchBundle'); diff --git a/src/lib/Mapper/PagerSearchContentToDataMapper.php b/src/lib/Mapper/PagerSearchContentToDataMapper.php index 6ab6486..ccca10f 100644 --- a/src/lib/Mapper/PagerSearchContentToDataMapper.php +++ b/src/lib/Mapper/PagerSearchContentToDataMapper.php @@ -162,5 +162,3 @@ protected function setTranslatedContentTypesNames(array &$data, array $contentTy } } } - -class_alias(PagerSearchContentToDataMapper::class, 'Ibexa\Platform\Search\Mapper\PagerSearchContentToDataMapper'); diff --git a/src/lib/QueryType/SearchQueryType.php b/src/lib/QueryType/SearchQueryType.php index 0a205f6..377c445 100644 --- a/src/lib/QueryType/SearchQueryType.php +++ b/src/lib/QueryType/SearchQueryType.php @@ -176,5 +176,3 @@ private function buildSectionTermAggregation(array $parameters): SectionTermAggr return $aggregation; } } - -class_alias(SearchQueryType::class, 'Ibexa\Platform\Search\QueryType\SearchQueryType'); diff --git a/src/lib/View/SearchView.php b/src/lib/View/SearchView.php index 1923e8d..e1a64dd 100644 --- a/src/lib/View/SearchView.php +++ b/src/lib/View/SearchView.php @@ -13,5 +13,3 @@ class SearchView extends BaseView { } - -class_alias(SearchView::class, 'Ibexa\Platform\Search\View\SearchView'); diff --git a/src/lib/View/SearchViewBuilder.php b/src/lib/View/SearchViewBuilder.php index 79a22f6..89463a1 100644 --- a/src/lib/View/SearchViewBuilder.php +++ b/src/lib/View/SearchViewBuilder.php @@ -106,5 +106,3 @@ private function getSearchLanguageFilter(?string $languageCode): array ]; } } - -class_alias(SearchViewBuilder::class, 'Ibexa\Platform\Search\View\SearchViewBuilder'); diff --git a/src/lib/View/SearchViewFilter.php b/src/lib/View/SearchViewFilter.php index 693fbae..5ebfd8d 100644 --- a/src/lib/View/SearchViewFilter.php +++ b/src/lib/View/SearchViewFilter.php @@ -126,5 +126,3 @@ public function handleSearchForm(FilterViewBuilderParametersEvent $event): void ]); } } - -class_alias(SearchViewFilter::class, 'Ibexa\Platform\Search\View\SearchViewFilter'); diff --git a/src/lib/View/SearchViewProvider.php b/src/lib/View/SearchViewProvider.php index 82c075d..c6d1dbb 100644 --- a/src/lib/View/SearchViewProvider.php +++ b/src/lib/View/SearchViewProvider.php @@ -51,5 +51,3 @@ protected function buildSearchListView(array $viewConfig): SearchView return $view; } } - -class_alias(SearchViewProvider::class, 'Ibexa\Platform\Search\View\SearchViewProvider'); From 1cfaf7ddfa5210ddbb6d625502f46538a01c2342 Mon Sep 17 00:00:00 2001 From: Andrew Longosz <alongosz@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:29:26 +0200 Subject: [PATCH 05/19] IBX-8394: Used new RepositoryConfigurationProviderInterface contract (#49) For more details see https://issues.ibexa.co/browse/IBX-8394 and https://github.com/ibexa/search/pull/49 Key changes: * [Rector] Used new RepositoryConfigurationProviderInterface contract --- .../Provider/NameSortingDefinitionProvider.php | 6 +++--- .../EventListener/ContentSuggestionSubscriberTest.php | 8 ++++---- .../Provider/NameSortingDefinitionProviderTest.php | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib/SortingDefinition/Provider/NameSortingDefinitionProvider.php b/src/lib/SortingDefinition/Provider/NameSortingDefinitionProvider.php index 87f7a36..3358d29 100644 --- a/src/lib/SortingDefinition/Provider/NameSortingDefinitionProvider.php +++ b/src/lib/SortingDefinition/Provider/NameSortingDefinitionProvider.php @@ -8,7 +8,7 @@ namespace Ibexa\Search\SortingDefinition\Provider; -use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider; +use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentName; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentTranslatedName; @@ -21,11 +21,11 @@ final class NameSortingDefinitionProvider implements SortingDefinitionProviderInterface, TranslationContainerInterface { - private RepositoryConfigurationProvider $configurationProvider; + private RepositoryConfigurationProviderInterface $configurationProvider; private TranslatorInterface $translator; - public function __construct(RepositoryConfigurationProvider $configurationProvider, TranslatorInterface $translator) + public function __construct(RepositoryConfigurationProviderInterface $configurationProvider, TranslatorInterface $translator) { $this->configurationProvider = $configurationProvider; $this->translator = $translator; diff --git a/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php b/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php index 07e56db..aa00398 100644 --- a/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php +++ b/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php @@ -8,7 +8,7 @@ namespace Ibexa\Tests\Search\EventDispatcher\EventListener; -use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider; +use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface; use Ibexa\Contracts\Core\Exception\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\SearchService as SearchServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Content; @@ -33,8 +33,8 @@ final class ContentSuggestionSubscriberTest extends TestCase { - /** @var \Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider&\PHPUnit\Framework\MockObject\MockObject */ - private RepositoryConfigurationProvider $configProviderMock; + /** @var \Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface&\PHPUnit\Framework\MockObject\MockObject */ + private RepositoryConfigurationProviderInterface $configProviderMock; private ?Query $capturedQuery; @@ -45,7 +45,7 @@ final class ContentSuggestionSubscriberTest extends TestCase protected function setUp(): void { - $this->configProviderMock = $this->createMock(RepositoryConfigurationProvider::class); + $this->configProviderMock = $this->createMock(RepositoryConfigurationProviderInterface::class); $this->capturedQuery = null; $this->searchServiceSupportsScoring = false; $this->loggerMock = $this->createMock(LoggerInterface::class); diff --git a/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php b/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php index a78c1e5..47b0433 100644 --- a/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php +++ b/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php @@ -8,7 +8,7 @@ namespace Ibexa\Tests\Search\SortingDefinition\Provider; -use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider; +use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentName; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentTranslatedName; @@ -22,8 +22,8 @@ final class NameSortingDefinitionProviderTest extends TestCase /** @var \Symfony\Contracts\Translation\TranslatorInterface&\PHPUnit\Framework\MockObject\MockObject */ private TranslatorInterface $translator; - /** @var \Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider&\PHPUnit\Framework\MockObject\MockObject */ - private RepositoryConfigurationProvider $configurationProvider; + /** @var \Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface&\PHPUnit\Framework\MockObject\MockObject */ + private RepositoryConfigurationProviderInterface $configurationProvider; private NameSortingDefinitionProvider $provider; @@ -32,7 +32,7 @@ protected function setUp(): void $this->translator = $this->createMock(TranslatorInterface::class); $this->translator->method('trans')->willReturnArgument(0); - $this->configurationProvider = $this->createMock(RepositoryConfigurationProvider::class); + $this->configurationProvider = $this->createMock(RepositoryConfigurationProviderInterface::class); $this->provider = new NameSortingDefinitionProvider( $this->configurationProvider, From ac307fd3d908003ddae0bea7f26e1751f4dea532 Mon Sep 17 00:00:00 2001 From: Andrew Longosz <alongosz@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:30:44 +0200 Subject: [PATCH 06/19] [Rector] Applied all Symfony 5.x rectors to the production codebase (#48) Applied rules: * AddReturnTypeDeclarationRector * AnnotationToAttributeRector --- src/bundle/Form/Data/SearchData.php | 5 +---- src/bundle/Form/Type/ContentTypeChoiceType.php | 2 +- src/lib/View/SearchViewFilter.php | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/bundle/Form/Data/SearchData.php b/src/bundle/Form/Data/SearchData.php index d3b409b..5e31258 100644 --- a/src/bundle/Form/Data/SearchData.php +++ b/src/bundle/Form/Data/SearchData.php @@ -18,11 +18,8 @@ class SearchData { /** * @var int - * - * @Assert\Range( - * max = 1000 - * ) */ + #[Assert\Range(max: 1000)] private $limit; /** @var int */ diff --git a/src/bundle/Form/Type/ContentTypeChoiceType.php b/src/bundle/Form/Type/ContentTypeChoiceType.php index 09cd436..5508173 100644 --- a/src/bundle/Form/Type/ContentTypeChoiceType.php +++ b/src/bundle/Form/Type/ContentTypeChoiceType.php @@ -30,7 +30,7 @@ public function __construct( $this->contentTypeChoiceLoader = $contentTypeChoiceLoader; } - public function getParent() + public function getParent(): ?string { return ChoiceType::class; } diff --git a/src/lib/View/SearchViewFilter.php b/src/lib/View/SearchViewFilter.php index 5ebfd8d..fc90721 100644 --- a/src/lib/View/SearchViewFilter.php +++ b/src/lib/View/SearchViewFilter.php @@ -51,7 +51,7 @@ public function __construct( $this->urlGenerator = $urlGenerator; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ViewEvents::FILTER_BUILDER_PARAMETERS => 'handleSearchForm']; } From 3a239e1b6ed980e1d7b27099fa2dd2cd97f90edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 11 Dec 2024 12:17:55 +0100 Subject: [PATCH 07/19] Fixed issues reported by phpstan (#52) --- phpstan-baseline.neon | 9 ++----- .../Mapper/PagerSearchContentToDataMapper.php | 26 +++++++++++++++++-- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e50f586..1158007 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -231,17 +231,12 @@ parameters: path: src/bundle/IbexaSearchBundle.php - - message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\PagerSearchContentToDataMapper\\:\\:map\\(\\) has parameter \\$pager with generic class Pagerfanta\\\\Pagerfanta but does not specify its types\\: T$#" - count: 1 - path: src/lib/Mapper/PagerSearchContentToDataMapper.php - - - - message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\PagerSearchContentToDataMapper\\:\\:map\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Cannot access offset int on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\>\\.$#" count: 1 path: src/lib/Mapper/PagerSearchContentToDataMapper.php - - message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\PagerSearchContentToDataMapper\\:\\:setTranslatedContentTypesNames\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" + message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\PagerSearchContentToDataMapper\\:\\:map\\(\\) has parameter \\$pager with generic class Pagerfanta\\\\Pagerfanta but does not specify its types\\: T$#" count: 1 path: src/lib/Mapper/PagerSearchContentToDataMapper.php diff --git a/src/lib/Mapper/PagerSearchContentToDataMapper.php b/src/lib/Mapper/PagerSearchContentToDataMapper.php index 356866c..b38a033 100644 --- a/src/lib/Mapper/PagerSearchContentToDataMapper.php +++ b/src/lib/Mapper/PagerSearchContentToDataMapper.php @@ -21,6 +21,25 @@ use Ibexa\Core\Repository\LocationResolver\LocationResolver; use Pagerfanta\Pagerfanta; +/** + * @phpstan-type TData = array{ + * content: \Ibexa\Contracts\Core\Repository\Values\Content\Content, + * contentTypeId: int, + * contentId: int, + * name: string, + * language: string, + * contributor: \Ibexa\Contracts\Core\Repository\Values\User\User|null, + * version: int, + * content_type: \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType, + * modified: \DateTimeInterface, + * initialLanguageCode: string, + * content_is_user: bool, + * available_enabled_translations: iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Language>, + * available_translations: iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Language>, + * translation_language_code: string, + * resolvedLocation: \Ibexa\Contracts\Core\Repository\Values\Content\Location + * } + */ class PagerSearchContentToDataMapper { /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ @@ -57,6 +76,9 @@ public function __construct( $this->locationResolver = $locationResolver; } + /** + * @phpstan-return TData[] + */ public function map(Pagerfanta $pager): array { $data = []; @@ -138,8 +160,8 @@ protected function getContributor(ContentInfo $contentInfo): ?User } /** - * @param array $data - * @param int[] $contentTypeIds + * @phpstan-param TData[] $data + * @phpstan-param int[] $contentTypeIds */ protected function setTranslatedContentTypesNames(array &$data, array $contentTypeIds): void { From 927f626f28ff383d9727420bdcdeee6bd52fe26e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 11 Dec 2024 13:52:03 +0100 Subject: [PATCH 08/19] Added base class for BuildSuggestionCollectionEvent event (#51) --- src/contracts/Event/BuildSuggestionCollectionEvent.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contracts/Event/BuildSuggestionCollectionEvent.php b/src/contracts/Event/BuildSuggestionCollectionEvent.php index 0ed3533..3d7fcda 100644 --- a/src/contracts/Event/BuildSuggestionCollectionEvent.php +++ b/src/contracts/Event/BuildSuggestionCollectionEvent.php @@ -10,8 +10,9 @@ use Ibexa\Contracts\Search\Model\Suggestion\SuggestionCollection; use Ibexa\Search\Model\SuggestionQuery; +use Symfony\Contracts\EventDispatcher\Event; -final class BuildSuggestionCollectionEvent +final class BuildSuggestionCollectionEvent extends Event { private SuggestionCollection $suggestionCollection; From 855b272434c2e6d6184c9518eb089f2ac92f40cf Mon Sep 17 00:00:00 2001 From: Petro Kurbatskyi <petro.kurbatskyi@ibexa.co> Date: Wed, 22 Jan 2025 12:44:48 +0100 Subject: [PATCH 09/19] Updated copyright year to 2025 --- COPYRIGHT | 2 +- LICENSE | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 4e03477..536d349 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,4 +1,4 @@ -Copyright (C) 1999-2024 Ibexa AS (formerly eZ Systems AS). All rights reserved. +Copyright (C) 1999-2025 Ibexa AS (formerly eZ Systems AS). All rights reserved. This source code is available separately under the following licenses: diff --git a/LICENSE b/LICENSE index eb76224..a31960f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 1999-2024 Ibexa AS (formerly eZ Systems AS). All rights reserved. +Copyright (C) 1999-2025 Ibexa AS (formerly eZ Systems AS). All rights reserved. This source code is available separately under the following licenses: diff --git a/README.md b/README.md index c29ce63..e765233 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ See [the official documentation](https://doc.ibexa.co/) to learn more about feat of [Ibexa DXP](https://www.ibexa.co/products) and Ibexa Open Source. ## COPYRIGHT -Copyright (C) 1999-2024 Ibexa AS (formerly eZ Systems AS). All rights reserved. +Copyright (C) 1999-2025 Ibexa AS (formerly eZ Systems AS). All rights reserved. ## LICENSE This source code is available separately under the following licenses: From 008945998f5826fd5e5420b5de0c4966331e7917 Mon Sep 17 00:00:00 2001 From: Andrew Longosz <alongosz@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:07:29 +0100 Subject: [PATCH 10/19] IBX-8470: Upgraded codebase to Symfony 6 (#50) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bumped Symfony packages requirements to ^6.4 * [CS] Upgraded Ibexa Code Style to ~2.0.0 * [Tests] Fixed incorrect usage of expectException * Upgraded Symfony Forms extension points code * Upgraded Symfony Bundle extension points code * Upgraded Ibexa Core extension points code * Improved SearchFacetsExtension Twig extension code * [PHPStan] Removed resolved issues from the baseline * Changed ContentTypeChoiceLoader constructor to use property promotion * [Composer] Bumped Pagerfanta to v3 * Updated phpstan baseline --------- Co-authored-by: Konrad Oboza <konradoboza@users.noreply.github.com> Co-authored-by: Adam Wójs <adam@wojs.pl> --- composer.json | 19 +++---- phpstan-baseline.neon | 55 ++++--------------- .../Configuration/Parser/Search.php | 7 +-- .../Configuration/Parser/SearchView.php | 4 +- .../IbexaSearchExtension.php | 10 ++-- .../ConfiguredLanguagesChoiceLoader.php | 30 +++------- .../ChoiceLoader/ContentTypeChoiceLoader.php | 36 +++--------- src/bundle/IbexaSearchBundle.php | 3 +- .../Twig/Extension/SearchFacetsExtension.php | 4 +- .../ContentSuggestionSubscriberTest.php | 2 +- tests/lib/QueryType/SearchQueryTypeTest.php | 2 +- .../Service/Event/SuggestionServiceTest.php | 10 ++-- .../NameSortingDefinitionProviderTest.php | 4 +- 13 files changed, 56 insertions(+), 130 deletions(-) diff --git a/composer.json b/composer.json index 1a4bec0..53b5933 100644 --- a/composer.json +++ b/composer.json @@ -23,18 +23,17 @@ "require": { "php": " >=8.3", "ibexa/core": "~5.0.x-dev", - "pagerfanta/pagerfanta": "^2.1", - "symfony/config": "^5.0", - "symfony/dependency-injection": "^5.0", - "symfony/event-dispatcher": "^5.0", - "symfony/form": "^5.0", - "symfony/http-foundation": "^5.0", - "symfony/http-kernel": "^5.0", - "symfony/serializer": "^5.4" + "pagerfanta/pagerfanta": "^3.6.2", + "symfony/config": "^6.4", + "symfony/dependency-injection": "^6.4", + "symfony/event-dispatcher": "^6.4", + "symfony/form": "^6.4", + "symfony/http-foundation": "^6.4", + "symfony/http-kernel": "^6.4", + "symfony/serializer": "^6.4" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.0", - "ibexa/code-style": "^1.0", + "ibexa/code-style": "~2.0.0", "ibexa/doctrine-schema": "~5.0.x-dev", "matthiasnoback/symfony-dependency-injection-test": "^4.3", "phpstan/phpstan": "^1.10", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1158007..c2f9f9e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,30 +1,10 @@ parameters: ignoreErrors: - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Search\\:\\:addSemanticConfig\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/DependencyInjection/Configuration/Parser/Search.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Search\\:\\:mapConfig\\(\\) has parameter \\$scopeSettings with no value type specified in iterable type array\\.$#" count: 1 path: src/bundle/DependencyInjection/Configuration/Parser/Search.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\DependencyInjection\\\\IbexaSearchExtension\\:\\:load\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/DependencyInjection/IbexaSearchExtension.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\ChoiceLoader\\\\ConfiguredLanguagesChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\ChoiceLoader\\\\ContentTypeChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php - - message: "#^Parameter \\#1 \\$array of function usort expects TArray of array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\>, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\> given\\.$#" count: 1 @@ -180,11 +160,6 @@ parameters: count: 1 path: src/bundle/Form/DataTransformer/UsersTransformer.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\ContentTypeChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/ContentTypeChoiceType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\DateIntervalType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -200,43 +175,28 @@ parameters: count: 1 path: src/bundle/Form/Type/SearchType.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/SearchType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchUsersType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/bundle/Form/Type/SearchUsersType.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchUsersType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/SearchUsersType.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SectionChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/SectionChoiceType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\UserType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/bundle/Form/Type/UserType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\IbexaSearchBundle\\:\\:build\\(\\) has no return type specified\\.$#" + message: "#^Method Ibexa\\\\Contracts\\\\Search\\\\Mapper\\\\SearchHitToContentSuggestionMapperInterface\\:\\:map\\(\\) has parameter \\$searchHit with generic class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit but does not specify its types\\: T$#" count: 1 - path: src/bundle/IbexaSearchBundle.php + path: src/contracts/Mapper/SearchHitToContentSuggestionMapperInterface.php - - message: "#^Cannot access offset int on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\>\\.$#" + message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\PagerSearchContentToDataMapper\\:\\:map\\(\\) has parameter \\$pager with generic class Pagerfanta\\\\Pagerfanta but does not specify its types\\: T$#" count: 1 path: src/lib/Mapper/PagerSearchContentToDataMapper.php - - message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\PagerSearchContentToDataMapper\\:\\:map\\(\\) has parameter \\$pager with generic class Pagerfanta\\\\Pagerfanta but does not specify its types\\: T$#" + message: "#^PHPDoc tag @var for variable \\$searchHit contains generic class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit but does not specify its types\\: T$#" count: 1 path: src/lib/Mapper/PagerSearchContentToDataMapper.php @@ -246,7 +206,12 @@ parameters: path: src/lib/Mapper/PagerSearchContentToDataMapper.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit\\:\\:\\$score \\(float\\) on left side of \\?\\? is not nullable\\.$#" + message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\SearchHitToContentSuggestionMapper\\:\\:map\\(\\) has parameter \\$searchHit with generic class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit but does not specify its types\\: T$#" + count: 1 + path: src/lib/Mapper/SearchHitToContentSuggestionMapper.php + + - + message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject\\>\\:\\:\\$score \\(float\\) on left side of \\?\\? is not nullable\\.$#" count: 1 path: src/lib/Mapper/SearchHitToContentSuggestionMapper.php diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Search.php b/src/bundle/DependencyInjection/Configuration/Parser/Search.php index b24f63d..583769b 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Search.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Search.php @@ -14,12 +14,7 @@ class Search extends AbstractParser { - /** - * Adds semantic configuration definition. - * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess> - */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('search') diff --git a/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php b/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php index f45b90e..06ecc77 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/SearchView.php @@ -12,6 +12,6 @@ class SearchView extends View { - public const NODE_KEY = 'search_view'; - public const INFO = 'Template for displaying main search form and results'; + public const string NODE_KEY = 'search_view'; + public const string INFO = 'Template for displaying main search form and results'; } diff --git a/src/bundle/DependencyInjection/IbexaSearchExtension.php b/src/bundle/DependencyInjection/IbexaSearchExtension.php index c5035d5..2242d56 100644 --- a/src/bundle/DependencyInjection/IbexaSearchExtension.php +++ b/src/bundle/DependencyInjection/IbexaSearchExtension.php @@ -16,7 +16,10 @@ class IbexaSearchExtension extends Extension implements PrependExtensionInterface { - public function load(array $configs, ContainerBuilder $container) + /** + * @throws \Exception + */ + public function load(array $configs, ContainerBuilder $container): void { $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yaml'); @@ -24,17 +27,12 @@ public function load(array $configs, ContainerBuilder $container) /** * Allow an extension to prepend the extension configurations. - * - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ public function prepend(ContainerBuilder $container): void { $this->prependJMSTranslation($container); } - /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - */ public function prependJMSTranslation(ContainerBuilder $container): void { $container->prependExtensionConfig('jms_translation', [ diff --git a/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php b/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php index aff0213..98c6683 100644 --- a/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php +++ b/src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php @@ -11,20 +11,15 @@ use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; class ConfiguredLanguagesChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - private $languageService; + private LanguageService $languageService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - */ public function __construct(LanguageService $languageService, ConfigResolverInterface $configResolver) { $this->languageService = $languageService; @@ -32,27 +27,21 @@ public function __construct(LanguageService $languageService, ConfigResolverInte } /** - * {@inheritdoc} + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] */ public function getChoiceList(): array { return $this->getPriorityOrderedLanguages(); } - /** - * {@inheritdoc} - */ - public function loadChoiceList(callable $value = null) + public function loadChoiceList(callable $value = null): ChoiceListInterface { $choices = $this->getChoiceList(); return new ArrayChoiceList($choices, $value); } - /** - * {@inheritdoc} - */ - public function loadChoicesForValues(array $values, callable $value = null) + public function loadChoicesForValues(array $values, callable $value = null): array { // Optimize $values = array_filter($values); @@ -63,10 +52,7 @@ public function loadChoicesForValues(array $values, callable $value = null) return $this->loadChoiceList($value)->getChoicesForValues($values); } - /** - * {@inheritdoc} - */ - public function loadValuesForChoices(array $choices, callable $value = null) + public function loadValuesForChoices(array $choices, callable $value = null): array { // Optimize $choices = array_filter($choices); @@ -78,7 +64,7 @@ public function loadValuesForChoices(array $choices, callable $value = null) } /** - * Sort languages based on siteaccess languages order. + * Sort languages based on SiteAccess languages order. * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] */ diff --git a/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php b/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php index 2d7e4f9..aebc4e4 100644 --- a/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php +++ b/src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php @@ -12,28 +12,19 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; class ContentTypeChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - protected $contentTypeService; - - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ - private $userLanguagePreferenceProvider; - - /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider - */ - public function __construct(ContentTypeService $contentTypeService, UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider) - { - $this->contentTypeService = $contentTypeService; - $this->userLanguagePreferenceProvider = $userLanguagePreferenceProvider; + public function __construct( + protected ContentTypeService $contentTypeService, + private readonly UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + ) { } /** - * {@inheritdoc} + * @return array<string, iterable<\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType>> */ public function getChoiceList(): array { @@ -52,20 +43,14 @@ public function getChoiceList(): array return $contentTypesList; } - /** - * {@inheritdoc} - */ - public function loadChoiceList(callable $value = null) + public function loadChoiceList(callable $value = null): ChoiceListInterface { $choices = $this->getChoiceList(); return new ArrayChoiceList($choices, $value); } - /** - * {@inheritdoc} - */ - public function loadChoicesForValues(array $values, callable $value = null) + public function loadChoicesForValues(array $values, callable $value = null): array { // Optimize $values = array_filter($values); @@ -76,10 +61,7 @@ public function loadChoicesForValues(array $values, callable $value = null) return $this->loadChoiceList($value)->getChoicesForValues($values); } - /** - * {@inheritdoc} - */ - public function loadValuesForChoices(array $choices, callable $value = null) + public function loadValuesForChoices(array $choices, callable $value = null): array { // Optimize $choices = array_filter($choices); diff --git a/src/bundle/IbexaSearchBundle.php b/src/bundle/IbexaSearchBundle.php index b2b8a76..0e207d2 100644 --- a/src/bundle/IbexaSearchBundle.php +++ b/src/bundle/IbexaSearchBundle.php @@ -4,6 +4,7 @@ * @copyright Copyright (C) Ibexa AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. */ +declare(strict_types=1); namespace Ibexa\Bundle\Search; @@ -15,7 +16,7 @@ class IbexaSearchBundle extends Bundle { - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { /** @var \Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension $core */ $core = $container->getExtension('ibexa'); diff --git a/src/bundle/Twig/Extension/SearchFacetsExtension.php b/src/bundle/Twig/Extension/SearchFacetsExtension.php index bced76c..17d5426 100644 --- a/src/bundle/Twig/Extension/SearchFacetsExtension.php +++ b/src/bundle/Twig/Extension/SearchFacetsExtension.php @@ -24,7 +24,7 @@ public function getFilters(): array return [ new TwigFilter( 'ibexa_choices_as_facets', - [$this, 'getChoicesAsFacets'] + $this->getChoicesAsFacets(...) ), ]; } @@ -46,7 +46,7 @@ public function getChoicesAsFacets( if ($comparator === null) { $comparator = static function (ChoiceView $choice, TermAggregationResultEntry $term): bool { - return $choice->data == $term->getKey(); + return $choice->data === $term->getKey(); }; } diff --git a/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php b/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php index aa00398..35da31b 100644 --- a/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php +++ b/tests/lib/EventDispatcher/EventListener/ContentSuggestionSubscriberTest.php @@ -116,7 +116,7 @@ public function testOnContentSuggestionWithException(): void $event = new BuildSuggestionCollectionEvent($query); $this->loggerMock - ->expects($this->once()) + ->expects(self::once()) ->method('error'); $subscriber->onBuildSuggestionCollectionEvent($event); diff --git a/tests/lib/QueryType/SearchQueryTypeTest.php b/tests/lib/QueryType/SearchQueryTypeTest.php index 0353635..e049e75 100644 --- a/tests/lib/QueryType/SearchQueryTypeTest.php +++ b/tests/lib/QueryType/SearchQueryTypeTest.php @@ -62,7 +62,7 @@ public function testGetQuery( ->method('supports') ->willReturnMap($returnMap); - $this->assertEquals($expectedQuery, $this->queryType->getQuery($parameters)); + self::assertEquals($expectedQuery, $this->queryType->getQuery($parameters)); } /** diff --git a/tests/lib/Service/Event/SuggestionServiceTest.php b/tests/lib/Service/Event/SuggestionServiceTest.php index 78ceb7d..7d88492 100644 --- a/tests/lib/Service/Event/SuggestionServiceTest.php +++ b/tests/lib/Service/Event/SuggestionServiceTest.php @@ -57,7 +57,7 @@ static function (Event $event) use (&$callCount, $query, $suggestionCollection): ); $this->innerServiceMock - ->expects($this->once()) + ->expects(self::once()) ->method('suggest') ->with($query) ->willReturn($suggestionCollection); @@ -75,18 +75,18 @@ public function testSuggestWithPropagationStop(): void $beforeEvent->stopPropagation(); $this->eventDispatcherMock - ->expects($this->once()) + ->expects(self::once()) ->method('dispatch') ->willReturn($beforeEvent); $this->innerServiceMock - ->expects($this->never()) + ->expects(self::never()) ->method('suggest'); $service = new SuggestionService($this->innerServiceMock, $this->eventDispatcherMock); - self::expectException(LogicException::class); - self::expectExceptionMessage('The suggestion collection must be set when the propagation is stopped.'); + $this->expectException(LogicException::class); + $this->expectExceptionMessage('The suggestion collection must be set when the propagation is stopped.'); $service->suggest($query); } } diff --git a/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php b/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php index 47b0433..3b1f19c 100644 --- a/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php +++ b/tests/lib/SortingDefinition/Provider/NameSortingDefinitionProviderTest.php @@ -44,7 +44,7 @@ public function testGetSortingDefinitionsForLSE(): void { $this->setSearchEngine('legacy'); - $this->assertEquals( + self::assertEquals( [ new SortingDefinition( 'name_asc', @@ -71,7 +71,7 @@ public function testGetSortingDefinitionsForNonLSE(): void { $this->setSearchEngine('solr'); - $this->assertEquals( + self::assertEquals( [ new SortingDefinition( 'name_asc', From 899fd9bc88d2e3f00a341b611336c670bae3fd9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:05:37 +0100 Subject: [PATCH 11/19] [Rector] Added rector configuration --- composer.json | 1 + rector.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 rector.php diff --git a/composer.json b/composer.json index 53b5933..f845cac 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "require-dev": { "ibexa/code-style": "~2.0.0", "ibexa/doctrine-schema": "~5.0.x-dev", + "ibexa/rector": "~5.0.x-dev", "matthiasnoback/symfony-dependency-injection-test": "^4.3", "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..411e067 --- /dev/null +++ b/rector.php @@ -0,0 +1,21 @@ +<?php + +/** + * @copyright Copyright (C) Ibexa AS. All rights reserved. + * @license For full copyright and license information view LICENSE file distributed with this source code. + */ +declare(strict_types=1); + +use Ibexa\Contracts\Rector\Sets\IbexaSetList; +use Rector\Config\RectorConfig; +use Rector\Symfony\Set\SymfonySetList; + +return RectorConfig::configure() + ->withPaths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + ->withSets([ + IbexaSetList::IBEXA_50->value, + SymfonySetList::SYMFONY_60, + ]); From 183a28c6348817e06f2bb7a309d3bc05330fb31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:05:44 +0100 Subject: [PATCH 12/19] [Form] Added missing return type declarations --- src/bundle/Form/Type/ContentTypeChoiceType.php | 2 +- src/bundle/Form/Type/DateIntervalType.php | 2 +- src/bundle/Form/Type/SearchType.php | 4 ++-- src/bundle/Form/Type/SearchUsersType.php | 4 ++-- src/bundle/Form/Type/SectionChoiceType.php | 2 +- src/bundle/Form/Type/UserType.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bundle/Form/Type/ContentTypeChoiceType.php b/src/bundle/Form/Type/ContentTypeChoiceType.php index 5508173..4f7f066 100644 --- a/src/bundle/Form/Type/ContentTypeChoiceType.php +++ b/src/bundle/Form/Type/ContentTypeChoiceType.php @@ -35,7 +35,7 @@ public function getParent(): ?string return ChoiceType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ diff --git a/src/bundle/Form/Type/DateIntervalType.php b/src/bundle/Form/Type/DateIntervalType.php index 6beb1e1..86f207f 100644 --- a/src/bundle/Form/Type/DateIntervalType.php +++ b/src/bundle/Form/Type/DateIntervalType.php @@ -18,7 +18,7 @@ class DateIntervalType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('start_date', DateType::class, [ diff --git a/src/bundle/Form/Type/SearchType.php b/src/bundle/Form/Type/SearchType.php index f853c46..68b1c0d 100644 --- a/src/bundle/Form/Type/SearchType.php +++ b/src/bundle/Form/Type/SearchType.php @@ -40,7 +40,7 @@ public function __construct( * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('query', CoreTextType::class, ['required' => false]) @@ -95,7 +95,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) * * @throws \Symfony\Component\OptionsResolver\Exception\AccessException */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => SearchData::class, diff --git a/src/bundle/Form/Type/SearchUsersType.php b/src/bundle/Form/Type/SearchUsersType.php index 815645b..33ad5cc 100644 --- a/src/bundle/Form/Type/SearchUsersType.php +++ b/src/bundle/Form/Type/SearchUsersType.php @@ -38,7 +38,7 @@ public function __construct( $this->userContentTypeIdentifier = $userContentTypeIdentifier; } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addViewTransformer( new UsersTransformer( @@ -54,7 +54,7 @@ public function getParent(): ?string return TextType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => SearchUsersData::class, diff --git a/src/bundle/Form/Type/SectionChoiceType.php b/src/bundle/Form/Type/SectionChoiceType.php index 8d3cb91..2490048 100644 --- a/src/bundle/Form/Type/SectionChoiceType.php +++ b/src/bundle/Form/Type/SectionChoiceType.php @@ -31,7 +31,7 @@ public function __construct(SectionService $sectionService) /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'choices' => $this->sectionService->loadSections(), diff --git a/src/bundle/Form/Type/UserType.php b/src/bundle/Form/Type/UserType.php index d3f6336..18f3fae 100644 --- a/src/bundle/Form/Type/UserType.php +++ b/src/bundle/Form/Type/UserType.php @@ -24,7 +24,7 @@ public function __construct(UserService $userService) $this->userService = $userService; } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addViewTransformer(new UserTransformer($this->userService)); } From 62b5a0f29075bd768135adad1b92f268e36ef6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:07:09 +0100 Subject: [PATCH 13/19] [Form] Removed redundant PHPDocs --- src/bundle/Form/Type/DateIntervalType.php | 3 --- src/bundle/Form/Type/SearchType.php | 11 ----------- src/bundle/Form/Type/SectionChoiceType.php | 11 ----------- 3 files changed, 25 deletions(-) diff --git a/src/bundle/Form/Type/DateIntervalType.php b/src/bundle/Form/Type/DateIntervalType.php index 86f207f..ab8eff3 100644 --- a/src/bundle/Form/Type/DateIntervalType.php +++ b/src/bundle/Form/Type/DateIntervalType.php @@ -15,9 +15,6 @@ class DateIntervalType extends AbstractType { - /** - * {@inheritdoc} - */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder diff --git a/src/bundle/Form/Type/SearchType.php b/src/bundle/Form/Type/SearchType.php index 68b1c0d..f252b62 100644 --- a/src/bundle/Form/Type/SearchType.php +++ b/src/bundle/Form/Type/SearchType.php @@ -34,12 +34,6 @@ public function __construct( $this->configResolver = $configResolver; } - /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder - * @param array $options - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder @@ -90,11 +84,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ); } - /** - * {@inheritdoc} - * - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ diff --git a/src/bundle/Form/Type/SectionChoiceType.php b/src/bundle/Form/Type/SectionChoiceType.php index 2490048..4020695 100644 --- a/src/bundle/Form/Type/SectionChoiceType.php +++ b/src/bundle/Form/Type/SectionChoiceType.php @@ -18,19 +18,11 @@ class SectionChoiceType extends AbstractType /** @var \Ibexa\Contracts\Core\Repository\SectionService */ private $sectionService; - /** - * SectionChoiceType constructor. - * - * @param \Ibexa\Contracts\Core\Repository\SectionService $sectionService - */ public function __construct(SectionService $sectionService) { $this->sectionService = $sectionService; } - /** - * {@inheritdoc} - */ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ @@ -40,9 +32,6 @@ public function configureOptions(OptionsResolver $resolver): void ]); } - /** - * {@inheritdoc} - */ public function getParent(): ?string { return ChoiceType::class; From 53a7bec2814c0b8a99ee59463554800e53dfd755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:07:42 +0100 Subject: [PATCH 14/19] [Rector] Enabled Symfony 6.1 and Symfony 6.2 rule sets --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index 411e067..a81fa9b 100644 --- a/rector.php +++ b/rector.php @@ -18,4 +18,6 @@ ->withSets([ IbexaSetList::IBEXA_50->value, SymfonySetList::SYMFONY_60, + SymfonySetList::SYMFONY_61, + SymfonySetList::SYMFONY_62, ]); From e638cecdb4f690e20b2b958675571c0eceb0547e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:09:25 +0100 Subject: [PATCH 15/19] [HTTP] Migrated from ArgumentValueResolvedInterface to ValueResolverInterfaceInterface --- .../config/services/suggestions.yaml | 2 +- .../SuggestionQueryArgumentResolver.php | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) rename src/bundle/{ArgumentResolver => ValueResolver}/SuggestionQueryArgumentResolver.php (81%) diff --git a/src/bundle/Resources/config/services/suggestions.yaml b/src/bundle/Resources/config/services/suggestions.yaml index 8e05637..d470983 100644 --- a/src/bundle/Resources/config/services/suggestions.yaml +++ b/src/bundle/Resources/config/services/suggestions.yaml @@ -4,7 +4,7 @@ services: autowire: true public: false - Ibexa\Bundle\Search\ArgumentResolver\SuggestionQueryArgumentResolver: + Ibexa\Bundle\Search\ValueResolver\SuggestionQueryArgumentResolver: tags: - { name: 'controller.argument_value_resolver' } diff --git a/src/bundle/ArgumentResolver/SuggestionQueryArgumentResolver.php b/src/bundle/ValueResolver/SuggestionQueryArgumentResolver.php similarity index 81% rename from src/bundle/ArgumentResolver/SuggestionQueryArgumentResolver.php rename to src/bundle/ValueResolver/SuggestionQueryArgumentResolver.php index 002d09a..caf5d60 100644 --- a/src/bundle/ArgumentResolver/SuggestionQueryArgumentResolver.php +++ b/src/bundle/ValueResolver/SuggestionQueryArgumentResolver.php @@ -6,16 +6,16 @@ */ declare(strict_types=1); -namespace Ibexa\Bundle\Search\ArgumentResolver; +namespace Ibexa\Bundle\Search\ValueResolver; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Search\Model\SuggestionQuery; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; +use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -final class SuggestionQueryArgumentResolver implements ArgumentValueResolverInterface +final class SuggestionQueryArgumentResolver implements ValueResolverInterface { private ConfigResolverInterface $configResolver; @@ -24,11 +24,6 @@ public function __construct(ConfigResolverInterface $configResolver) $this->configResolver = $configResolver; } - public function supports(Request $request, ArgumentMetadata $argument): bool - { - return SuggestionQuery::class === $argument->getType(); - } - /** * @return iterable<\Ibexa\Search\Model\SuggestionQuery> * @@ -36,6 +31,10 @@ public function supports(Request $request, ArgumentMetadata $argument): bool */ public function resolve(Request $request, ArgumentMetadata $argument): iterable { + if (!$this->supports($argument)) { + return []; + } + $defaultLimit = $this->configResolver->getParameter('search.suggestion.result_limit'); $query = $request->query->get('query'); $limit = $request->query->getInt('limit', $defaultLimit); @@ -47,4 +46,9 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable yield new SuggestionQuery($query, $limit, $language); } + + private function supports(ArgumentMetadata $argument): bool + { + return SuggestionQuery::class === $argument->getType(); + } } From 03d537eea39fbb2bb2a6384964bbf0a48d656f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:09:56 +0100 Subject: [PATCH 16/19] [Rector] Enabled Symfony 6.3 and Symfony 6.4 rule sets --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index a81fa9b..da984b1 100644 --- a/rector.php +++ b/rector.php @@ -20,4 +20,6 @@ SymfonySetList::SYMFONY_60, SymfonySetList::SYMFONY_61, SymfonySetList::SYMFONY_62, + SymfonySetList::SYMFONY_63, + SymfonySetList::SYMFONY_64, ]); From b855404cc77210737ddd85aa22bdcca61e28d35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:11:54 +0100 Subject: [PATCH 17/19] [Rector] Enabled rector on CI --- .github/workflows/ci.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a0c734b..5005cad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,6 +36,31 @@ jobs: - name: Run PHPStan analysis run: composer run-script phpstan + rector: + name: Run rector + runs-on: "ubuntu-22.04" + strategy: + matrix: + php: + - '8.3' + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: 'pdo_sqlite, gd' + tools: cs2pr + + - uses: ramsey/composer-install@v3 + with: + dependency-versions: highest + + - name: Run rector + run: vendor/bin/rector process --dry-run --ansi + tests: name: Unit tests runs-on: "ubuntu-22.04" From 79e865603f09ef81c833a0610bddbc47f033c6e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Wed, 19 Feb 2025 08:12:19 +0100 Subject: [PATCH 18/19] Regenerated phpstan baseline --- phpstan-baseline.neon | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c2f9f9e..2a94c81 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -160,31 +160,6 @@ parameters: count: 1 path: src/bundle/Form/DataTransformer/UsersTransformer.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\DateIntervalType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/DateIntervalType.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/SearchType.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchType\\:\\:buildForm\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Form/Type/SearchType.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchUsersType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/SearchUsersType.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\UserType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Form/Type/UserType.php - - message: "#^Method Ibexa\\\\Contracts\\\\Search\\\\Mapper\\\\SearchHitToContentSuggestionMapperInterface\\:\\:map\\(\\) has parameter \\$searchHit with generic class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit but does not specify its types\\: T$#" count: 1 From 61b6d76d5c3fcfc70a5d012bca36d6e34b1fbd75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= <adam@wojs.pl> Date: Sun, 2 Mar 2025 09:29:08 +0100 Subject: [PATCH 19/19] Bump phpstan/phpstan to ^2.0 (#54) * [Composer] Bump phpstan/phpstan to ^2.0 * [PHPStan] Regenerated PHPStan baseline --- composer.json | 6 +- phpstan-baseline.neon | 321 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 269 insertions(+), 58 deletions(-) diff --git a/composer.json b/composer.json index 990afad..e7c1a82 100644 --- a/composer.json +++ b/composer.json @@ -42,9 +42,9 @@ "friendsofphp/php-cs-fixer": "^3.0", "ibexa/code-style": "^1.0", "ibexa/doctrine-schema": "~4.6.x-dev", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-phpunit": "^1.3", - "phpstan/phpstan-symfony": "^1.3", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-symfony": "^2.0", "matthiasnoback/symfony-dependency-injection-test": "^4.3" }, "scripts": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1158007..6b5f404 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,276 +1,487 @@ parameters: ignoreErrors: - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Search\\:\\:addSemanticConfig\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\DependencyInjection\\Configuration\\Parser\\Search\:\:addSemanticConfig\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/DependencyInjection/Configuration/Parser/Search.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Search\\:\\:mapConfig\\(\\) has parameter \\$scopeSettings with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\DependencyInjection\\Configuration\\Parser\\Search\:\:mapConfig\(\) has parameter \$scopeSettings with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/DependencyInjection/Configuration/Parser/Search.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\DependencyInjection\\\\IbexaSearchExtension\\:\\:load\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\DependencyInjection\\IbexaSearchExtension\:\:load\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/DependencyInjection/IbexaSearchExtension.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\ChoiceLoader\\\\ConfiguredLanguagesChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\ChoiceLoader\\ConfiguredLanguagesChoiceLoader\:\:getChoiceList\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/ChoiceLoader/ConfiguredLanguagesChoiceLoader.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\ChoiceLoader\\\\ContentTypeChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\ChoiceLoader\\ContentTypeChoiceLoader\:\:getChoiceList\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php - - message: "#^Parameter \\#1 \\$array of function usort expects TArray of array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\>, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\> given\\.$#" + message: '#^Parameter \#1 \$array of function usort expects TArray of array\<Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\>, iterable\<Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\> given\.$#' + identifier: argument.type count: 1 path: src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php - - message: "#^Parameter \\#1 \\$string1 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$string1 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php - - message: "#^Parameter \\#2 \\$string2 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#2 \$string2 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/bundle/Form/ChoiceLoader/ContentTypeChoiceLoader.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:__construct\\(\\) has parameter \\$contentTypes with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:__construct\(\) has parameter \$contentTypes with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:__construct\\(\\) has parameter \\$created with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:__construct\(\) has parameter \$created with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:__construct\\(\\) has parameter \\$lastModified with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:__construct\(\) has parameter \$lastModified with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:getContentTypes\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:getContentTypes\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:getCreated\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:getCreated\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:getLastModified\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:getLastModified\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:getSearchUsersData\\(\\) should return Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchUsersData\\|null but returns array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\User\\>\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:getSearchUsersData\(\) should return Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData\|null but returns array\<Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\>\.$#' + identifier: return.type count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:setContentTypes\\(\\) has parameter \\$contentTypes with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:setContentTypes\(\) has parameter \$contentTypes with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:setCreated\\(\\) has parameter \\$created with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:setCreated\(\) has parameter \$created with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:setLastModified\\(\\) has parameter \\$lastModified with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:setLastModified\(\) has parameter \$lastModified with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Property Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:\\$created type has no value type specified in iterable type array\\.$#" + message: '#^Property Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:\$created type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Property Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:\\$creator \\(Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\User\\) does not accept Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\User\\|null\\.$#" + message: '#^Property Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:\$creator \(Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\) does not accept Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\|null\.$#' + identifier: assign.propertyType count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Property Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:\\$lastModified type has no value type specified in iterable type array\\.$#" + message: '#^Property Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:\$lastModified type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchData.php - - message: "#^Property Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:\\$query \\(string\\) does not accept string\\|null\\.$#" + message: '#^Property Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:\$query \(string\) does not accept string\|null\.$#' + identifier: assign.propertyType count: 2 path: src/bundle/Form/Data/SearchData.php - - message: "#^Property Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:\\$searchUsersData \\(array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\User\\>\\) does not accept Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchUsersData\\|null\\.$#" + message: '#^Property Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:\$searchUsersData \(array\<Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\>\) does not accept Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData\|null\.$#' + identifier: assign.propertyType count: 2 path: src/bundle/Form/Data/SearchData.php - - message: "#^Property Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchData\\:\\:\\$section \\(Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Section\\) does not accept Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Section\\|null\\.$#" + message: '#^Property Ibexa\\Bundle\\Search\\Form\\Data\\SearchData\:\:\$section \(Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Section\) does not accept Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Section\|null\.$#' + identifier: assign.propertyType count: 2 path: src/bundle/Form/Data/SearchData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchUsersData\\:\\:__construct\\(\\) has parameter \\$possibleUsers with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData\:\:__construct\(\) has parameter \$possibleUsers with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchUsersData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchUsersData\\:\\:getPossibleUsers\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData\:\:getPossibleUsers\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchUsersData.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchUsersData\\:\\:setPossibleUsers\\(\\) has parameter \\$possibleUsers with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData\:\:setPossibleUsers\(\) has parameter \$possibleUsers with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Data/SearchUsersData.php - - message: "#^Property Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Data\\\\SearchUsersData\\:\\:\\$query \\(string\\) does not accept string\\|null\\.$#" + message: '#^Property Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData\:\:\$query \(string\) does not accept string\|null\.$#' + identifier: assign.propertyType count: 2 path: src/bundle/Form/Data/SearchUsersData.php - - message: "#^Class Ibexa\\\\Bundle\\\\Search\\\\Form\\\\DataTransformer\\\\DateIntervalTransformer implements generic interface Symfony\\\\Component\\\\Form\\\\DataTransformerInterface but does not specify its types\\: T, R$#" + message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType count: 1 path: src/bundle/Form/DataTransformer/DateIntervalTransformer.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\DataTransformer\\\\DateIntervalTransformer\\:\\:reverseTransform\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#" + message: '#^Class Ibexa\\Bundle\\Search\\Form\\DataTransformer\\DateIntervalTransformer implements generic interface Symfony\\Component\\Form\\DataTransformerInterface but does not specify its types\: T, R$#' + identifier: missingType.generics count: 1 path: src/bundle/Form/DataTransformer/DateIntervalTransformer.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\DataTransformer\\\\DateIntervalTransformer\\:\\:reverseTransform\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\DataTransformer\\DateIntervalTransformer\:\:reverseTransform\(\) has parameter \$value with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/DataTransformer/DateIntervalTransformer.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\DataTransformer\\\\DateIntervalTransformer\\:\\:transform\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\DataTransformer\\DateIntervalTransformer\:\:reverseTransform\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/DataTransformer/DateIntervalTransformer.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\DataTransformer\\\\DateIntervalTransformer\\:\\:transform\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\DataTransformer\\DateIntervalTransformer\:\:transform\(\) has Symfony\\Component\\Form\\Exception\\TransformationFailedException in PHPDoc @throws tag but it''s not thrown\.$#' + identifier: throws.unusedType count: 1 path: src/bundle/Form/DataTransformer/DateIntervalTransformer.php - - message: "#^Class Ibexa\\\\Bundle\\\\Search\\\\Form\\\\DataTransformer\\\\UserTransformer implements generic interface Symfony\\\\Component\\\\Form\\\\DataTransformerInterface but does not specify its types\\: T, R$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\DataTransformer\\DateIntervalTransformer\:\:transform\(\) has parameter \$value with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/bundle/Form/DataTransformer/DateIntervalTransformer.php + + - + message: '#^Method Ibexa\\Bundle\\Search\\Form\\DataTransformer\\DateIntervalTransformer\:\:transform\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/bundle/Form/DataTransformer/DateIntervalTransformer.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\DataTransformer\\UserTransformer implements generic interface Symfony\\Component\\Form\\DataTransformerInterface but does not specify its types\: T, R$#' + identifier: missingType.generics + count: 1 + path: src/bundle/Form/DataTransformer/UserTransformer.php + + - + message: '#^Instanceof between Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User and Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User will always evaluate to true\.$#' + identifier: instanceof.alwaysTrue count: 1 path: src/bundle/Form/DataTransformer/UserTransformer.php - - message: "#^Class Ibexa\\\\Bundle\\\\Search\\\\Form\\\\DataTransformer\\\\UsersTransformer implements generic interface Symfony\\\\Component\\\\Form\\\\DataTransformerInterface but does not specify its types\\: T, R$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\DataTransformer\\UserTransformer\:\:transform\(\) has Symfony\\Component\\Form\\Exception\\TransformationFailedException in PHPDoc @throws tag but it''s not thrown\.$#' + identifier: throws.unusedType + count: 1 + path: src/bundle/Form/DataTransformer/UserTransformer.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\DataTransformer\\UsersTransformer implements generic interface Symfony\\Component\\Form\\DataTransformerInterface but does not specify its types\: T, R$#' + identifier: missingType.generics count: 1 path: src/bundle/Form/DataTransformer/UsersTransformer.php - - message: "#^PHPDoc tag @return with type mixed is not subtype of native type string\\|null\\.$#" + message: '#^Instanceof between Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData and Ibexa\\Bundle\\Search\\Form\\Data\\SearchUsersData will always evaluate to true\.$#' + identifier: instanceof.alwaysTrue count: 1 path: src/bundle/Form/DataTransformer/UsersTransformer.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\ContentTypeChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" + message: '#^PHPDoc tag @return with type mixed is not subtype of native type string\|null\.$#' + identifier: return.phpDocType + count: 1 + path: src/bundle/Form/DataTransformer/UsersTransformer.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\ContentTypeChoiceType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/bundle/Form/Type/ContentTypeChoiceType.php + + - + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\ContentTypeChoiceType\:\:configureOptions\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/Form/Type/ContentTypeChoiceType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\DateIntervalType\\:\\:buildForm\\(\\) has no return type specified\\.$#" + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\DateIntervalType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/bundle/Form/Type/DateIntervalType.php + + - + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\DateIntervalType\:\:buildForm\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/Form/Type/DateIntervalType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchType\\:\\:buildForm\\(\\) has no return type specified\\.$#" + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\LanguageChoiceType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/bundle/Form/Type/LanguageChoiceType.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\SearchType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/bundle/Form/Type/SearchType.php + + - + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\SearchType\:\:buildForm\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/Form/Type/SearchType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchType\\:\\:buildForm\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\SearchType\:\:buildForm\(\) has parameter \$builder with generic interface Symfony\\Component\\Form\\FormBuilderInterface but does not specify its types\: TData$#' + identifier: missingType.generics count: 1 path: src/bundle/Form/Type/SearchType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\SearchType\:\:buildForm\(\) has parameter \$options with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/bundle/Form/Type/SearchType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchUsersType\\:\\:buildForm\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\SearchType\:\:configureOptions\(\) has no return type specified\.$#' + identifier: missingType.return + count: 1 + path: src/bundle/Form/Type/SearchType.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\SearchUsersType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics count: 1 path: src/bundle/Form/Type/SearchUsersType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SearchUsersType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\SearchUsersType\:\:buildForm\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/Form/Type/SearchUsersType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\SectionChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\SearchUsersType\:\:configureOptions\(\) has no return type specified\.$#' + identifier: missingType.return + count: 1 + path: src/bundle/Form/Type/SearchUsersType.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\SectionChoiceType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics count: 1 path: src/bundle/Form/Type/SectionChoiceType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\Form\\\\Type\\\\UserType\\:\\:buildForm\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\SectionChoiceType\:\:configureOptions\(\) has no return type specified\.$#' + identifier: missingType.return + count: 1 + path: src/bundle/Form/Type/SectionChoiceType.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\SortingDefinitionChoiceType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/bundle/Form/Type/SortingDefinitionChoiceType.php + + - + message: '#^Class Ibexa\\Bundle\\Search\\Form\\Type\\UserType extends generic class Symfony\\Component\\Form\\AbstractType but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/bundle/Form/Type/UserType.php + + - + message: '#^Method Ibexa\\Bundle\\Search\\Form\\Type\\UserType\:\:buildForm\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/Form/Type/UserType.php - - message: "#^Method Ibexa\\\\Bundle\\\\Search\\\\IbexaSearchBundle\\:\\:build\\(\\) has no return type specified\\.$#" + message: '#^Method Ibexa\\Bundle\\Search\\IbexaSearchBundle\:\:build\(\) has no return type specified\.$#' + identifier: missingType.return count: 1 path: src/bundle/IbexaSearchBundle.php - - message: "#^Cannot access offset int on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\>\\.$#" + message: '#^Cannot access offset int on iterable\<Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType\>\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/lib/Mapper/PagerSearchContentToDataMapper.php - - message: "#^Method Ibexa\\\\Search\\\\Mapper\\\\PagerSearchContentToDataMapper\\:\\:map\\(\\) has parameter \\$pager with generic class Pagerfanta\\\\Pagerfanta but does not specify its types\\: T$#" + message: '#^Method Ibexa\\Search\\Mapper\\PagerSearchContentToDataMapper\:\:map\(\) has parameter \$pager with generic class Pagerfanta\\Pagerfanta but does not specify its types\: T$#' + identifier: missingType.generics count: 1 path: src/lib/Mapper/PagerSearchContentToDataMapper.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Language\\> given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\<Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Language\> given\.$#' + identifier: argument.type count: 1 path: src/lib/Mapper/PagerSearchContentToDataMapper.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Search\\\\SearchHit\\:\\:\\$score \\(float\\) on left side of \\?\\? is not nullable\\.$#" + message: '#^Parameter &\$data by\-ref type of method Ibexa\\Search\\Mapper\\PagerSearchContentToDataMapper\:\:setTranslatedContentTypesNames\(\) expects array\<array\{content\: Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content, contentTypeId\: int, contentId\: int, name\: string, language\: string, contributor\: Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\|null, version\: int, content_type\: Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType, \.\.\.\}\>, non\-empty\-array\<array\{content\?\: Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content, contentTypeId\?\: int, contentId\: int, name\: string, language\: string, contributor\: Ibexa\\Contracts\\Core\\Repository\\Values\\User\\User\|null, version\: int, content_type\: Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\ContentType, \.\.\.\}\> given\.$#' + identifier: parameterByRef.type + count: 3 + path: src/lib/Mapper/PagerSearchContentToDataMapper.php + + - + message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Search\\SearchHit\:\:\$score \(float\) on left side of \?\? is not nullable\.$#' + identifier: nullCoalesce.property count: 1 path: src/lib/Mapper/SearchHitToContentSuggestionMapper.php - - message: "#^Method Ibexa\\\\Search\\\\QueryType\\\\SearchQueryType\\:\\:doGetQuery\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Search\\QueryType\\SearchQueryType\:\:doGetQuery\(\) has parameter \$parameters with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/lib/QueryType/SearchQueryType.php - - message: "#^Method Ibexa\\\\Search\\\\View\\\\SearchViewBuilder\\:\\:buildView\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Search\\Serializer\\Normalizer\\Suggestion\\ParentLocationCollectionNormalizer\:\:normalize\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/lib/Serializer/Normalizer/Suggestion/ParentLocationCollectionNormalizer.php + + - + message: '#^PHPDoc tag @return has invalid value \(array\<int,mixed\>\.\)\: Unexpected token "\.", expected TOKEN_HORIZONTAL_WS at offset 174 on line 5$#' + identifier: phpDoc.parseError + count: 1 + path: src/lib/Serializer/Normalizer/Suggestion/ParentLocationCollectionNormalizer.php + + - + message: '#^Method Ibexa\\Search\\Serializer\\Normalizer\\Suggestion\\SuggestionCollectionNormalizer\:\:normalize\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/lib/Serializer/Normalizer/Suggestion/SuggestionCollectionNormalizer.php + + - + message: '#^PHPDoc tag @return has invalid value \(array\<string,mixed\>\.\)\: Unexpected token "\.", expected TOKEN_HORIZONTAL_WS at offset 173 on line 5$#' + identifier: phpDoc.parseError + count: 1 + path: src/lib/Serializer/Normalizer/Suggestion/SuggestionCollectionNormalizer.php + + - + message: '#^Method Ibexa\\Search\\View\\SearchViewBuilder\:\:buildView\(\) has parameter \$parameters with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/lib/View/SearchViewBuilder.php - - message: "#^Method Ibexa\\\\Search\\\\View\\\\SearchViewBuilder\\:\\:getSearchLanguageFilter\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Method Ibexa\\Search\\View\\SearchViewBuilder\:\:getSearchLanguageFilter\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/lib/View/SearchViewBuilder.php - - message: "#^Method Ibexa\\\\Search\\\\View\\\\SearchViewProvider\\:\\:buildSearchListView\\(\\) has parameter \\$viewConfig with no value type specified in iterable type array\\.$#" + message: '#^PHPDoc tag @var for variable \$form contains generic interface Symfony\\Component\\Form\\FormInterface but does not specify its types\: TData$#' + identifier: missingType.generics + count: 1 + path: src/lib/View/SearchViewBuilder.php + + - + message: '#^Method Ibexa\\Search\\View\\SearchViewProvider\:\:buildSearchListView\(\) has parameter \$viewConfig with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 path: src/lib/View/SearchViewProvider.php - - message: "#^Method Ibexa\\\\Search\\\\View\\\\SearchViewProvider\\:\\:getView\\(\\) should return Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\View but returns null\\.$#" + message: '#^Method Ibexa\\Search\\View\\SearchViewProvider\:\:getView\(\) should return Ibexa\\Core\\MVC\\Symfony\\View\\View but returns null\.$#' + identifier: return.type count: 1 path: src/lib/View/SearchViewProvider.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Ibexa\\\\Contracts\\\\Core\\\\Collection\\\\MutableArrayList'' and Ibexa\\Contracts\\Search\\Model\\Suggestion\\ParentLocationCollection will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/contracts/Model/Suggestion/ParentCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Ibexa\\\\Contracts\\\\Search\\\\Model\\\\Suggestion\\\\ParentLocationCollection'' and Ibexa\\Contracts\\Search\\Model\\Suggestion\\ParentLocationCollection will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/contracts/Model/Suggestion/ParentCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Ibexa\\\\Contracts\\\\Core\\\\Collection\\\\MutableArrayList'' and Ibexa\\Contracts\\Search\\Model\\Suggestion\\SuggestionCollection will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/contracts/Model/Suggestion/SuggestionCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Ibexa\\\\Contracts\\\\Search\\\\Model\\\\Suggestion\\\\SuggestionCollection'' and Ibexa\\Contracts\\Search\\Model\\Suggestion\\SuggestionCollection will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/contracts/Model/Suggestion/SuggestionCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Ibexa\\\\Contracts\\\\Search\\\\Model\\\\Suggestion\\\\Suggestion'' and Ibexa\\Contracts\\Search\\Model\\Suggestion\\Suggestion will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/contracts/Model/Suggestion/SuggestionTest.php + + - + message: '#^PHPDoc tag @var has invalid value \(\\Symfony\\Contracts\\Translation\\TranslatorInterface&\\PHPUnit\\Framework\\MockObject\\MockObject\)\)\: Unexpected token "\)", expected TOKEN_HORIZONTAL_WS at offset 100 on line 1$#' + identifier: phpDoc.parseError + count: 1 + path: tests/lib/SortingDefinition/Provider/RelevanceSortingDefinitionProviderTest.php