diff --git a/composer.json b/composer.json index 4ba1ecb..bedc2bb 100644 --- a/composer.json +++ b/composer.json @@ -9,19 +9,19 @@ "require": { "php": ">=8.3", "ext-json": "*", - "ibexa/admin-ui": "~5.0.x-dev", - "ibexa/content-forms": "~5.0.x-dev", - "ibexa/core": "~5.0.x-dev", - "ibexa/graphql": "~5.0.x-dev", - "ibexa/rest": "~5.0.x-dev", + "ibexa/admin-ui": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/content-forms": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/core": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/graphql": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/rest": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "psr/log": "^1.1", - "symfony/dependency-injection": "^5.0", - "symfony/event-dispatcher": "^5.0", - "symfony/expression-language": "^5.0", - "symfony/framework-bundle": "^5.0", - "symfony/http-kernel": "^5.0", - "symfony/translation": "^5.0", - "symfony/yaml": "^5.0" + "symfony/dependency-injection": "^6.4", + "symfony/event-dispatcher": "^6.4", + "symfony/expression-language": "^6.4", + "symfony/framework-bundle": "^6.4", + "symfony/http-kernel": "^6.4", + "symfony/translation": "^6.4", + "symfony/yaml": "^6.4" }, "autoload": { "psr-4": { @@ -38,14 +38,14 @@ }, "require-dev": { "ibexa/code-style": "~2.0.0", - "ibexa/design-engine": "~5.0.x-dev", - "ibexa/doctrine-schema": "~5.0.x-dev", - "ibexa/fieldtype-richtext": "~5.0.x-dev", - "ibexa/http-cache": "~5.0.x-dev", - "ibexa/notifications": "~5.0.x-dev", + "ibexa/design-engine": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/doctrine-schema": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/fieldtype-richtext": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/http-cache": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/notifications": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "ibexa/phpstan": "~5.0.0@dev", - "ibexa/search": "~5.0.x-dev", - "ibexa/user": "~5.0.x-dev", + "ibexa/search": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/user": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "phpspec/phpspec": "^7.1", "phpstan/phpstan": "^2.0", "phpstan/phpstan-phpunit": "^2.0", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e068e8f..ce28a88 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -90,12 +90,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/QueryConverter.php - - - message: '#^Anonymous function should return Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Content but returns Ibexa\\Contracts\\Core\\Repository\\Values\\ValueObject\.$#' - identifier: return.type - count: 1 - path: src/lib/QueryFieldService.php - - message: '#^Method Ibexa\\FieldTypeQuery\\QueryFieldService\:\:isExpression\(\) has parameter \$expression with no type specified\.$#' identifier: missingType.parameter diff --git a/src/bundle/Resources/config/graphql/types/QueryFieldType.types.yaml b/src/bundle/Resources/config/graphql/types/QueryFieldType.types.yaml index 16a51fa..69a3e87 100644 --- a/src/bundle/Resources/config/graphql/types/QueryFieldType.types.yaml +++ b/src/bundle/Resources/config/graphql/types/QueryFieldType.types.yaml @@ -18,7 +18,7 @@ ContentQueryFieldSettings: parameters: type: "[ContentQueryFieldParameter]" description: "Parameters used to generate the Query from the Query type" - resolve: "@=resolver('QueryFieldDefinitionParameters', [value['Parameters']])" + resolve: "@=query('QueryFieldDefinitionParameters', [value['Parameters']])" returnedType: type: ContentType description: "Content type returned by the field" diff --git a/src/lib/ContentView/QueryResultsPagerFantaAdapter.php b/src/lib/ContentView/QueryResultsPagerFantaAdapter.php index c167b0b..09fe825 100644 --- a/src/lib/ContentView/QueryResultsPagerFantaAdapter.php +++ b/src/lib/ContentView/QueryResultsPagerFantaAdapter.php @@ -11,6 +11,9 @@ use Ibexa\Contracts\FieldTypeQuery\QueryFieldServiceInterface; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Content\Content> + */ final class QueryResultsPagerFantaAdapter implements AdapterInterface { /** @var \Ibexa\Contracts\FieldTypeQuery\QueryFieldServiceInterface */ @@ -32,15 +35,15 @@ public function __construct( $this->fieldDefinitionIdentifier = $fieldDefinitionIdentifier; } - public function getNbResults() + public function getNbResults(): int { - return $this->queryFieldService->countContentItems( + return max($this->queryFieldService->countContentItems( $this->content, $this->fieldDefinitionIdentifier - ); + ), 0); } - public function getSlice($offset, $length) + public function getSlice($offset, $length): iterable { return $this->queryFieldService->loadContentItemsSlice( $this->content, diff --git a/src/lib/ContentView/QueryResultsWithLocationPagerFantaAdapter.php b/src/lib/ContentView/QueryResultsWithLocationPagerFantaAdapter.php index ad2dd5f..ad0ff48 100644 --- a/src/lib/ContentView/QueryResultsWithLocationPagerFantaAdapter.php +++ b/src/lib/ContentView/QueryResultsWithLocationPagerFantaAdapter.php @@ -11,6 +11,9 @@ use Ibexa\Contracts\FieldTypeQuery\QueryFieldLocationService; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Content\Content> + */ final class QueryResultsWithLocationPagerFantaAdapter implements AdapterInterface { /** @var \Ibexa\Contracts\FieldTypeQuery\QueryFieldLocationService */ @@ -32,15 +35,15 @@ public function __construct( $this->fieldDefinitionIdentifier = $fieldDefinitionIdentifier; } - public function getNbResults() + public function getNbResults(): int { - return $this->queryFieldService->countContentItemsForLocation( + return max($this->queryFieldService->countContentItemsForLocation( $this->location, $this->fieldDefinitionIdentifier - ); + ), 0); } - public function getSlice($offset, $length) + public function getSlice($offset, $length): iterable { return $this->queryFieldService->loadContentItemsSliceForLocation( $this->location, diff --git a/src/lib/GraphQL/QueryFieldResolver.php b/src/lib/GraphQL/QueryFieldResolver.php index 35836cd..39b96cb 100644 --- a/src/lib/GraphQL/QueryFieldResolver.php +++ b/src/lib/GraphQL/QueryFieldResolver.php @@ -32,7 +32,7 @@ public function resolveQueryField(Field $field, Content $content): iterable } /** - * @return \GraphQL\Executor\Promise\Promise|\Overblog\GraphQLBundle\Relay\Connection\Output\Connection|null + * @return \GraphQL\Executor\Promise\Promise|\Overblog\GraphQLBundle\Relay\Connection\Output\Connection<\Ibexa\Contracts\Core\Repository\Values\Content\Content>|null */ public function resolveQueryFieldConnection(Argument $args, ?Field $field, Content $content) {