From 2fa9b29dbc085788ad4807581f7d5bc1cd3ffa50 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Fri, 15 Nov 2024 15:57:44 +0100 Subject: [PATCH 1/6] Bumped Symfony packages requirements to ^6.4 --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 75e9799..9ccf324 100644 --- a/composer.json +++ b/composer.json @@ -8,13 +8,13 @@ "require": { "php": ">=8.3", "ibexa/core": "~5.0.x-dev", - "symfony/config": "^5.4", - "symfony/dependency-injection": "^5.4", - "symfony/event-dispatcher": "^5.4", + "symfony/config": "^6.4", + "symfony/dependency-injection": "^6.4", + "symfony/event-dispatcher": "^6.4", "symfony/event-dispatcher-contracts": "^2.2", - "symfony/http-foundation": "^5.4", - "symfony/http-kernel": "^5.4", - "symfony/yaml": "^5.4" + "symfony/http-foundation": "^6.4", + "symfony/http-kernel": "^6.4", + "symfony/yaml": "^6.4" }, "require-dev": { "ibexa/behat": "~5.0.x-dev", From a13886e6e860bfdef0048545e07b2e6b16f913c0 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Fri, 15 Nov 2024 15:59:50 +0100 Subject: [PATCH 2/6] [TMP] Added Symfony 6 Ibexa dev branches requirements --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 9ccf324..5bed5b5 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ ], "require": { "php": ">=8.3", - "ibexa/core": "~5.0.x-dev", + "ibexa/core": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "symfony/config": "^6.4", "symfony/dependency-injection": "^6.4", "symfony/event-dispatcher": "^6.4", @@ -17,9 +17,9 @@ "symfony/yaml": "^6.4" }, "require-dev": { - "ibexa/behat": "~5.0.x-dev", + "ibexa/behat": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "ibexa/code-style": "~2.0.0", - "ibexa/doctrine-schema": "~5.0.x-dev", + "ibexa/doctrine-schema": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-symfony": "^1.3", From 766070f2f22d14af3e387db9f68d94491d33a713 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Tue, 19 Nov 2024 13:38:27 +0100 Subject: [PATCH 3/6] [Composer] Disallowed plugins --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5bed5b5..9ddbbf2 100644 --- a/composer.json +++ b/composer.json @@ -60,6 +60,7 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": false } } From ab96038a76a3f100a4751561f7aac4ea8c24333e Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Tue, 19 Nov 2024 13:45:57 +0100 Subject: [PATCH 4/6] [PHPDoc] Added missing throws to IbexaCoreSearchExtension::load method --- src/bundle/DependencyInjection/IbexaCoreSearchExtension.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bundle/DependencyInjection/IbexaCoreSearchExtension.php b/src/bundle/DependencyInjection/IbexaCoreSearchExtension.php index b604ef7..ae843e7 100644 --- a/src/bundle/DependencyInjection/IbexaCoreSearchExtension.php +++ b/src/bundle/DependencyInjection/IbexaCoreSearchExtension.php @@ -20,6 +20,8 @@ final class IbexaCoreSearchExtension extends Extension implements PrependExtensi { /** * @param array $configs + * + * @throws \Exception */ public function load(array $configs, ContainerBuilder $container): void { From 80a3c54cfaa46c334617455dd6fa7f84d1f90e50 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Tue, 19 Nov 2024 13:47:18 +0100 Subject: [PATCH 5/6] Added strict types to the contracts --- .../AbstractFieldCriterionMapper.php | 5 +-- .../Values/Query/AbstractCriterionQuery.php | 2 +- .../Values/Query/AbstractSortClause.php | 4 +- .../Query/Criterion/FieldValueCriterion.php | 37 ++++++++----------- src/contracts/Values/Query/SortDirection.php | 4 +- 5 files changed, 21 insertions(+), 31 deletions(-) diff --git a/src/contracts/Persistence/CriterionMapper/AbstractFieldCriterionMapper.php b/src/contracts/Persistence/CriterionMapper/AbstractFieldCriterionMapper.php index b720e7e..be51286 100644 --- a/src/contracts/Persistence/CriterionMapper/AbstractFieldCriterionMapper.php +++ b/src/contracts/Persistence/CriterionMapper/AbstractFieldCriterionMapper.php @@ -79,10 +79,7 @@ protected function getComparisonOperator(FieldValueCriterion $criterion): string )); } - /** - * @return mixed - */ - protected function getComparisonValue(FieldValueCriterion $criterion) + protected function getComparisonValue(FieldValueCriterion $criterion): mixed { return $criterion->getValue(); } diff --git a/src/contracts/Values/Query/AbstractCriterionQuery.php b/src/contracts/Values/Query/AbstractCriterionQuery.php index 34c24dc..7e3d934 100644 --- a/src/contracts/Values/Query/AbstractCriterionQuery.php +++ b/src/contracts/Values/Query/AbstractCriterionQuery.php @@ -16,7 +16,7 @@ */ abstract class AbstractCriterionQuery { - public const DEFAULT_LIMIT = 25; + public const int DEFAULT_LIMIT = 25; /** @var TCriterion|null */ private ?CriterionInterface $query; diff --git a/src/contracts/Values/Query/AbstractSortClause.php b/src/contracts/Values/Query/AbstractSortClause.php index 2728e93..b80a628 100644 --- a/src/contracts/Values/Query/AbstractSortClause.php +++ b/src/contracts/Values/Query/AbstractSortClause.php @@ -13,10 +13,10 @@ abstract class AbstractSortClause { /** @final */ - public const SORT_ASC = SortDirection::ASC; + public const string SORT_ASC = SortDirection::ASC; /** @final */ - public const SORT_DESC = SortDirection::DESC; + public const string SORT_DESC = SortDirection::DESC; /** * Sort direction. diff --git a/src/contracts/Values/Query/Criterion/FieldValueCriterion.php b/src/contracts/Values/Query/Criterion/FieldValueCriterion.php index 54cdafa..c5ed860 100644 --- a/src/contracts/Values/Query/Criterion/FieldValueCriterion.php +++ b/src/contracts/Values/Query/Criterion/FieldValueCriterion.php @@ -11,34 +11,33 @@ class FieldValueCriterion implements CriterionInterface { /** @final */ - public const COMPARISON_EQ = '='; + public const string COMPARISON_EQ = '='; /** @final */ - public const COMPARISON_NEQ = '<>'; + public const string COMPARISON_NEQ = '<>'; /** @final */ - public const COMPARISON_LT = '<'; + public const string COMPARISON_LT = '<'; /** @final */ - public const COMPARISON_LTE = '<='; + public const string COMPARISON_LTE = '<='; /** @final */ - public const COMPARISON_GT = '>'; + public const string COMPARISON_GT = '>'; /** @final */ - public const COMPARISON_GTE = '>='; + public const string COMPARISON_GTE = '>='; /** @final */ - public const COMPARISON_IN = 'IN'; + public const string COMPARISON_IN = 'IN'; /** @final */ - public const COMPARISON_NIN = 'NIN'; + public const string COMPARISON_NIN = 'NIN'; /** @final */ - public const COMPARISON_CONTAINS = 'CONTAINS'; + public const string COMPARISON_CONTAINS = 'CONTAINS'; /** @final */ - public const COMPARISON_MEMBER_OF = 'MEMBER_OF'; + public const string COMPARISON_MEMBER_OF = 'MEMBER_OF'; /** @final */ - public const COMPARISON_STARTS_WITH = 'STARTS_WITH'; + public const string COMPARISON_STARTS_WITH = 'STARTS_WITH'; /** @final */ - public const COMPARISON_ENDS_WITH = 'ENDS_WITH'; + public const string COMPARISON_ENDS_WITH = 'ENDS_WITH'; private string $field; - /** @var mixed */ - private $value; + private mixed $value; private string $operator; @@ -57,18 +56,12 @@ public function getField(): string return $this->field; } - /** - * @param mixed $value - */ - public function setValue($value): void + public function setValue(mixed $value): void { $this->value = $value; } - /** - * @return mixed - */ - public function getValue() + public function getValue(): mixed { return $this->value; } diff --git a/src/contracts/Values/Query/SortDirection.php b/src/contracts/Values/Query/SortDirection.php index 20eb5bc..67dcb35 100644 --- a/src/contracts/Values/Query/SortDirection.php +++ b/src/contracts/Values/Query/SortDirection.php @@ -13,8 +13,8 @@ */ class SortDirection { - public const ASC = 'ascending'; - public const DESC = 'descending'; + public const string ASC = 'ascending'; + public const string DESC = 'descending'; /** * @phpstan-assert-if-true self::ASC|self::DESC $value From 6cd933c721154c73d387b8cd82f661128e166e56 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Tue, 19 Nov 2024 13:47:48 +0100 Subject: [PATCH 6/6] [PHPDoc] Fixed PHPStan type-hints --- .../Values/Query/AbstractCriterionQuery.php | 14 +++++++------- .../Values/Query/CriterionMapperInterface.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/contracts/Values/Query/AbstractCriterionQuery.php b/src/contracts/Values/Query/AbstractCriterionQuery.php index 7e3d934..46b3028 100644 --- a/src/contracts/Values/Query/AbstractCriterionQuery.php +++ b/src/contracts/Values/Query/AbstractCriterionQuery.php @@ -18,10 +18,10 @@ abstract class AbstractCriterionQuery { public const int DEFAULT_LIMIT = 25; - /** @var TCriterion|null */ + /** @phpstan-var TCriterion|null */ private ?CriterionInterface $query; - /** @var TSortClause[] */ + /** @phpstan-var TSortClause[] */ private array $sortClauses; private ?int $limit; @@ -29,8 +29,8 @@ abstract class AbstractCriterionQuery private int $offset; /** - * @param TSortClause[]|null $sortClauses - * @param TCriterion|null $query + * @phpstan-param TSortClause[]|null $sortClauses + * @phpstan-param TCriterion|null $query */ public function __construct( ?CriterionInterface $query = null, @@ -45,7 +45,7 @@ public function __construct( } /** - * @param TCriterion|null $criterion + * @phpstan-param TCriterion|null $criterion */ final public function setQuery(?CriterionInterface $criterion): void { @@ -53,7 +53,7 @@ final public function setQuery(?CriterionInterface $criterion): void } /** - * @return TCriterion|null + * @phpstan-return TCriterion|null */ final public function getQuery(): ?CriterionInterface { @@ -86,7 +86,7 @@ final public function setLimit(?int $limit): void } /** - * @return TSortClause[] + * @phpstan-return TSortClause[] */ final public function getSortClauses(): array { diff --git a/src/contracts/Values/Query/CriterionMapperInterface.php b/src/contracts/Values/Query/CriterionMapperInterface.php index e828956..bea6c76 100644 --- a/src/contracts/Values/Query/CriterionMapperInterface.php +++ b/src/contracts/Values/Query/CriterionMapperInterface.php @@ -19,7 +19,7 @@ interface CriterionMapperInterface public function canHandle(CriterionInterface $criterion): bool; /** - * @param C $criterion + * @phpstan-param C $criterion */ public function handle(CriterionInterface $criterion, CriterionMapper $mapper): Expression; }