From 05713bfc8ca4e749d408aaf870a4880e6c8fa74f Mon Sep 17 00:00:00 2001 From: Vincent <407859+vincentchalamon@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:12:46 +0100 Subject: [PATCH 1/6] fix(hydra): move owl:maxCardinality from JsonSchema to Hydra (#6136) --- features/openapi/docs.feature | 3 --- .../Serializer/DocumentationNormalizer.php | 21 +++++++++++++++++++ .../Factory/SchemaPropertyMetadataFactory.php | 8 ------- .../Serializer/LegacyOpenApiNormalizer.php | 1 - .../Command/JsonSchemaGenerateCommandTest.php | 1 - 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/features/openapi/docs.feature b/features/openapi/docs.feature index 9fcae506c6c..1aa379c71b8 100644 --- a/features/openapi/docs.feature +++ b/features/openapi/docs.feature @@ -98,7 +98,6 @@ Feature: Documentation support And the "playMode" property for the OpenAPI class "VideoGame" should be equal to: """ { - "owl:maxCardinality": 1, "type": "string", "format": "iri-reference", "example": "https://example.com/" @@ -310,7 +309,6 @@ Feature: Documentation support And the "resourceRelated" property for the OpenAPI class "Resource" should be equal to: """ { - "owl:maxCardinality": 1, "readOnly": true, "anyOf": [ { @@ -389,7 +387,6 @@ Feature: Documentation support And the "data" property for the OpenAPI class "WrappedResponseEntity.CustomOutputEntityWrapperDto-read" should be equal to: """ { - "owl:maxCardinality": 1, "$ref": "#\/components\/schemas\/WrappedResponseEntity-read" } """ diff --git a/src/Hydra/Serializer/DocumentationNormalizer.php b/src/Hydra/Serializer/DocumentationNormalizer.php index a940a4c4411..f9e0c84f69c 100644 --- a/src/Hydra/Serializer/DocumentationNormalizer.php +++ b/src/Hydra/Serializer/DocumentationNormalizer.php @@ -386,6 +386,23 @@ private function getRange(ApiProperty $propertyMetadata): array|string|null return 1 === \count($types) ? $types[0] : $types; } + private function isSingleRelation(ApiProperty $propertyMetadata): bool + { + $builtInTypes = $propertyMetadata->getBuiltinTypes() ?? []; + + foreach ($builtInTypes as $type) { + $className = $type->getClassName(); + if (!$type->isCollection() + && null !== $className + && $this->resourceClassResolver->isResourceClass($className) + ) { + return true; + } + } + + return false; + } + /** * Builds the classes array. */ @@ -509,6 +526,10 @@ private function getProperty(ApiProperty $propertyMetadata, string $propertyName $property['owl:deprecated'] = true; } + if ($this->isSingleRelation($propertyMetadata)) { + $property['owl:maxCardinality'] = true; + } + return $property; } diff --git a/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php b/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php index f906f25ea3d..f2713a51866 100644 --- a/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php +++ b/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php @@ -125,14 +125,6 @@ public function create(string $resourceClass, string $property, array $options = $className = $valueType->getClassName(); } - if (!\array_key_exists('owl:maxCardinality', $propertySchema) - && !$isCollection - && null !== $className - && $this->resourceClassResolver->isResourceClass($className) - ) { - $propertySchema['owl:maxCardinality'] = 1; - } - if ($isCollection && null !== $propertyMetadata->getUriTemplate()) { $keyType = null; $isCollection = false; diff --git a/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php b/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php index a7d7381fc12..16a6b730e0e 100644 --- a/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php +++ b/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php @@ -45,7 +45,6 @@ public function normalize(mixed $object, string $format = null, array $context = } unset($schemas[$name]['properties'][$property]['type']); } - unset($schemas[$name]['properties'][$property]['owl:maxCardinality']); } } diff --git a/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php b/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php index 27475fe839e..8800fd5265e 100644 --- a/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php +++ b/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php @@ -120,7 +120,6 @@ public function testArraySchemaWithReference(): void ]); $this->assertEquals($json['definitions']['BagOfTests.jsonld-write']['properties']['type'], [ - 'owl:maxCardinality' => 1, '$ref' => '#/definitions/TestEntity.jsonld-write', ]); } From 5db89532932dcb01ca9ea1340baa53d2b7afdef2 Mon Sep 17 00:00:00 2001 From: soyuka Date: Thu, 1 Feb 2024 15:09:41 +0100 Subject: [PATCH 2/6] docs: changelog v3.2.13 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d593b37d7..fe01ac3f447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v3.2.13 + +### Bug fixes + +* [05713bfc8](https://github.com/api-platform/core/commit/05713bfc8ca4e749d408aaf870a4880e6c8fa74f) fix(hydra): move owl:maxCardinality from JsonSchema to Hydra (#6136) + ## v3.2.12 ### Bug fixes From 165da11f63e3ee23b91ac29e0ff6d5640ab32d1e Mon Sep 17 00:00:00 2001 From: soyuka Date: Thu, 1 Feb 2024 15:22:51 +0100 Subject: [PATCH 3/6] cs: missing strict type --- tests/Fixtures/app/console | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Fixtures/app/console b/tests/Fixtures/app/console index 87b2f431e63..a0f96bec8e7 100755 --- a/tests/Fixtures/app/console +++ b/tests/Fixtures/app/console @@ -10,6 +10,8 @@ * file that was distributed with this source code. */ +declare(strict_types=1); + use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\ErrorHandler\Debug; From 3b42bafcccd2b530ca7bb920c7a3b9dc249d76ec Mon Sep 17 00:00:00 2001 From: soyuka Date: Thu, 1 Feb 2024 15:41:52 +0100 Subject: [PATCH 4/6] docs: guide sf/apip version --- docs/composer.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/composer.json b/docs/composer.json index 8321efc7f30..9a376542c2d 100644 --- a/docs/composer.json +++ b/docs/composer.json @@ -15,25 +15,25 @@ } ], "require": { - "api-platform/core": "dev-main", - "symfony/expression-language": "6.2.*", + "api-platform/core": "^3.2", + "symfony/expression-language": "^6.4 || ^7.0", "nelmio/cors-bundle": "^2.2", "phpstan/phpdoc-parser": "^1.15", - "symfony/framework-bundle": "6.2.*", - "symfony/property-access": "6.2.*", - "symfony/property-info": "6.2.*", - "symfony/runtime": "6.2.*", - "symfony/security-bundle": "6.2.*", - "symfony/serializer": "6.2.*", - "symfony/validator": "6.2.*", - "symfony/yaml": "^6.2", + "symfony/framework-bundle": "^6.4 || ^7.0", + "symfony/property-access": "^6.4 || ^7.0", + "symfony/property-info": "^6.4 || ^7.0", + "symfony/runtime": "^6.4 || ^7.0", + "symfony/security-bundle": "^6.4 || ^7.0", + "symfony/serializer": "^6.4 || ^7.0", + "symfony/validator": "^6.4 || ^7.0", + "symfony/yaml": "^6.4 || ^7.0", "doctrine/orm": "^2.14", "doctrine/doctrine-migrations-bundle": "^3.2", "doctrine/doctrine-bundle": "^2.9", "doctrine/doctrine-fixtures-bundle": "^3.4", "zenstruck/foundry": "^1.31", - "symfony/http-client": "^6.2", - "symfony/browser-kit": "^6.2", + "symfony/http-client": "^6.4 || ^7.0", + "symfony/browser-kit": "^6.4 || ^7.0", "justinrainbow/json-schema": "^5.2" }, "config": { From 071036170c2562e752218629b4c110b0581eb8dd Mon Sep 17 00:00:00 2001 From: soyuka Date: Fri, 19 Jan 2024 20:11:14 +0100 Subject: [PATCH 5/6] test: security configuration --- docs/config/packages/security.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/config/packages/security.yaml diff --git a/docs/config/packages/security.yaml b/docs/config/packages/security.yaml new file mode 100644 index 00000000000..cf6a090e8f2 --- /dev/null +++ b/docs/config/packages/security.yaml @@ -0,0 +1,13 @@ +security: + password_hashers: + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' + providers: + users_in_memory: { memory: null } + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + main: + lazy: true + provider: users_in_memory + access_control: From 86be7dffc121c29aa964ce1b56e78a0b19dfcaa0 Mon Sep 17 00:00:00 2001 From: Vincent <407859+vincentchalamon@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:45:18 +0100 Subject: [PATCH 6/6] chore: fix CI (#6143) * chore: fix wrong namespace in test document * chore: fix CS nullable_type_declaration_for_default_null_value * chore: update GitHub Actions versions --- .github/workflows/ci.yml | 102 +++++++-------- .github/workflows/guides.yaml | 4 +- .github/workflows/subtree.yml | 2 +- docs/src/Kernel.php | 4 +- src/Action/EntrypointAction.php | 2 +- src/Action/ExceptionAction.php | 2 +- src/Api/FilterLocatorTrait.php | 2 +- src/Api/IdentifiersExtractor.php | 6 +- src/Api/IdentifiersExtractorInterface.php | 2 +- src/Api/IriConverterInterface.php | 4 +- src/Api/ResourceClassResolver.php | 2 +- src/Api/ResourceClassResolverInterface.php | 2 +- .../Common/Filter/NumericFilterTrait.php | 2 +- .../Common/Filter/SearchFilterTrait.php | 4 +- .../Common/State/LinksHandlerTrait.php | 4 +- .../Fixtures/TestBundle/Entity/Dummy.php | 4 +- .../TestBundle/Entity/RelatedDummy.php | 2 +- .../Fixtures/TestBundle/Entity/ThirdLevel.php | 2 +- .../PublishMercureUpdatesListener.php | 2 +- .../EventListener/PurgeHttpCacheListener.php | 2 +- ...ggregationCollectionExtensionInterface.php | 2 +- .../AggregationItemExtensionInterface.php | 2 +- ...tionResultCollectionExtensionInterface.php | 4 +- ...ggregationResultItemExtensionInterface.php | 4 +- .../Odm/Extension/FilterExtension.php | 2 +- src/Doctrine/Odm/Extension/OrderExtension.php | 2 +- .../Odm/Extension/PaginationExtension.php | 6 +- src/Doctrine/Odm/Filter/AbstractFilter.php | 6 +- src/Doctrine/Odm/Filter/BooleanFilter.php | 2 +- src/Doctrine/Odm/Filter/DateFilter.php | 4 +- src/Doctrine/Odm/Filter/ExistsFilter.php | 6 +- src/Doctrine/Odm/Filter/FilterInterface.php | 2 +- src/Doctrine/Odm/Filter/NumericFilter.php | 4 +- src/Doctrine/Odm/Filter/OrderFilter.php | 6 +- src/Doctrine/Odm/Filter/RangeFilter.php | 2 +- src/Doctrine/Odm/Filter/SearchFilter.php | 4 +- src/Doctrine/Odm/State/CollectionProvider.php | 2 +- src/Doctrine/Odm/State/ItemProvider.php | 2 +- src/Doctrine/Odm/State/LinksHandlerTrait.php | 4 +- .../Orm/Extension/EagerLoadingExtension.php | 6 +- .../Extension/FilterEagerLoadingExtension.php | 2 +- .../Orm/Extension/FilterExtension.php | 2 +- src/Doctrine/Orm/Extension/OrderExtension.php | 2 +- .../Orm/Extension/PaginationExtension.php | 10 +- .../QueryCollectionExtensionInterface.php | 2 +- .../Extension/QueryItemExtensionInterface.php | 2 +- ...ueryResultCollectionExtensionInterface.php | 4 +- .../QueryResultItemExtensionInterface.php | 4 +- src/Doctrine/Orm/Filter/AbstractFilter.php | 6 +- src/Doctrine/Orm/Filter/BooleanFilter.php | 2 +- src/Doctrine/Orm/Filter/DateFilter.php | 4 +- src/Doctrine/Orm/Filter/ExistsFilter.php | 6 +- src/Doctrine/Orm/Filter/FilterInterface.php | 2 +- src/Doctrine/Orm/Filter/NumericFilter.php | 4 +- src/Doctrine/Orm/Filter/OrderFilter.php | 6 +- src/Doctrine/Orm/Filter/RangeFilter.php | 2 +- src/Doctrine/Orm/Filter/SearchFilter.php | 4 +- src/Doctrine/Orm/State/CollectionProvider.php | 2 +- src/Doctrine/Orm/State/ItemProvider.php | 2 +- src/Doctrine/Orm/Util/QueryBuilderHelper.php | 4 +- .../Action/DocumentationAction.php | 4 +- .../Extension/AbstractFilterExtension.php | 2 +- ...BodySearchCollectionExtensionInterface.php | 2 +- src/Elasticsearch/Extension/SortExtension.php | 2 +- .../Filter/AbstractSearchFilter.php | 6 +- src/Elasticsearch/Filter/FilterInterface.php | 2 +- src/Elasticsearch/Filter/OrderFilter.php | 4 +- .../Serializer/DocumentNormalizer.php | 18 +-- .../Serializer/ItemNormalizer.php | 8 +- .../InnerFieldsNameConverter.php | 6 +- .../Tests/Serializer/ItemNormalizerTest.php | 4 +- src/Exception/FilterValidationException.php | 2 +- src/GraphQl/Action/EntrypointAction.php | 2 +- src/GraphQl/Executor.php | 2 +- src/GraphQl/ExecutorInterface.php | 2 +- .../Factory/CollectionResolverFactory.php | 2 +- .../Factory/ItemMutationResolverFactory.php | 2 +- .../Resolver/Factory/ItemResolverFactory.php | 2 +- .../ItemSubscriptionResolverFactory.php | 2 +- .../Resolver/Factory/ResolverFactory.php | 2 +- .../Factory/ResolverFactoryInterface.php | 2 +- .../Serializer/Exception/ErrorNormalizer.php | 4 +- .../Exception/HttpExceptionNormalizer.php | 4 +- .../Exception/RuntimeExceptionNormalizer.php | 4 +- .../ValidationExceptionNormalizer.php | 4 +- src/GraphQl/Serializer/ItemNormalizer.php | 8 +- src/GraphQl/Serializer/ObjectNormalizer.php | 4 +- .../MercureSubscriptionIriGenerator.php | 2 +- ...rcureSubscriptionIriGeneratorInterface.php | 2 +- ...ationAwareSubscriptionManagerInterface.php | 2 +- .../Subscription/SubscriptionManager.php | 2 +- .../Tests/Fixtures/ApiResource/Dummy.php | 4 +- .../Fixtures/Type/Definition/DateTimeType.php | 2 +- .../Resolver/Factory/ResolverFactoryTest.php | 2 +- .../Tests/Resolver/Stage/ReadStageTest.php | 2 +- .../Resolver/Stage/SerializeStageTest.php | 2 +- .../SerializerContextBuilderTest.php | 6 +- .../Processor/NormalizeProcessorTest.php | 2 +- src/GraphQl/Tests/Type/FieldsBuilderTest.php | 6 +- src/GraphQl/Type/Definition/IterableType.php | 2 +- src/GraphQl/Type/Definition/UploadType.php | 2 +- src/GraphQl/Type/FieldsBuilder.php | 4 +- .../Type/FieldsBuilderEnumInterface.php | 2 +- src/GraphQl/Type/FieldsBuilderInterface.php | 2 +- src/Hal/JsonSchema/SchemaFactory.php | 2 +- src/Hal/Serializer/CollectionNormalizer.php | 2 +- src/Hal/Serializer/EntrypointNormalizer.php | 4 +- src/Hal/Serializer/ItemNormalizer.php | 8 +- src/Hal/Serializer/ObjectNormalizer.php | 8 +- .../EventListener/AddHeadersListener.php | 2 +- .../EventListener/AddTagsListener.php | 2 +- src/Hydra/JsonSchema/SchemaFactory.php | 2 +- .../CollectionFiltersNormalizer.php | 4 +- src/Hydra/Serializer/CollectionNormalizer.php | 2 +- .../ConstraintViolationListNormalizer.php | 4 +- .../Serializer/DocumentationNormalizer.php | 10 +- src/Hydra/Serializer/EntrypointNormalizer.php | 4 +- src/Hydra/Serializer/ErrorNormalizer.php | 4 +- .../PartialCollectionViewNormalizer.php | 6 +- .../Serializer/CollectionNormalizer.php | 2 +- .../ConstraintViolationListNormalizer.php | 4 +- .../Serializer/EntrypointNormalizer.php | 4 +- src/JsonApi/Serializer/ErrorNormalizer.php | 4 +- src/JsonApi/Serializer/ItemNormalizer.php | 16 +-- src/JsonApi/Serializer/ObjectNormalizer.php | 4 +- .../ReservedAttributeNameConverter.php | 4 +- src/JsonLd/Action/ContextAction.php | 2 +- src/JsonLd/ContextBuilder.php | 4 +- src/JsonLd/Serializer/ItemNormalizer.php | 10 +- src/JsonLd/Serializer/ObjectNormalizer.php | 4 +- .../BackwardCompatibleSchemaFactory.php | 2 +- .../Factory/SchemaPropertyMetadataFactory.php | 4 +- src/JsonSchema/SchemaFactory.php | 10 +- src/JsonSchema/SchemaFactoryInterface.php | 2 +- .../Tests/Fixtures/ApiResource/Dummy.php | 4 +- src/JsonSchema/TypeFactory.php | 6 +- src/JsonSchema/TypeFactoryInterface.php | 2 +- src/Metadata/Delete.php | 120 +++++++++--------- src/Metadata/Error.php | 120 +++++++++--------- src/Metadata/ErrorResource.php | 108 ++++++++-------- .../Extractor/XmlPropertyExtractor.php | 2 +- .../Extractor/XmlResourceExtractor.php | 2 +- src/Metadata/Get.php | 120 +++++++++--------- src/Metadata/GetCollection.php | 120 +++++++++--------- src/Metadata/GraphQl/Operation.php | 82 ++++++------ src/Metadata/GraphQl/Query.php | 86 ++++++------- src/Metadata/GraphQl/QueryCollection.php | 84 ++++++------ src/Metadata/GraphQl/Subscription.php | 84 ++++++------ src/Metadata/HttpOperation.php | 78 ++++++------ src/Metadata/IdentifiersExtractor.php | 6 +- .../IdentifiersExtractorInterface.php | 2 +- src/Metadata/IriConverterInterface.php | 4 +- src/Metadata/Metadata.php | 8 +- src/Metadata/NotExposed.php | 114 ++++++++--------- src/Metadata/Patch.php | 120 +++++++++--------- src/Metadata/Post.php | 120 +++++++++--------- .../AttributePropertyMetadataFactory.php | 2 +- .../SerializerPropertyMetadataFactory.php | 6 +- src/Metadata/Put.php | 120 +++++++++--------- ...butesResourceMetadataCollectionFactory.php | 2 +- ...actorResourceMetadataCollectionFactory.php | 2 +- ...ationResourceMetadataCollectionFactory.php | 2 +- ...hpDocResourceMetadataCollectionFactory.php | 2 +- .../Resource/ResourceMetadataCollection.php | 2 +- src/Metadata/ResourceClassResolver.php | 2 +- .../ResourceClassResolverInterface.php | 2 +- .../Extractor/Adapter/XmlResourceAdapter.php | 2 +- .../Tests/Fixtures/ApiResource/Dummy.php | 4 +- .../Resource/Factory/LinkFactoryTest.php | 2 +- .../Util/AttributeFilterExtractorTrait.php | 4 +- .../CamelCaseToSnakeCaseNameConverter.php | 2 +- src/OpenApi/Factory/OpenApiFactory.php | 4 +- src/OpenApi/Model/Components.php | 2 +- src/OpenApi/Model/Operation.php | 6 +- src/OpenApi/Model/PathItem.php | 2 +- .../Serializer/ApiGatewayNormalizer.php | 4 +- .../Serializer/LegacyOpenApiNormalizer.php | 4 +- src/OpenApi/Serializer/OpenApiNormalizer.php | 4 +- src/OpenApi/Tests/Fixtures/Dummy.php | 4 +- .../ConstraintViolationListNormalizer.php | 4 +- src/Problem/Serializer/ErrorNormalizer.php | 4 +- .../Serializer/UuidDenormalizer.php | 4 +- .../AbstractCollectionNormalizer.php | 8 +- ...tractConstraintViolationListNormalizer.php | 4 +- src/Serializer/AbstractItemNormalizer.php | 26 ++-- .../ConstraintViolationListNormalizer.php | 4 +- src/Serializer/Filter/PropertyFilter.php | 4 +- src/Serializer/ItemNormalizer.php | 4 +- src/Serializer/OperationContextTrait.php | 2 +- src/Serializer/SerializerContextBuilder.php | 2 +- .../SerializerContextBuilderInterface.php | 2 +- .../SerializerFilterContextBuilder.php | 2 +- .../Tests/Fixtures/ApiResource/Dummy.php | 4 +- .../SerializerFilterContextBuilderTest.php | 2 +- src/State/ApiResource/Error.php | 10 +- src/State/Pagination/Pagination.php | 14 +- .../Provider/ContentNegotiationProvider.php | 2 +- src/State/UriVariablesResolverTrait.php | 4 +- .../CachePoolClearerCacheWarmer.php | 2 +- .../DataCollector/RequestDataCollector.php | 2 +- .../Bundle/Test/ApiTestAssertionsTrait.php | 16 +-- src/Symfony/Bundle/Test/Client.php | 2 +- src/Symfony/Bundle/Test/Response.php | 2 +- src/Symfony/Controller/MainController.php | 2 +- .../EventListener/AddFormatListener.php | 2 +- .../EventListener/AddHeadersListener.php | 2 +- .../EventListener/AddLinkHeaderListener.php | 2 +- src/Symfony/EventListener/AddTagsListener.php | 2 +- .../EventListener/DenyAccessListener.php | 2 +- .../EventListener/DeserializeListener.php | 2 +- src/Symfony/EventListener/ErrorListener.php | 10 +- .../QueryParameterValidateListener.php | 2 +- src/Symfony/EventListener/ReadListener.php | 4 +- src/Symfony/EventListener/RespondListener.php | 4 +- .../EventListener/SerializeListener.php | 2 +- src/Symfony/EventListener/WriteListener.php | 4 +- .../Factory/DataCollectorResolverFactory.php | 2 +- src/Symfony/Routing/ApiLoader.php | 4 +- src/Symfony/Routing/IriConverter.php | 10 +- src/Symfony/Routing/Router.php | 2 +- src/Symfony/Routing/SkolemIriConverter.php | 4 +- .../Exception/ValidationException.php | 2 +- .../ValidationExceptionNormalizer.php | 4 +- src/Test/DoctrineMongoDbOdmFilterTestCase.php | 8 +- src/Test/DoctrineMongoDbOdmSetup.php | 6 +- src/Test/DoctrineOrmFilterTestCase.php | 8 +- src/Util/AttributeFilterExtractorTrait.php | 4 +- src/Util/IriHelper.php | 2 +- .../Exception/ValidationException.php | 2 +- .../Doctrine/Odm/Filter/ExistsFilterTest.php | 6 +- tests/Doctrine/Odm/Filter/OrderFilterTest.php | 6 +- .../Doctrine/Odm/Filter/SearchFilterTest.php | 2 +- ...mResourceCollectionMetadataFactoryTest.php | 2 +- .../PropertyInfo/DoctrineExtractorTest.php | 2 +- .../Doctrine/Orm/Filter/ExistsFilterTest.php | 6 +- tests/Doctrine/Orm/Filter/OrderFilterTest.php | 6 +- .../Doctrine/Orm/Filter/SearchFilterTest.php | 2 +- ...mResourceCollectionMetadataFactoryTest.php | 2 +- .../ApiResource/Issue5648/CustomFilter.php | 2 +- .../Issue5896/TypeFactoryDecorator.php | 2 +- tests/Fixtures/TestBundle/Document/Answer.php | 2 +- .../TestBundle/Document/CompositeItem.php | 2 +- tests/Fixtures/TestBundle/Document/Dummy.php | 4 +- .../DummyValidationSerializedName.php | 2 +- .../Fixtures/TestBundle/Document/Question.php | 2 +- .../TestBundle/Document/RelatedDummy.php | 2 +- .../TestBundle/Document/SlugChildDummy.php | 2 +- .../TestBundle/Document/ThirdLevel.php | 2 +- .../TestBundle/Document/VoDummyInspection.php | 2 +- tests/Fixtures/TestBundle/Entity/Answer.php | 2 +- .../TestBundle/Entity/CompositeLabel.php | 2 +- tests/Fixtures/TestBundle/Entity/Dummy.php | 4 +- .../TestBundle/Entity/DummyProblem.php | 4 +- .../DummyWithCollectDenormalizationErrors.php | 2 +- tests/Fixtures/TestBundle/Entity/Question.php | 2 +- .../TestBundle/Entity/RamseyUuidDummy.php | 2 +- .../TestBundle/Entity/RelatedDummy.php | 2 +- .../TestBundle/Entity/SlugChildDummy.php | 2 +- .../TestBundle/Entity/SymfonyUuidDummy.php | 2 +- .../Fixtures/TestBundle/Entity/ThirdLevel.php | 2 +- .../TestBundle/Entity/VoDummyInspection.php | 2 +- .../Exception/NotFoundException.php | 2 +- .../TestBundle/Filter/ArrayItemsFilter.php | 2 +- .../TestBundle/Filter/ArrayRequiredFilter.php | 2 +- .../TestBundle/Filter/BoundsFilter.php | 2 +- .../Filter/ComplexSubQueryFilter.php | 2 +- .../Fixtures/TestBundle/Filter/EnumFilter.php | 2 +- .../TestBundle/Filter/LengthFilter.php | 2 +- .../TestBundle/Filter/MultipleOfFilter.php | 2 +- .../TestBundle/Filter/PatternFilter.php | 2 +- .../Filter/RequiredAllowEmptyFilter.php | 2 +- .../TestBundle/Filter/RequiredFilter.php | 2 +- .../GraphQl/Type/Definition/DateTimeType.php | 2 +- .../Security/AuthenticationEntryPoint.php | 2 +- .../TestBundle/Serializer/ErrorNormalizer.php | 4 +- .../State/DummyDtoNoOutputProcessor.php | 4 +- .../CollectionFiltersNormalizerTest.php | 4 +- .../PartialCollectionViewNormalizerTest.php | 4 +- .../PayloadArgumentResolverTest.php | 2 +- .../Command/DebugResourceCommandTest.php | 2 +- .../EventListener/SwaggerUiListenerTest.php | 2 +- .../EventListener/DenyAccessListenerTest.php | 2 +- tests/Symfony/Routing/IriConverterTest.php | 2 +- .../ValidationExceptionListenerTest.php | 2 +- 284 files changed, 1269 insertions(+), 1269 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0aef1dd5fc..5cd863c7a55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Run commitlint @@ -42,7 +42,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -68,7 +68,7 @@ jobs: SYMFONY_PHPUNIT_VERSION: '9.5' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -81,7 +81,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -92,7 +92,7 @@ jobs: - name: Install PHPUnit run: vendor/bin/simple-phpunit --version - name: Cache PHPStan results - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /tmp/phpstan key: phpstan-php${{ matrix.php }}-${{ github.sha }} @@ -131,7 +131,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -144,7 +144,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -159,7 +159,7 @@ jobs: run: vendor/bin/simple-phpunit --log-junit build/logs/phpunit/junit.xml ${{ matrix.coverage && '--coverage-clover build/logs/phpunit/clover.xml' || '' }} - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: phpunit-logs-php${{ matrix.php }} path: build/logs/phpunit @@ -212,7 +212,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -228,7 +228,7 @@ jobs: vendor/bin/phpunit --log-junit "build/logs/phpunit/junit.xml" ${{ matrix.coverage && '--coverage-clover build/logs/phpunit/clover.xml' || '' }} - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: phpunit-logs-php${{ matrix.php }} path: src/${{ matrix.component }}/build/logs/phpunit @@ -273,7 +273,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -286,7 +286,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -311,7 +311,7 @@ jobs: continue-on-error: true - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: behat-logs-php${{ matrix.php }} path: build/logs/behat @@ -340,7 +340,7 @@ jobs: tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '14' - name: Validate OpenAPI documents @@ -349,7 +349,7 @@ jobs: npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.yaml - name: Upload OpenAPI artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: openapi-docs-php${{ matrix.php }} path: build/out/openapi @@ -370,7 +370,7 @@ jobs: PGPASSWORD: apiplatformrocks steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup postgres run: | sudo systemctl start postgresql @@ -389,7 +389,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -426,7 +426,7 @@ jobs: DATABASE_URL: mysql://root:root@127.0.0.1/api_platform_test steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -439,7 +439,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -469,7 +469,7 @@ jobs: MONGODB_URL: mongodb://localhost:27017 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup MongoDB run: | sudo apt update @@ -491,7 +491,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -519,7 +519,7 @@ jobs: continue-on-error: true - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: behat-logs-php${{ matrix.php }} path: build/logs/behat @@ -571,7 +571,7 @@ jobs: - 1337:1337 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -584,7 +584,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -610,7 +610,7 @@ jobs: continue-on-error: true - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: behat-logs-php${{ matrix.php }} path: build/logs/behat @@ -645,7 +645,7 @@ jobs: APP_ENV: elasticsearch steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Configure sysctl limits run: | sudo swapoff -a @@ -669,7 +669,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -696,7 +696,7 @@ jobs: APP_ENV: elasticsearch steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Configure sysctl limits run: | sudo swapoff -a @@ -719,7 +719,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -744,7 +744,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -757,7 +757,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -782,7 +782,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -797,7 +797,7 @@ jobs: - name: Allow unstable project dependencies run: composer config minimum-stability dev - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -825,7 +825,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -842,7 +842,7 @@ jobs: - name: Allow unstable project dependencies run: composer config minimum-stability dev - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -872,7 +872,7 @@ jobs: DATABASE_URL: sqlite:///%kernel.project_dir%/var/data.db steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP with pre-release PECL extension uses: shivammathur/setup-php@v2 with: @@ -893,7 +893,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT shell: bash - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -923,7 +923,7 @@ jobs: DATABASE_URL: sqlite:///%kernel.project_dir%/var/data.db steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP with pre-release PECL extension uses: shivammathur/setup-php@v2 with: @@ -944,7 +944,7 @@ jobs: run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT shell: bash - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -969,7 +969,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -982,7 +982,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -1011,7 +1011,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -1026,7 +1026,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -1058,7 +1058,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -1071,7 +1071,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -1095,7 +1095,7 @@ jobs: fi - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: phpunit-logs-php${{ matrix.php }} path: build/logs/phpunit @@ -1132,7 +1132,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -1145,7 +1145,7 @@ jobs: id: composercache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -1162,7 +1162,7 @@ jobs: vendor/bin/behat --out=std --format=progress --format=junit --out=build/logs/behat/junit --profile=legacy --no-interaction - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: behat-logs-php${{ matrix.php }} path: build/logs/behat @@ -1173,7 +1173,7 @@ jobs: tests/Fixtures/app/console api:openapi:export -o build/out/openapi/openapi_v3.json tests/Fixtures/app/console api:openapi:export --yaml -o build/out/openapi/openapi_v3.yaml - name: Setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '14' - name: Validate OpenAPI documents @@ -1182,7 +1182,7 @@ jobs: npx git+https://github.com/soyuka/swagger-cli#master validate build/out/openapi/openapi_v3.yaml - name: Upload OpenAPI artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: openapi-docs-php${{ matrix.php }} path: build/out/openapi diff --git a/.github/workflows/guides.yaml b/.github/workflows/guides.yaml index 238617d9999..41413e23626 100644 --- a/.github/workflows/guides.yaml +++ b/.github/workflows/guides.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP with pre-release PECL extension uses: shivammathur/setup-php@v2 with: @@ -35,7 +35,7 @@ jobs: composer global config --no-plugins allow-plugins.symfony/runtime true composer global require php-documentation-generator/php-documentation-generator:dev-main - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} diff --git a/.github/workflows/subtree.yml b/.github/workflows/subtree.yml index ef8fd40dd45..bf6c8396601 100644 --- a/.github/workflows/subtree.yml +++ b/.github/workflows/subtree.yml @@ -15,7 +15,7 @@ jobs: split: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/src/Kernel.php b/docs/src/Kernel.php index f11e2472d0d..69e14eacaa4 100644 --- a/docs/src/Kernel.php +++ b/docs/src/Kernel.php @@ -45,7 +45,7 @@ class Kernel extends BaseKernel private $declaredClasses = []; private string $guide; - public function __construct(string $environment, bool $debug, string $guide = null) + public function __construct(string $environment, bool $debug, ?string $guide = null) { parent::__construct($environment, $debug); @@ -118,7 +118,7 @@ private function configureContainer(ContainerConfigurator $container, LoaderInte } } - public function request(Request $request = null): Response + public function request(?Request $request = null): Response { if (null === $request && \function_exists('App\Playground\request')) { $request = request(); diff --git a/src/Action/EntrypointAction.php b/src/Action/EntrypointAction.php index 258b13abf2e..2043aeb4e86 100644 --- a/src/Action/EntrypointAction.php +++ b/src/Action/EntrypointAction.php @@ -41,7 +41,7 @@ public function __construct( /** * @return Entrypoint|Response */ - public function __invoke(Request $request = null) + public function __invoke(?Request $request = null) { if ($this->provider && $this->processor) { $context = ['request' => $request]; diff --git a/src/Action/ExceptionAction.php b/src/Action/ExceptionAction.php index fc662490531..252b592a2a5 100644 --- a/src/Action/ExceptionAction.php +++ b/src/Action/ExceptionAction.php @@ -42,7 +42,7 @@ final class ExceptionAction * @param array $errorFormats A list of enabled error formats * @param array $exceptionToStatus A list of exceptions mapped to their HTTP status code */ - public function __construct(private readonly SerializerInterface $serializer, private readonly array $errorFormats, private readonly array $exceptionToStatus = [], ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null) + public function __construct(private readonly SerializerInterface $serializer, private readonly array $errorFormats, private readonly array $exceptionToStatus = [], ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/Api/FilterLocatorTrait.php b/src/Api/FilterLocatorTrait.php index cb9f5edbb0e..c58f5630dac 100644 --- a/src/Api/FilterLocatorTrait.php +++ b/src/Api/FilterLocatorTrait.php @@ -45,7 +45,7 @@ private function setFilterLocator(?ContainerInterface $filterLocator, bool $allo /** * Gets a filter with a backward compatibility. */ - private function getFilter(string $filterId): null|FilterInterface|MetadataFilterInterface + private function getFilter(string $filterId): FilterInterface|MetadataFilterInterface|null { if ($this->filterLocator && $this->filterLocator->has($filterId)) { return $this->filterLocator->get($filterId); diff --git a/src/Api/IdentifiersExtractor.php b/src/Api/IdentifiersExtractor.php index fbce96278bf..199cc049398 100644 --- a/src/Api/IdentifiersExtractor.php +++ b/src/Api/IdentifiersExtractor.php @@ -37,7 +37,7 @@ final class IdentifiersExtractor implements IdentifiersExtractorInterface use ResourceClassInfoTrait; private readonly PropertyAccessorInterface $propertyAccessor; - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, PropertyAccessorInterface $propertyAccessor = null) + public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, ?PropertyAccessorInterface $propertyAccessor = null) { $this->resourceMetadataFactory = $resourceMetadataFactory; $this->resourceClassResolver = $resourceClassResolver; @@ -49,7 +49,7 @@ public function __construct(ResourceMetadataCollectionFactoryInterface $resource * * TODO: 3.0 identifiers should be stringable? */ - public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array + public function getIdentifiersFromItem(object $item, ?Operation $operation = null, array $context = []): array { if (!$this->isResourceClass($this->getObjectClass($item))) { return ['id' => $this->propertyAccessor->getValue($item, 'id')]; @@ -96,7 +96,7 @@ private function getIdentifiersFromOperation(object $item, Operation $operation, /** * Gets the value of the given class property. */ - private function getIdentifierValue(object $item, string $class, string $property, string $parameterName, string $toProperty = null): float|bool|int|string + private function getIdentifierValue(object $item, string $class, string $property, string $parameterName, ?string $toProperty = null): float|bool|int|string { if ($item instanceof $class) { try { diff --git a/src/Api/IdentifiersExtractorInterface.php b/src/Api/IdentifiersExtractorInterface.php index d0e7566dc45..1ad79b4fd19 100644 --- a/src/Api/IdentifiersExtractorInterface.php +++ b/src/Api/IdentifiersExtractorInterface.php @@ -28,5 +28,5 @@ interface IdentifiersExtractorInterface * * @throws RuntimeException */ - public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array; + public function getIdentifiersFromItem(object $item, ?Operation $operation = null, array $context = []): array; } diff --git a/src/Api/IriConverterInterface.php b/src/Api/IriConverterInterface.php index 8a319f370cb..b2990f339d2 100644 --- a/src/Api/IriConverterInterface.php +++ b/src/Api/IriConverterInterface.php @@ -31,7 +31,7 @@ interface IriConverterInterface * @throws InvalidArgumentException * @throws ItemNotFoundException */ - public function getResourceFromIri(string $iri, array $context = [], Operation $operation = null): object; + public function getResourceFromIri(string $iri, array $context = [], ?Operation $operation = null): object; /** * Gets the IRI associated with the given item. @@ -41,5 +41,5 @@ public function getResourceFromIri(string $iri, array $context = [], Operation $ * @throws InvalidArgumentException * @throws RuntimeException */ - public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = []): ?string; + public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): ?string; } diff --git a/src/Api/ResourceClassResolver.php b/src/Api/ResourceClassResolver.php index bbd76311ffc..9ac92ab78e9 100644 --- a/src/Api/ResourceClassResolver.php +++ b/src/Api/ResourceClassResolver.php @@ -38,7 +38,7 @@ public function __construct(private readonly ResourceNameCollectionFactoryInterf /** * {@inheritdoc} */ - public function getResourceClass(mixed $value, string $resourceClass = null, bool $strict = false): string + public function getResourceClass(mixed $value, ?string $resourceClass = null, bool $strict = false): string { if ($strict && null === $resourceClass) { throw new InvalidArgumentException('Strict checking is only possible when resource class is specified.'); diff --git a/src/Api/ResourceClassResolverInterface.php b/src/Api/ResourceClassResolverInterface.php index 683b6618368..75e6a021d64 100644 --- a/src/Api/ResourceClassResolverInterface.php +++ b/src/Api/ResourceClassResolverInterface.php @@ -30,7 +30,7 @@ interface ResourceClassResolverInterface * * @throws InvalidArgumentException */ - public function getResourceClass(mixed $value, string $resourceClass = null, bool $strict = false): string; + public function getResourceClass(mixed $value, ?string $resourceClass = null, bool $strict = false): string; /** * Is the given class a resource class? diff --git a/src/Doctrine/Common/Filter/NumericFilterTrait.php b/src/Doctrine/Common/Filter/NumericFilterTrait.php index 153a4deb09d..bdba0d6deb1 100644 --- a/src/Doctrine/Common/Filter/NumericFilterTrait.php +++ b/src/Doctrine/Common/Filter/NumericFilterTrait.php @@ -63,7 +63,7 @@ public function getDescription(string $resourceClass): array /** * Gets the PHP type corresponding to this Doctrine type. */ - abstract protected function getType(string $doctrineType = null): string; + abstract protected function getType(?string $doctrineType = null): string; abstract protected function getProperties(): ?array; diff --git a/src/Doctrine/Common/Filter/SearchFilterTrait.php b/src/Doctrine/Common/Filter/SearchFilterTrait.php index e85bbf8a056..1641ff9ec82 100644 --- a/src/Doctrine/Common/Filter/SearchFilterTrait.php +++ b/src/Doctrine/Common/Filter/SearchFilterTrait.php @@ -34,7 +34,7 @@ trait SearchFilterTrait protected IriConverterInterface|LegacyIriConverterInterface $iriConverter; protected PropertyAccessorInterface $propertyAccessor; - protected null|IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface $identifiersExtractor = null; + protected IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface|null $identifiersExtractor = null; /** * {@inheritdoc} @@ -165,7 +165,7 @@ protected function normalizeValues(array $values, string $property): ?array /** * When the field should be an integer, check that the given value is a valid one. */ - protected function hasValidValues(array $values, string $type = null): bool + protected function hasValidValues(array $values, ?string $type = null): bool { foreach ($values as $value) { if (null !== $value && \in_array($type, (array) self::DOCTRINE_INTEGER_TYPE, true) && false === filter_var($value, \FILTER_VALIDATE_INT)) { diff --git a/src/Doctrine/Common/State/LinksHandlerTrait.php b/src/Doctrine/Common/State/LinksHandlerTrait.php index acb6ea8b7de..757bd47cdce 100644 --- a/src/Doctrine/Common/State/LinksHandlerTrait.php +++ b/src/Doctrine/Common/State/LinksHandlerTrait.php @@ -90,7 +90,7 @@ private function getLinks(string $resourceClass, Operation $operation, array $co return [$newLink]; } - private function getIdentifierValue(array &$identifiers, string $name = null): mixed + private function getIdentifierValue(array &$identifiers, ?string $name = null): mixed { if (isset($identifiers[$name])) { $value = $identifiers[$name]; @@ -102,7 +102,7 @@ private function getIdentifierValue(array &$identifiers, string $name = null): m return array_shift($identifiers); } - private function getOperationLinks(Operation $operation = null): array + private function getOperationLinks(?Operation $operation = null): array { if ($operation instanceof GraphQlOperation) { return $operation->getLinks() ?? []; diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/Dummy.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/Dummy.php index d7c1b17b529..ffc3edf77c3 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/Dummy.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/Dummy.php @@ -194,12 +194,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php index 718c00e5a06..ef2e950e502 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php @@ -169,7 +169,7 @@ public function getThirdLevel(): ?ThirdLevel return $this->thirdLevel; } - public function setThirdLevel(ThirdLevel $thirdLevel = null): void + public function setThirdLevel(?ThirdLevel $thirdLevel = null): void { $this->thirdLevel = $thirdLevel; } diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php index 948101bac72..b90983dab6e 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php @@ -88,7 +88,7 @@ public function getFourthLevel(): ?FourthLevel return $this->fourthLevel; } - public function setFourthLevel(FourthLevel $fourthLevel = null): void + public function setFourthLevel(?FourthLevel $fourthLevel = null): void { $this->fourthLevel = $fourthLevel; } diff --git a/src/Doctrine/EventListener/PublishMercureUpdatesListener.php b/src/Doctrine/EventListener/PublishMercureUpdatesListener.php index ba1e1377473..efe68a78e04 100644 --- a/src/Doctrine/EventListener/PublishMercureUpdatesListener.php +++ b/src/Doctrine/EventListener/PublishMercureUpdatesListener.php @@ -66,7 +66,7 @@ final class PublishMercureUpdatesListener /** * @param array $formats */ - public function __construct(LegacyResourceClassResolverInterface|ResourceClassResolverInterface $resourceClassResolver, private readonly LegacyIriConverterInterface|IriConverterInterface $iriConverter, ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly SerializerInterface $serializer, private readonly array $formats, MessageBusInterface $messageBus = null, private readonly ?HubRegistry $hubRegistry = null, private readonly ?GraphQlSubscriptionManagerInterface $graphQlSubscriptionManager = null, private readonly ?GraphQlMercureSubscriptionIriGeneratorInterface $graphQlMercureSubscriptionIriGenerator = null, ExpressionLanguage $expressionLanguage = null, private bool $includeType = false) + public function __construct(LegacyResourceClassResolverInterface|ResourceClassResolverInterface $resourceClassResolver, private readonly LegacyIriConverterInterface|IriConverterInterface $iriConverter, ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly SerializerInterface $serializer, private readonly array $formats, ?MessageBusInterface $messageBus = null, private readonly ?HubRegistry $hubRegistry = null, private readonly ?GraphQlSubscriptionManagerInterface $graphQlSubscriptionManager = null, private readonly ?GraphQlMercureSubscriptionIriGeneratorInterface $graphQlMercureSubscriptionIriGenerator = null, ?ExpressionLanguage $expressionLanguage = null, private bool $includeType = false) { if (null === $messageBus && null === $hubRegistry) { throw new InvalidArgumentException('A message bus or a hub registry must be provided.'); diff --git a/src/Doctrine/EventListener/PurgeHttpCacheListener.php b/src/Doctrine/EventListener/PurgeHttpCacheListener.php index 1c1ef5718c3..c44b9172d43 100644 --- a/src/Doctrine/EventListener/PurgeHttpCacheListener.php +++ b/src/Doctrine/EventListener/PurgeHttpCacheListener.php @@ -43,7 +43,7 @@ final class PurgeHttpCacheListener private readonly PropertyAccessorInterface $propertyAccessor; private array $tags = []; - public function __construct(private readonly PurgerInterface $purger, private readonly IriConverterInterface|LegacyIriConverterInterface $iriConverter, private readonly ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null) + public function __construct(private readonly PurgerInterface $purger, private readonly IriConverterInterface|LegacyIriConverterInterface $iriConverter, private readonly ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, ?PropertyAccessorInterface $propertyAccessor = null) { $this->propertyAccessor = $propertyAccessor ?? PropertyAccess::createPropertyAccessor(); } diff --git a/src/Doctrine/Odm/Extension/AggregationCollectionExtensionInterface.php b/src/Doctrine/Odm/Extension/AggregationCollectionExtensionInterface.php index 0793dbd228a..a754e8b809f 100644 --- a/src/Doctrine/Odm/Extension/AggregationCollectionExtensionInterface.php +++ b/src/Doctrine/Odm/Extension/AggregationCollectionExtensionInterface.php @@ -23,5 +23,5 @@ */ interface AggregationCollectionExtensionInterface { - public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void; + public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void; } diff --git a/src/Doctrine/Odm/Extension/AggregationItemExtensionInterface.php b/src/Doctrine/Odm/Extension/AggregationItemExtensionInterface.php index e89f7f527e8..492b7114c60 100644 --- a/src/Doctrine/Odm/Extension/AggregationItemExtensionInterface.php +++ b/src/Doctrine/Odm/Extension/AggregationItemExtensionInterface.php @@ -23,5 +23,5 @@ */ interface AggregationItemExtensionInterface { - public function applyToItem(Builder $aggregationBuilder, string $resourceClass, array $identifiers, Operation $operation = null, array &$context = []): void; + public function applyToItem(Builder $aggregationBuilder, string $resourceClass, array $identifiers, ?Operation $operation = null, array &$context = []): void; } diff --git a/src/Doctrine/Odm/Extension/AggregationResultCollectionExtensionInterface.php b/src/Doctrine/Odm/Extension/AggregationResultCollectionExtensionInterface.php index ff7086bcb91..839242b4704 100644 --- a/src/Doctrine/Odm/Extension/AggregationResultCollectionExtensionInterface.php +++ b/src/Doctrine/Odm/Extension/AggregationResultCollectionExtensionInterface.php @@ -24,7 +24,7 @@ */ interface AggregationResultCollectionExtensionInterface extends AggregationCollectionExtensionInterface { - public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool; + public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool; - public function getResult(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array $context = []): iterable; + public function getResult(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array $context = []): iterable; } diff --git a/src/Doctrine/Odm/Extension/AggregationResultItemExtensionInterface.php b/src/Doctrine/Odm/Extension/AggregationResultItemExtensionInterface.php index b8b7c59f6e7..103d1d0b4a5 100644 --- a/src/Doctrine/Odm/Extension/AggregationResultItemExtensionInterface.php +++ b/src/Doctrine/Odm/Extension/AggregationResultItemExtensionInterface.php @@ -24,7 +24,7 @@ */ interface AggregationResultItemExtensionInterface extends AggregationItemExtensionInterface { - public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool; + public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool; - public function getResult(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array $context = []): ?object; + public function getResult(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array $context = []): ?object; } diff --git a/src/Doctrine/Odm/Extension/FilterExtension.php b/src/Doctrine/Odm/Extension/FilterExtension.php index aa6ce9c46c4..75678e9de41 100644 --- a/src/Doctrine/Odm/Extension/FilterExtension.php +++ b/src/Doctrine/Odm/Extension/FilterExtension.php @@ -33,7 +33,7 @@ public function __construct(private readonly ContainerInterface $filterLocator) /** * {@inheritdoc} */ - public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { $resourceFilters = $operation?->getFilters(); diff --git a/src/Doctrine/Odm/Extension/OrderExtension.php b/src/Doctrine/Odm/Extension/OrderExtension.php index 884149c975f..0afb8d70fcf 100644 --- a/src/Doctrine/Odm/Extension/OrderExtension.php +++ b/src/Doctrine/Odm/Extension/OrderExtension.php @@ -40,7 +40,7 @@ public function __construct(private readonly ?string $order = null, private read /** * {@inheritdoc} */ - public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { // Do not apply order if already defined on $aggregationBuilder if ($this->hasSortStage($aggregationBuilder)) { diff --git a/src/Doctrine/Odm/Extension/PaginationExtension.php b/src/Doctrine/Odm/Extension/PaginationExtension.php index 1456207a327..bb3f2c32f1d 100644 --- a/src/Doctrine/Odm/Extension/PaginationExtension.php +++ b/src/Doctrine/Odm/Extension/PaginationExtension.php @@ -40,7 +40,7 @@ public function __construct(private readonly ManagerRegistry $managerRegistry, p * * @throws RuntimeException */ - public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if (!$this->pagination->isEnabled($operation, $context)) { return; @@ -85,7 +85,7 @@ public function applyToCollection(Builder $aggregationBuilder, string $resourceC /** * {@inheritdoc} */ - public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool + public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool { if ($context['graphql_operation_name'] ?? false) { return $this->pagination->isGraphQlEnabled($operation, $context); @@ -99,7 +99,7 @@ public function supportsResult(string $resourceClass, Operation $operation = nul * * @throws RuntimeException */ - public function getResult(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array $context = []): iterable + public function getResult(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array $context = []): iterable { $manager = $this->managerRegistry->getManagerForClass($resourceClass); if (!$manager instanceof DocumentManager) { diff --git a/src/Doctrine/Odm/Filter/AbstractFilter.php b/src/Doctrine/Odm/Filter/AbstractFilter.php index 9abac215cc9..40cecd1400f 100644 --- a/src/Doctrine/Odm/Filter/AbstractFilter.php +++ b/src/Doctrine/Odm/Filter/AbstractFilter.php @@ -35,7 +35,7 @@ abstract class AbstractFilter implements FilterInterface use PropertyHelperTrait; protected LoggerInterface $logger; - public function __construct(protected ManagerRegistry $managerRegistry, LoggerInterface $logger = null, protected ?array $properties = null, protected ?NameConverterInterface $nameConverter = null) + public function __construct(protected ManagerRegistry $managerRegistry, ?LoggerInterface $logger = null, protected ?array $properties = null, protected ?NameConverterInterface $nameConverter = null) { $this->logger = $logger ?? new NullLogger(); } @@ -43,7 +43,7 @@ public function __construct(protected ManagerRegistry $managerRegistry, LoggerIn /** * {@inheritdoc} */ - public function apply(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + public function apply(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { foreach ($context['filters'] as $property => $value) { $this->filterProperty($this->denormalizePropertyName($property), $value, $aggregationBuilder, $resourceClass, $operation, $context); @@ -53,7 +53,7 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, Operat /** * Passes a property through the filter. */ - abstract protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void; + abstract protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void; protected function getManagerRegistry(): ManagerRegistry { diff --git a/src/Doctrine/Odm/Filter/BooleanFilter.php b/src/Doctrine/Odm/Filter/BooleanFilter.php index 15f91deaf92..babe3309ed0 100644 --- a/src/Doctrine/Odm/Filter/BooleanFilter.php +++ b/src/Doctrine/Odm/Filter/BooleanFilter.php @@ -116,7 +116,7 @@ final class BooleanFilter extends AbstractFilter /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if ( !$this->isPropertyEnabled($property, $resourceClass) diff --git a/src/Doctrine/Odm/Filter/DateFilter.php b/src/Doctrine/Odm/Filter/DateFilter.php index 0b848b2a49b..fd2bf08556d 100644 --- a/src/Doctrine/Odm/Filter/DateFilter.php +++ b/src/Doctrine/Odm/Filter/DateFilter.php @@ -129,7 +129,7 @@ final class DateFilter extends AbstractFilter implements DateFilterInterface /** * {@inheritdoc} */ - protected function filterProperty(string $property, $values, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + protected function filterProperty(string $property, $values, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { // Expect $values to be an array having the period as keys and the date value as values if ( @@ -197,7 +197,7 @@ protected function filterProperty(string $property, $values, Builder $aggregatio /** * Adds the match stage according to the chosen null management. */ - private function addMatch(Builder $aggregationBuilder, string $field, string $operator, $value, string $nullManagement = null): void + private function addMatch(Builder $aggregationBuilder, string $field, string $operator, $value, ?string $nullManagement = null): void { $value = $this->normalizeValue($value, $operator); diff --git a/src/Doctrine/Odm/Filter/ExistsFilter.php b/src/Doctrine/Odm/Filter/ExistsFilter.php index 7235b25d3f7..db57f81fdad 100644 --- a/src/Doctrine/Odm/Filter/ExistsFilter.php +++ b/src/Doctrine/Odm/Filter/ExistsFilter.php @@ -111,7 +111,7 @@ final class ExistsFilter extends AbstractFilter implements ExistsFilterInterface { use ExistsFilterTrait; - public function __construct(ManagerRegistry $managerRegistry, LoggerInterface $logger = null, array $properties = null, string $existsParameterName = self::QUERY_PARAMETER_KEY, NameConverterInterface $nameConverter = null) + public function __construct(ManagerRegistry $managerRegistry, ?LoggerInterface $logger = null, ?array $properties = null, string $existsParameterName = self::QUERY_PARAMETER_KEY, ?NameConverterInterface $nameConverter = null) { parent::__construct($managerRegistry, $logger, $properties, $nameConverter); @@ -121,7 +121,7 @@ public function __construct(ManagerRegistry $managerRegistry, LoggerInterface $l /** * {@inheritdoc} */ - public function apply(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + public function apply(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { foreach ($context['filters'][$this->existsParameterName] ?? [] as $property => $value) { $this->filterProperty($this->denormalizePropertyName($property), $value, $aggregationBuilder, $resourceClass, $operation, $context); @@ -131,7 +131,7 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, Operat /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if ( !$this->isPropertyEnabled($property, $resourceClass) diff --git a/src/Doctrine/Odm/Filter/FilterInterface.php b/src/Doctrine/Odm/Filter/FilterInterface.php index 8dc3c0631c4..11e006abb8f 100644 --- a/src/Doctrine/Odm/Filter/FilterInterface.php +++ b/src/Doctrine/Odm/Filter/FilterInterface.php @@ -27,5 +27,5 @@ interface FilterInterface extends BaseFilterInterface /** * Applies the filter. */ - public function apply(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void; + public function apply(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void; } diff --git a/src/Doctrine/Odm/Filter/NumericFilter.php b/src/Doctrine/Odm/Filter/NumericFilter.php index 8d9174c42ac..34cec17bb05 100644 --- a/src/Doctrine/Odm/Filter/NumericFilter.php +++ b/src/Doctrine/Odm/Filter/NumericFilter.php @@ -120,7 +120,7 @@ final class NumericFilter extends AbstractFilter /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if ( !$this->isPropertyEnabled($property, $resourceClass) @@ -151,7 +151,7 @@ protected function filterProperty(string $property, $value, Builder $aggregation /** * {@inheritdoc} */ - protected function getType(string $doctrineType = null): string + protected function getType(?string $doctrineType = null): string { if (null === $doctrineType) { return 'string'; diff --git a/src/Doctrine/Odm/Filter/OrderFilter.php b/src/Doctrine/Odm/Filter/OrderFilter.php index 2f4e570921e..a8cf49b1212 100644 --- a/src/Doctrine/Odm/Filter/OrderFilter.php +++ b/src/Doctrine/Odm/Filter/OrderFilter.php @@ -200,7 +200,7 @@ final class OrderFilter extends AbstractFilter implements OrderFilterInterface { use OrderFilterTrait; - public function __construct(ManagerRegistry $managerRegistry, string $orderParameterName = 'order', LoggerInterface $logger = null, array $properties = null, NameConverterInterface $nameConverter = null) + public function __construct(ManagerRegistry $managerRegistry, string $orderParameterName = 'order', ?LoggerInterface $logger = null, ?array $properties = null, ?NameConverterInterface $nameConverter = null) { if (null !== $properties) { $properties = array_map(static function ($propertyOptions) { @@ -223,7 +223,7 @@ public function __construct(ManagerRegistry $managerRegistry, string $orderParam /** * {@inheritdoc} */ - public function apply(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + public function apply(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if (isset($context['filters']) && !isset($context['filters'][$this->orderParameterName])) { return; @@ -243,7 +243,7 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, Operat /** * {@inheritdoc} */ - protected function filterProperty(string $property, $direction, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + protected function filterProperty(string $property, $direction, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if (!$this->isPropertyEnabled($property, $resourceClass) || !$this->isPropertyMapped($property, $resourceClass)) { return; diff --git a/src/Doctrine/Odm/Filter/RangeFilter.php b/src/Doctrine/Odm/Filter/RangeFilter.php index 15743b3d080..e34733df07d 100644 --- a/src/Doctrine/Odm/Filter/RangeFilter.php +++ b/src/Doctrine/Odm/Filter/RangeFilter.php @@ -111,7 +111,7 @@ final class RangeFilter extends AbstractFilter implements RangeFilterInterface /** * {@inheritdoc} */ - protected function filterProperty(string $property, $values, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + protected function filterProperty(string $property, $values, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if ( !\is_array($values) diff --git a/src/Doctrine/Odm/Filter/SearchFilter.php b/src/Doctrine/Odm/Filter/SearchFilter.php index 230fff70fe1..3a40c096f69 100644 --- a/src/Doctrine/Odm/Filter/SearchFilter.php +++ b/src/Doctrine/Odm/Filter/SearchFilter.php @@ -142,7 +142,7 @@ final class SearchFilter extends AbstractFilter implements SearchFilterInterface public const DOCTRINE_INTEGER_TYPE = [MongoDbType::INTEGER, MongoDbType::INT]; - public function __construct(ManagerRegistry $managerRegistry, IriConverterInterface|LegacyIriConverterInterface $iriConverter, null|IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface $identifiersExtractor, PropertyAccessorInterface $propertyAccessor = null, LoggerInterface $logger = null, array $properties = null, NameConverterInterface $nameConverter = null) + public function __construct(ManagerRegistry $managerRegistry, IriConverterInterface|LegacyIriConverterInterface $iriConverter, IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface|null $identifiersExtractor, ?PropertyAccessorInterface $propertyAccessor = null, ?LoggerInterface $logger = null, ?array $properties = null, ?NameConverterInterface $nameConverter = null) { parent::__construct($managerRegistry, $logger, $properties, $nameConverter); @@ -164,7 +164,7 @@ protected function getPropertyAccessor(): PropertyAccessorInterface /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void + protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void { if ( null === $value diff --git a/src/Doctrine/Odm/State/CollectionProvider.php b/src/Doctrine/Odm/State/CollectionProvider.php index cf257b0ec80..c96bff3b545 100644 --- a/src/Doctrine/Odm/State/CollectionProvider.php +++ b/src/Doctrine/Odm/State/CollectionProvider.php @@ -34,7 +34,7 @@ final class CollectionProvider implements ProviderInterface /** * @param AggregationCollectionExtensionInterface[] $collectionExtensions */ - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $collectionExtensions = [], ContainerInterface $handleLinksLocator = null) + public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $collectionExtensions = [], ?ContainerInterface $handleLinksLocator = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; $this->handleLinksLocator = $handleLinksLocator; diff --git a/src/Doctrine/Odm/State/ItemProvider.php b/src/Doctrine/Odm/State/ItemProvider.php index 47fd0e588c6..0635cc5d9b3 100644 --- a/src/Doctrine/Odm/State/ItemProvider.php +++ b/src/Doctrine/Odm/State/ItemProvider.php @@ -37,7 +37,7 @@ final class ItemProvider implements ProviderInterface /** * @param AggregationItemExtensionInterface[] $itemExtensions */ - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $itemExtensions = [], ContainerInterface $handleLinksLocator = null) + public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $itemExtensions = [], ?ContainerInterface $handleLinksLocator = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; $this->handleLinksLocator = $handleLinksLocator; diff --git a/src/Doctrine/Odm/State/LinksHandlerTrait.php b/src/Doctrine/Odm/State/LinksHandlerTrait.php index 1843d0f684e..20adac49e83 100644 --- a/src/Doctrine/Odm/State/LinksHandlerTrait.php +++ b/src/Doctrine/Odm/State/LinksHandlerTrait.php @@ -28,7 +28,7 @@ trait LinksHandlerTrait { use CommonLinksHandlerTrait; - private function handleLinks(Builder $aggregationBuilder, array $identifiers, array $context, string $resourceClass, Operation $operation = null): void + private function handleLinks(Builder $aggregationBuilder, array $identifiers, array $context, string $resourceClass, ?Operation $operation = null): void { if (!$identifiers) { return; @@ -54,7 +54,7 @@ private function handleLinks(Builder $aggregationBuilder, array $identifiers, ar /** * @throws RuntimeException */ - private function buildAggregation(string $toClass, array $links, array $identifiers, array $context, array $executeOptions, string $previousAggregationClass, Builder $previousAggregationBuilder, Operation $operation = null): Builder + private function buildAggregation(string $toClass, array $links, array $identifiers, array $context, array $executeOptions, string $previousAggregationClass, Builder $previousAggregationBuilder, ?Operation $operation = null): Builder { if (!$operation) { trigger_deprecation('api-platform/core', '3.2', 'In API Platform 4 the last argument "operation" will be required and this trait will be internal. Use the "handleLinks" feature instead.'); diff --git a/src/Doctrine/Orm/Extension/EagerLoadingExtension.php b/src/Doctrine/Orm/Extension/EagerLoadingExtension.php index dc6de300cb0..49f63b449f6 100644 --- a/src/Doctrine/Orm/Extension/EagerLoadingExtension.php +++ b/src/Doctrine/Orm/Extension/EagerLoadingExtension.php @@ -48,7 +48,7 @@ public function __construct(private readonly PropertyNameCollectionFactoryInterf /** * {@inheritdoc} */ - public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass = null, Operation $operation = null, array $context = []): void + public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): void { $this->apply($queryBuilder, $queryNameGenerator, $resourceClass, $operation, $context); } @@ -56,7 +56,7 @@ public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGenerator /** * The context may contain serialization groups which helps defining joined entities that are readable. */ - public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, Operation $operation = null, array $context = []): void + public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?Operation $operation = null, array $context = []): void { $this->apply($queryBuilder, $queryNameGenerator, $resourceClass, $operation, $context); } @@ -107,7 +107,7 @@ private function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $ * * @throws RuntimeException when the max number of joins has been reached */ - private function joinRelations(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, bool $forceEager, bool $fetchPartial, string $parentAlias, array $options = [], array $normalizationContext = [], bool $wasLeftJoin = false, int &$joinCount = 0, int $currentDepth = null, string $parentAssociation = null): void + private function joinRelations(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, bool $forceEager, bool $fetchPartial, string $parentAlias, array $options = [], array $normalizationContext = [], bool $wasLeftJoin = false, int &$joinCount = 0, ?int $currentDepth = null, ?string $parentAssociation = null): void { if ($joinCount > $this->maxJoins) { throw new RuntimeException('The total number of joined relations has exceeded the specified maximum. Raise the limit if necessary with the "api_platform.eager_loading.max_joins" configuration key (https://api-platform.com/docs/core/performance/#eager-loading), or limit the maximum serialization depth using the "enable_max_depth" option of the Symfony serializer (https://symfony.com/doc/current/components/serializer.html#handling-serialization-depth).'); diff --git a/src/Doctrine/Orm/Extension/FilterEagerLoadingExtension.php b/src/Doctrine/Orm/Extension/FilterEagerLoadingExtension.php index 1afd8b2b9ed..31170db96cd 100644 --- a/src/Doctrine/Orm/Extension/FilterEagerLoadingExtension.php +++ b/src/Doctrine/Orm/Extension/FilterEagerLoadingExtension.php @@ -36,7 +36,7 @@ public function __construct(private readonly bool $forceEager = true, private re /** * {@inheritdoc} */ - public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass = null, Operation $operation = null, array $context = []): void + public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): void { if (null === $resourceClass) { throw new InvalidArgumentException('The "$resourceClass" parameter must not be null'); diff --git a/src/Doctrine/Orm/Extension/FilterExtension.php b/src/Doctrine/Orm/Extension/FilterExtension.php index 551a405a616..298eff2905a 100644 --- a/src/Doctrine/Orm/Extension/FilterExtension.php +++ b/src/Doctrine/Orm/Extension/FilterExtension.php @@ -36,7 +36,7 @@ public function __construct(private readonly ContainerInterface $filterLocator) /** * {@inheritdoc} */ - public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass = null, Operation $operation = null, array $context = []): void + public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): void { if (null === $resourceClass) { throw new InvalidArgumentException('The "$resourceClass" parameter must not be null'); diff --git a/src/Doctrine/Orm/Extension/OrderExtension.php b/src/Doctrine/Orm/Extension/OrderExtension.php index 65c7034e50b..a3833837f58 100644 --- a/src/Doctrine/Orm/Extension/OrderExtension.php +++ b/src/Doctrine/Orm/Extension/OrderExtension.php @@ -35,7 +35,7 @@ public function __construct(private readonly ?string $order = null) /** * {@inheritdoc} */ - public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass = null, Operation $operation = null, array $context = []): void + public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): void { if (null === $resourceClass) { throw new InvalidArgumentException('The "$resourceClass" parameter must not be null'); diff --git a/src/Doctrine/Orm/Extension/PaginationExtension.php b/src/Doctrine/Orm/Extension/PaginationExtension.php index b23285f4307..80513e45b49 100644 --- a/src/Doctrine/Orm/Extension/PaginationExtension.php +++ b/src/Doctrine/Orm/Extension/PaginationExtension.php @@ -43,7 +43,7 @@ public function __construct(private readonly ManagerRegistry $managerRegistry, p /** * {@inheritdoc} */ - public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if (null === $pagination = $this->getPagination($queryBuilder, $operation, $context)) { return; @@ -59,7 +59,7 @@ public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGenerator /** * {@inheritdoc} */ - public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool + public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool { if ($context['graphql_operation_name'] ?? false) { return $this->pagination->isGraphQlEnabled($operation, $context); @@ -71,7 +71,7 @@ public function supportsResult(string $resourceClass, Operation $operation = nul /** * {@inheritdoc} */ - public function getResult(QueryBuilder $queryBuilder, string $resourceClass = null, Operation $operation = null, array $context = []): iterable + public function getResult(QueryBuilder $queryBuilder, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): iterable { $query = $queryBuilder->getQuery(); @@ -125,7 +125,7 @@ private function addCountToContext(QueryBuilder $queryBuilder, array $context): /** * Determines the value of the $fetchJoinCollection argument passed to the Doctrine ORM Paginator. */ - private function shouldDoctrinePaginatorFetchJoinCollection(QueryBuilder $queryBuilder, Operation $operation = null, array $context = []): bool + private function shouldDoctrinePaginatorFetchJoinCollection(QueryBuilder $queryBuilder, ?Operation $operation = null, array $context = []): bool { $fetchJoinCollection = $operation?->getPaginationFetchJoinCollection(); @@ -158,7 +158,7 @@ private function shouldDoctrinePaginatorFetchJoinCollection(QueryBuilder $queryB /** * Determines whether the Doctrine ORM Paginator should use output walkers. */ - private function shouldDoctrinePaginatorUseOutputWalkers(QueryBuilder $queryBuilder, Operation $operation = null, array $context = []): bool + private function shouldDoctrinePaginatorUseOutputWalkers(QueryBuilder $queryBuilder, ?Operation $operation = null, array $context = []): bool { $useOutputWalkers = $operation?->getPaginationUseOutputWalkers(); diff --git a/src/Doctrine/Orm/Extension/QueryCollectionExtensionInterface.php b/src/Doctrine/Orm/Extension/QueryCollectionExtensionInterface.php index cb386135ea3..191c2ac1a61 100644 --- a/src/Doctrine/Orm/Extension/QueryCollectionExtensionInterface.php +++ b/src/Doctrine/Orm/Extension/QueryCollectionExtensionInterface.php @@ -25,5 +25,5 @@ */ interface QueryCollectionExtensionInterface { - public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void; + public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void; } diff --git a/src/Doctrine/Orm/Extension/QueryItemExtensionInterface.php b/src/Doctrine/Orm/Extension/QueryItemExtensionInterface.php index f337ebc4762..4d7aaed0a69 100644 --- a/src/Doctrine/Orm/Extension/QueryItemExtensionInterface.php +++ b/src/Doctrine/Orm/Extension/QueryItemExtensionInterface.php @@ -25,5 +25,5 @@ */ interface QueryItemExtensionInterface { - public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, Operation $operation = null, array $context = []): void; + public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?Operation $operation = null, array $context = []): void; } diff --git a/src/Doctrine/Orm/Extension/QueryResultCollectionExtensionInterface.php b/src/Doctrine/Orm/Extension/QueryResultCollectionExtensionInterface.php index 7f74cacdd6b..fe996d29d5b 100644 --- a/src/Doctrine/Orm/Extension/QueryResultCollectionExtensionInterface.php +++ b/src/Doctrine/Orm/Extension/QueryResultCollectionExtensionInterface.php @@ -27,7 +27,7 @@ */ interface QueryResultCollectionExtensionInterface extends QueryCollectionExtensionInterface { - public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool; + public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool; - public function getResult(QueryBuilder $queryBuilder, string $resourceClass = null, Operation $operation = null, array $context = []): iterable; + public function getResult(QueryBuilder $queryBuilder, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): iterable; } diff --git a/src/Doctrine/Orm/Extension/QueryResultItemExtensionInterface.php b/src/Doctrine/Orm/Extension/QueryResultItemExtensionInterface.php index 7cc513ed7fc..4c23d77522b 100644 --- a/src/Doctrine/Orm/Extension/QueryResultItemExtensionInterface.php +++ b/src/Doctrine/Orm/Extension/QueryResultItemExtensionInterface.php @@ -26,7 +26,7 @@ */ interface QueryResultItemExtensionInterface extends QueryItemExtensionInterface { - public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool; + public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool; - public function getResult(QueryBuilder $queryBuilder, string $resourceClass = null, Operation $operation = null, array $context = []): ?object; + public function getResult(QueryBuilder $queryBuilder, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): ?object; } diff --git a/src/Doctrine/Orm/Filter/AbstractFilter.php b/src/Doctrine/Orm/Filter/AbstractFilter.php index d2b2b5d1916..c1deb1c0a90 100644 --- a/src/Doctrine/Orm/Filter/AbstractFilter.php +++ b/src/Doctrine/Orm/Filter/AbstractFilter.php @@ -29,7 +29,7 @@ abstract class AbstractFilter implements FilterInterface use PropertyHelperTrait; protected LoggerInterface $logger; - public function __construct(protected ManagerRegistry $managerRegistry, LoggerInterface $logger = null, protected ?array $properties = null, protected ?NameConverterInterface $nameConverter = null) + public function __construct(protected ManagerRegistry $managerRegistry, ?LoggerInterface $logger = null, protected ?array $properties = null, protected ?NameConverterInterface $nameConverter = null) { $this->logger = $logger ?? new NullLogger(); } @@ -37,7 +37,7 @@ public function __construct(protected ManagerRegistry $managerRegistry, LoggerIn /** * {@inheritdoc} */ - public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { foreach ($context['filters'] as $property => $value) { $this->filterProperty($this->denormalizePropertyName($property), $value, $queryBuilder, $queryNameGenerator, $resourceClass, $operation, $context); @@ -47,7 +47,7 @@ public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $q /** * Passes a property through the filter. */ - abstract protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void; + abstract protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void; protected function getManagerRegistry(): ManagerRegistry { diff --git a/src/Doctrine/Orm/Filter/BooleanFilter.php b/src/Doctrine/Orm/Filter/BooleanFilter.php index cb040c49a42..2f230c465dd 100644 --- a/src/Doctrine/Orm/Filter/BooleanFilter.php +++ b/src/Doctrine/Orm/Filter/BooleanFilter.php @@ -117,7 +117,7 @@ final class BooleanFilter extends AbstractFilter /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if ( !$this->isPropertyEnabled($property, $resourceClass) diff --git a/src/Doctrine/Orm/Filter/DateFilter.php b/src/Doctrine/Orm/Filter/DateFilter.php index d895cc68cbc..6cbd8d24248 100644 --- a/src/Doctrine/Orm/Filter/DateFilter.php +++ b/src/Doctrine/Orm/Filter/DateFilter.php @@ -138,7 +138,7 @@ final class DateFilter extends AbstractFilter implements DateFilterInterface /** * {@inheritdoc} */ - protected function filterProperty(string $property, $values, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $values, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { // Expect $values to be an array having the period as keys and the date value as values if ( @@ -220,7 +220,7 @@ protected function filterProperty(string $property, $values, QueryBuilder $query /** * Adds the where clause according to the chosen null management. */ - protected function addWhere(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, string $operator, mixed $value, string $nullManagement = null, DBALType|string $type = null): void + protected function addWhere(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, string $operator, mixed $value, ?string $nullManagement = null, DBALType|string|null $type = null): void { $type = (string) $type; $value = $this->normalizeValue($value, $operator); diff --git a/src/Doctrine/Orm/Filter/ExistsFilter.php b/src/Doctrine/Orm/Filter/ExistsFilter.php index f7f2cbab842..db0db4b3ec8 100644 --- a/src/Doctrine/Orm/Filter/ExistsFilter.php +++ b/src/Doctrine/Orm/Filter/ExistsFilter.php @@ -114,7 +114,7 @@ final class ExistsFilter extends AbstractFilter implements ExistsFilterInterface { use ExistsFilterTrait; - public function __construct(ManagerRegistry $managerRegistry, LoggerInterface $logger = null, array $properties = null, string $existsParameterName = self::QUERY_PARAMETER_KEY, NameConverterInterface $nameConverter = null) + public function __construct(ManagerRegistry $managerRegistry, ?LoggerInterface $logger = null, ?array $properties = null, string $existsParameterName = self::QUERY_PARAMETER_KEY, ?NameConverterInterface $nameConverter = null) { parent::__construct($managerRegistry, $logger, $properties, $nameConverter); @@ -124,7 +124,7 @@ public function __construct(ManagerRegistry $managerRegistry, LoggerInterface $l /** * {@inheritdoc} */ - public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { foreach ($context['filters'][$this->existsParameterName] ?? [] as $property => $value) { $this->filterProperty($this->denormalizePropertyName($property), $value, $queryBuilder, $queryNameGenerator, $resourceClass, $operation, $context); @@ -134,7 +134,7 @@ public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $q /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if ( !$this->isPropertyEnabled($property, $resourceClass) diff --git a/src/Doctrine/Orm/Filter/FilterInterface.php b/src/Doctrine/Orm/Filter/FilterInterface.php index 50e02b12f71..4cfa337dfb6 100644 --- a/src/Doctrine/Orm/Filter/FilterInterface.php +++ b/src/Doctrine/Orm/Filter/FilterInterface.php @@ -28,5 +28,5 @@ interface FilterInterface extends BaseFilterInterface /** * Applies the filter. */ - public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void; + public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void; } diff --git a/src/Doctrine/Orm/Filter/NumericFilter.php b/src/Doctrine/Orm/Filter/NumericFilter.php index bbcd1d67a0f..c27e3f648a4 100644 --- a/src/Doctrine/Orm/Filter/NumericFilter.php +++ b/src/Doctrine/Orm/Filter/NumericFilter.php @@ -126,7 +126,7 @@ final class NumericFilter extends AbstractFilter /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if ( !$this->isPropertyEnabled($property, $resourceClass) @@ -164,7 +164,7 @@ protected function filterProperty(string $property, $value, QueryBuilder $queryB /** * {@inheritdoc} */ - protected function getType(string $doctrineType = null): string + protected function getType(?string $doctrineType = null): string { if (null === $doctrineType || Types::DECIMAL === $doctrineType) { return 'string'; diff --git a/src/Doctrine/Orm/Filter/OrderFilter.php b/src/Doctrine/Orm/Filter/OrderFilter.php index abece578049..bf40b54e614 100644 --- a/src/Doctrine/Orm/Filter/OrderFilter.php +++ b/src/Doctrine/Orm/Filter/OrderFilter.php @@ -197,7 +197,7 @@ final class OrderFilter extends AbstractFilter implements OrderFilterInterface { use OrderFilterTrait; - public function __construct(ManagerRegistry $managerRegistry, string $orderParameterName = 'order', LoggerInterface $logger = null, array $properties = null, NameConverterInterface $nameConverter = null, private readonly ?string $orderNullsComparison = null) + public function __construct(ManagerRegistry $managerRegistry, string $orderParameterName = 'order', ?LoggerInterface $logger = null, ?array $properties = null, ?NameConverterInterface $nameConverter = null, private readonly ?string $orderNullsComparison = null) { if (null !== $properties) { $properties = array_map(static function ($propertyOptions) { @@ -220,7 +220,7 @@ public function __construct(ManagerRegistry $managerRegistry, string $orderParam /** * {@inheritdoc} */ - public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if (isset($context['filters']) && !isset($context['filters'][$this->orderParameterName])) { return; @@ -240,7 +240,7 @@ public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $q /** * {@inheritdoc} */ - protected function filterProperty(string $property, $direction, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $direction, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if (!$this->isPropertyEnabled($property, $resourceClass) || !$this->isPropertyMapped($property, $resourceClass)) { return; diff --git a/src/Doctrine/Orm/Filter/RangeFilter.php b/src/Doctrine/Orm/Filter/RangeFilter.php index c2e0aaf4051..70c3e6867d0 100644 --- a/src/Doctrine/Orm/Filter/RangeFilter.php +++ b/src/Doctrine/Orm/Filter/RangeFilter.php @@ -112,7 +112,7 @@ final class RangeFilter extends AbstractFilter implements RangeFilterInterface /** * {@inheritdoc} */ - protected function filterProperty(string $property, $values, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $values, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if ( !\is_array($values) diff --git a/src/Doctrine/Orm/Filter/SearchFilter.php b/src/Doctrine/Orm/Filter/SearchFilter.php index 0ea085811d7..7fecabb7ddb 100644 --- a/src/Doctrine/Orm/Filter/SearchFilter.php +++ b/src/Doctrine/Orm/Filter/SearchFilter.php @@ -141,7 +141,7 @@ final class SearchFilter extends AbstractFilter implements SearchFilterInterface public const DOCTRINE_INTEGER_TYPE = Types::INTEGER; - public function __construct(ManagerRegistry $managerRegistry, IriConverterInterface|LegacyIriConverterInterface $iriConverter, PropertyAccessorInterface $propertyAccessor = null, LoggerInterface $logger = null, array $properties = null, IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface $identifiersExtractor = null, NameConverterInterface $nameConverter = null) + public function __construct(ManagerRegistry $managerRegistry, IriConverterInterface|LegacyIriConverterInterface $iriConverter, ?PropertyAccessorInterface $propertyAccessor = null, ?LoggerInterface $logger = null, ?array $properties = null, IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface|null $identifiersExtractor = null, ?NameConverterInterface $nameConverter = null) { parent::__construct($managerRegistry, $logger, $properties, $nameConverter); @@ -163,7 +163,7 @@ protected function getPropertyAccessor(): PropertyAccessorInterface /** * {@inheritdoc} */ - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if ( null === $value diff --git a/src/Doctrine/Orm/State/CollectionProvider.php b/src/Doctrine/Orm/State/CollectionProvider.php index 7534f7e572d..6078b800fbc 100644 --- a/src/Doctrine/Orm/State/CollectionProvider.php +++ b/src/Doctrine/Orm/State/CollectionProvider.php @@ -37,7 +37,7 @@ final class CollectionProvider implements ProviderInterface /** * @param QueryCollectionExtensionInterface[] $collectionExtensions */ - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $collectionExtensions = [], ContainerInterface $handleLinksLocator = null) + public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $collectionExtensions = [], ?ContainerInterface $handleLinksLocator = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; $this->handleLinksLocator = $handleLinksLocator; diff --git a/src/Doctrine/Orm/State/ItemProvider.php b/src/Doctrine/Orm/State/ItemProvider.php index eccc400564a..7ad57d81cd9 100644 --- a/src/Doctrine/Orm/State/ItemProvider.php +++ b/src/Doctrine/Orm/State/ItemProvider.php @@ -37,7 +37,7 @@ final class ItemProvider implements ProviderInterface /** * @param QueryItemExtensionInterface[] $itemExtensions */ - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $itemExtensions = [], ContainerInterface $handleLinksLocator = null) + public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ManagerRegistry $managerRegistry, private readonly iterable $itemExtensions = [], ?ContainerInterface $handleLinksLocator = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; $this->handleLinksLocator = $handleLinksLocator; diff --git a/src/Doctrine/Orm/Util/QueryBuilderHelper.php b/src/Doctrine/Orm/Util/QueryBuilderHelper.php index 38f33864336..7814f988d6d 100644 --- a/src/Doctrine/Orm/Util/QueryBuilderHelper.php +++ b/src/Doctrine/Orm/Util/QueryBuilderHelper.php @@ -31,7 +31,7 @@ private function __construct() /** * Adds a join to the QueryBuilder if none exists. */ - public static function addJoinOnce(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $association, string $joinType = null, string $conditionType = null, string $condition = null, string $originAlias = null, string $newAlias = null): string + public static function addJoinOnce(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $association, ?string $joinType = null, ?string $conditionType = null, ?string $condition = null, ?string $originAlias = null, ?string $newAlias = null): string { $join = self::getExistingJoin($queryBuilder, $alias, $association, $originAlias); @@ -160,7 +160,7 @@ public static function traverseJoins(string $alias, QueryBuilder $queryBuilder, /** * Gets the existing join from QueryBuilder DQL parts. */ - public static function getExistingJoin(QueryBuilder $queryBuilder, string $alias, string $association, string $originAlias = null): ?Join + public static function getExistingJoin(QueryBuilder $queryBuilder, string $alias, string $association, ?string $originAlias = null): ?Join { $parts = $queryBuilder->getDQLPart('join'); $rootAlias = $originAlias ?? $queryBuilder->getRootAliases()[0]; diff --git a/src/Documentation/Action/DocumentationAction.php b/src/Documentation/Action/DocumentationAction.php index 9ca5c2ddb94..5a3a51f24ee 100644 --- a/src/Documentation/Action/DocumentationAction.php +++ b/src/Documentation/Action/DocumentationAction.php @@ -46,7 +46,7 @@ public function __construct( private readonly ?OpenApiFactoryInterface $openApiFactory = null, private readonly ?ProviderInterface $provider = null, private readonly ?ProcessorInterface $processor = null, - Negotiator $negotiator = null, + ?Negotiator $negotiator = null, private readonly array $documentationFormats = [OpenApiNormalizer::JSON_FORMAT => ['application/vnd.openapi+json'], OpenApiNormalizer::FORMAT => ['application/json']] ) { $this->negotiator = $negotiator ?? new Negotiator(); @@ -55,7 +55,7 @@ public function __construct( /** * @return DocumentationInterface|OpenApi|Response */ - public function __invoke(Request $request = null) + public function __invoke(?Request $request = null) { if (null === $request) { return new Documentation($this->resourceNameCollectionFactory->create(), $this->title, $this->description, $this->version); diff --git a/src/Elasticsearch/Extension/AbstractFilterExtension.php b/src/Elasticsearch/Extension/AbstractFilterExtension.php index da7aca2068d..13e82800882 100644 --- a/src/Elasticsearch/Extension/AbstractFilterExtension.php +++ b/src/Elasticsearch/Extension/AbstractFilterExtension.php @@ -32,7 +32,7 @@ public function __construct(private readonly ContainerInterface $filterLocator) /** * {@inheritdoc} */ - public function applyToCollection(array $requestBody, string $resourceClass, Operation $operation = null, array $context = []): array + public function applyToCollection(array $requestBody, string $resourceClass, ?Operation $operation = null, array $context = []): array { $resourceFilters = $operation?->getFilters(); diff --git a/src/Elasticsearch/Extension/RequestBodySearchCollectionExtensionInterface.php b/src/Elasticsearch/Extension/RequestBodySearchCollectionExtensionInterface.php index 34ca405ac24..3e9ece3fc49 100644 --- a/src/Elasticsearch/Extension/RequestBodySearchCollectionExtensionInterface.php +++ b/src/Elasticsearch/Extension/RequestBodySearchCollectionExtensionInterface.php @@ -26,5 +26,5 @@ */ interface RequestBodySearchCollectionExtensionInterface { - public function applyToCollection(array $requestBody, string $resourceClass, Operation $operation = null, array $context = []): array; + public function applyToCollection(array $requestBody, string $resourceClass, ?Operation $operation = null, array $context = []): array; } diff --git a/src/Elasticsearch/Extension/SortExtension.php b/src/Elasticsearch/Extension/SortExtension.php index 02c6358358b..013d269ca48 100644 --- a/src/Elasticsearch/Extension/SortExtension.php +++ b/src/Elasticsearch/Extension/SortExtension.php @@ -42,7 +42,7 @@ public function __construct(PropertyMetadataFactoryInterface $propertyMetadataFa /** * {@inheritdoc} */ - public function applyToCollection(array $requestBody, string $resourceClass, Operation $operation = null, array $context = []): array + public function applyToCollection(array $requestBody, string $resourceClass, ?Operation $operation = null, array $context = []): array { $orders = []; diff --git a/src/Elasticsearch/Filter/AbstractSearchFilter.php b/src/Elasticsearch/Filter/AbstractSearchFilter.php index ed94729fc0f..318289dd697 100644 --- a/src/Elasticsearch/Filter/AbstractSearchFilter.php +++ b/src/Elasticsearch/Filter/AbstractSearchFilter.php @@ -35,12 +35,12 @@ */ abstract class AbstractSearchFilter extends AbstractFilter implements ConstantScoreFilterInterface { - public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, protected IriConverterInterface $iriConverter, protected PropertyAccessorInterface $propertyAccessor, NameConverterInterface $nameConverter = null, array $properties = null) + public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, protected IriConverterInterface $iriConverter, protected PropertyAccessorInterface $propertyAccessor, ?NameConverterInterface $nameConverter = null, ?array $properties = null) { parent::__construct($propertyNameCollectionFactory, $propertyMetadataFactory, $resourceClassResolver, $nameConverter, $properties); } - public function apply(array $clauseBody, string $resourceClass, Operation $operation = null, array $context = []): array + public function apply(array $clauseBody, string $resourceClass, ?Operation $operation = null, array $context = []): array { $searches = []; @@ -135,7 +135,7 @@ protected function getPhpType(Type $type): string /** * Is the given property of the given resource class an identifier? */ - protected function isIdentifier(string $resourceClass, string $property, Operation $operation = null): bool + protected function isIdentifier(string $resourceClass, string $property, ?Operation $operation = null): bool { $identifier = 'id'; if ($operation instanceof HttpOperation) { diff --git a/src/Elasticsearch/Filter/FilterInterface.php b/src/Elasticsearch/Filter/FilterInterface.php index 2a248a19448..7eda4bac771 100644 --- a/src/Elasticsearch/Filter/FilterInterface.php +++ b/src/Elasticsearch/Filter/FilterInterface.php @@ -25,5 +25,5 @@ */ interface FilterInterface extends BaseFilterInterface { - public function apply(array $clauseBody, string $resourceClass, Operation $operation = null, array $context = []): array; + public function apply(array $clauseBody, string $resourceClass, ?Operation $operation = null, array $context = []): array; } diff --git a/src/Elasticsearch/Filter/OrderFilter.php b/src/Elasticsearch/Filter/OrderFilter.php index b05599bfca9..481de5a1fd0 100644 --- a/src/Elasticsearch/Filter/OrderFilter.php +++ b/src/Elasticsearch/Filter/OrderFilter.php @@ -114,7 +114,7 @@ final class OrderFilter extends AbstractFilter implements SortFilterInterface /** * {@inheritdoc} */ - public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, NameConverterInterface $nameConverter = null, private readonly string $orderParameterName = 'order', array $properties = null) + public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, ?NameConverterInterface $nameConverter = null, private readonly string $orderParameterName = 'order', ?array $properties = null) { parent::__construct($propertyNameCollectionFactory, $propertyMetadataFactory, $resourceClassResolver, $nameConverter, $properties); } @@ -122,7 +122,7 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName /** * {@inheritdoc} */ - public function apply(array $clauseBody, string $resourceClass, Operation $operation = null, array $context = []): array + public function apply(array $clauseBody, string $resourceClass, ?Operation $operation = null, array $context = []): array { if (!\is_array($properties = $context['filters'][$this->orderParameterName] ?? [])) { return $clauseBody; diff --git a/src/Elasticsearch/Serializer/DocumentNormalizer.php b/src/Elasticsearch/Serializer/DocumentNormalizer.php index 02aa74c3739..0ab75a6e18a 100644 --- a/src/Elasticsearch/Serializer/DocumentNormalizer.php +++ b/src/Elasticsearch/Serializer/DocumentNormalizer.php @@ -42,12 +42,12 @@ final class DocumentNormalizer implements NormalizerInterface, DenormalizerInter public function __construct( private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, - ClassMetadataFactoryInterface $classMetadataFactory = null, + ?ClassMetadataFactoryInterface $classMetadataFactory = null, private readonly ?NameConverterInterface $nameConverter = null, - PropertyAccessorInterface $propertyAccessor = null, - PropertyTypeExtractorInterface $propertyTypeExtractor = null, - ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, - callable $objectClassResolver = null, + ?PropertyAccessorInterface $propertyAccessor = null, + ?PropertyTypeExtractorInterface $propertyTypeExtractor = null, + ?ClassDiscriminatorResolverInterface $classDiscriminatorResolver = null, + ?callable $objectClassResolver = null, array $defaultContext = [], ) { $this->decoratedNormalizer = new ObjectNormalizer($classMetadataFactory, $nameConverter, $propertyAccessor, $propertyTypeExtractor, $classDiscriminatorResolver, $objectClassResolver, $defaultContext); @@ -56,7 +56,7 @@ public function __construct( /** * {@inheritdoc} */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && $this->decoratedNormalizer->supportsDenormalization($data, $type, $format, $context); } @@ -64,7 +64,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma /** * {@inheritdoc} */ - public function denormalize(mixed $data, string $class, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $class, ?string $format = null, array $context = []): mixed { if (\is_string($data['_id'] ?? null) && \is_array($data['_source'] ?? null)) { $data = $this->populateIdentifier($data, $class)['_source']; @@ -76,7 +76,7 @@ public function denormalize(mixed $data, string $class, string $format = null, a /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { // prevent the use of lower priority normalizers (e.g. serializer.normalizer.object) for this format return self::FORMAT === $format; @@ -87,7 +87,7 @@ public function supportsNormalization(mixed $data, string $format = null, array * * @throws LogicException */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { throw new LogicException(sprintf('%s is a write-only format.', self::FORMAT)); } diff --git a/src/Elasticsearch/Serializer/ItemNormalizer.php b/src/Elasticsearch/Serializer/ItemNormalizer.php index efc8cfe4f78..fa0289c1483 100644 --- a/src/Elasticsearch/Serializer/ItemNormalizer.php +++ b/src/Elasticsearch/Serializer/ItemNormalizer.php @@ -62,7 +62,7 @@ public function hasCacheableSupportsMethod(): bool * * @throws LogicException */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { if (!$this->decorated instanceof DenormalizerInterface) { throw new LogicException(sprintf('The decorated normalizer must be an instance of "%s".', DenormalizerInterface::class)); @@ -76,7 +76,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar * * @throws LogicException */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { if (!$this->decorated instanceof DenormalizerInterface) { throw new LogicException(sprintf('The decorated normalizer must be an instance of "%s".', DenormalizerInterface::class)); @@ -88,7 +88,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { return $this->decorated->normalize($object, $format, $context); } @@ -96,7 +96,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return DocumentNormalizer::FORMAT !== $format && $this->decorated->supportsNormalization($data, $format); } diff --git a/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php b/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php index 20df1dd28ba..c55943d0054 100644 --- a/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php +++ b/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php @@ -33,7 +33,7 @@ public function __construct(private readonly NameConverterInterface $inner = new /** * {@inheritdoc} */ - public function normalize(string $propertyName, string $class = null, string $format = null, array $context = []): string + public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { return $this->convertInnerFields($propertyName, true, $class, $format, $context); } @@ -41,12 +41,12 @@ public function normalize(string $propertyName, string $class = null, string $fo /** * {@inheritdoc} */ - public function denormalize(string $propertyName, string $class = null, string $format = null, array $context = []): string + public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { return $this->convertInnerFields($propertyName, false, $class, $format, $context); } - private function convertInnerFields(string $propertyName, bool $normalization, string $class = null, string $format = null, array $context = []): string + private function convertInnerFields(string $propertyName, bool $normalization, ?string $class = null, ?string $format = null, array $context = []): string { $convertedProperties = []; diff --git a/src/Elasticsearch/Tests/Serializer/ItemNormalizerTest.php b/src/Elasticsearch/Tests/Serializer/ItemNormalizerTest.php index 7a59ea6dda8..24abcb49040 100644 --- a/src/Elasticsearch/Tests/Serializer/ItemNormalizerTest.php +++ b/src/Elasticsearch/Tests/Serializer/ItemNormalizerTest.php @@ -150,12 +150,12 @@ public function testGetSupportedTypes(): void // TODO: use prophecy when getSupportedTypes() will be added to the interface $this->itemNormalizer = new ItemNormalizer(new class() implements NormalizerInterface { - public function normalize(mixed $object, string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null + public function normalize(mixed $object, ?string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null { return null; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return true; } diff --git a/src/Exception/FilterValidationException.php b/src/Exception/FilterValidationException.php index 784e005a3a1..d2454161a61 100644 --- a/src/Exception/FilterValidationException.php +++ b/src/Exception/FilterValidationException.php @@ -20,7 +20,7 @@ */ final class FilterValidationException extends \Exception implements ExceptionInterface, \Stringable { - public function __construct(private readonly array $constraintViolationList, string $message = '', int $code = 0, \Exception $previous = null) + public function __construct(private readonly array $constraintViolationList, string $message = '', int $code = 0, ?\Exception $previous = null) { parent::__construct($message ?: $this->__toString(), $code, $previous); } diff --git a/src/GraphQl/Action/EntrypointAction.php b/src/GraphQl/Action/EntrypointAction.php index 1a2ece85578..69c46710fa8 100644 --- a/src/GraphQl/Action/EntrypointAction.php +++ b/src/GraphQl/Action/EntrypointAction.php @@ -48,7 +48,7 @@ public function __construct( private readonly bool $graphiqlEnabled = false, private readonly bool $graphQlPlaygroundEnabled = false, private readonly ?string $defaultIde = null, - Negotiator $negotiator = null + ?Negotiator $negotiator = null ) { $this->debug = $debug ? DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE : DebugFlag::NONE; $this->negotiator = $negotiator ?? new Negotiator(); diff --git a/src/GraphQl/Executor.php b/src/GraphQl/Executor.php index 701ba59244a..5c2ecddf7f1 100644 --- a/src/GraphQl/Executor.php +++ b/src/GraphQl/Executor.php @@ -38,7 +38,7 @@ public function __construct(private readonly bool $graphQlIntrospectionEnabled = /** * {@inheritdoc} */ - public function executeQuery(Schema $schema, $source, mixed $rootValue = null, mixed $context = null, array $variableValues = null, string $operationName = null, callable $fieldResolver = null, array $validationRules = null): ExecutionResult + public function executeQuery(Schema $schema, $source, mixed $rootValue = null, mixed $context = null, ?array $variableValues = null, ?string $operationName = null, ?callable $fieldResolver = null, ?array $validationRules = null): ExecutionResult { return GraphQL::executeQuery($schema, $source, $rootValue, $context, $variableValues, $operationName, $fieldResolver, $validationRules); } diff --git a/src/GraphQl/ExecutorInterface.php b/src/GraphQl/ExecutorInterface.php index 4c39bff1a75..fafc326ee6f 100644 --- a/src/GraphQl/ExecutorInterface.php +++ b/src/GraphQl/ExecutorInterface.php @@ -26,5 +26,5 @@ interface ExecutorInterface /** * @see http://webonyx.github.io/graphql-php/executing-queries/#using-facade-method */ - public function executeQuery(Schema $schema, $source, mixed $rootValue = null, mixed $context = null, array $variableValues = null, string $operationName = null, callable $fieldResolver = null, array $validationRules = null): ExecutionResult; + public function executeQuery(Schema $schema, $source, mixed $rootValue = null, mixed $context = null, ?array $variableValues = null, ?string $operationName = null, ?callable $fieldResolver = null, ?array $validationRules = null): ExecutionResult; } diff --git a/src/GraphQl/Resolver/Factory/CollectionResolverFactory.php b/src/GraphQl/Resolver/Factory/CollectionResolverFactory.php index 6cbac320d6c..b7fbd79845b 100644 --- a/src/GraphQl/Resolver/Factory/CollectionResolverFactory.php +++ b/src/GraphQl/Resolver/Factory/CollectionResolverFactory.php @@ -38,7 +38,7 @@ public function __construct(private readonly ReadStageInterface $readStage, priv { } - public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable + public function __invoke(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null): callable { return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operation): ?array { // If authorization has failed for a relation field (e.g. via ApiProperty security), the field is not present in the source: null can be returned directly to ensure the collection isn't in the response. diff --git a/src/GraphQl/Resolver/Factory/ItemMutationResolverFactory.php b/src/GraphQl/Resolver/Factory/ItemMutationResolverFactory.php index 7a17ecf1e18..999ea9a51ae 100644 --- a/src/GraphQl/Resolver/Factory/ItemMutationResolverFactory.php +++ b/src/GraphQl/Resolver/Factory/ItemMutationResolverFactory.php @@ -44,7 +44,7 @@ public function __construct(private readonly ReadStageInterface $readStage, priv { } - public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable + public function __invoke(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null): callable { return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operation): ?array { if (null === $resourceClass || null === $operation) { diff --git a/src/GraphQl/Resolver/Factory/ItemResolverFactory.php b/src/GraphQl/Resolver/Factory/ItemResolverFactory.php index 28169adb6ff..a1652b9bca7 100644 --- a/src/GraphQl/Resolver/Factory/ItemResolverFactory.php +++ b/src/GraphQl/Resolver/Factory/ItemResolverFactory.php @@ -41,7 +41,7 @@ public function __construct(private readonly ReadStageInterface $readStage, priv { } - public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable + public function __invoke(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null): callable { return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operation) { // Data already fetched and normalized (field or nested resource) diff --git a/src/GraphQl/Resolver/Factory/ItemSubscriptionResolverFactory.php b/src/GraphQl/Resolver/Factory/ItemSubscriptionResolverFactory.php index 2ad3f898ec0..0335a6ac232 100644 --- a/src/GraphQl/Resolver/Factory/ItemSubscriptionResolverFactory.php +++ b/src/GraphQl/Resolver/Factory/ItemSubscriptionResolverFactory.php @@ -37,7 +37,7 @@ public function __construct(private readonly ReadStageInterface $readStage, priv { } - public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable + public function __invoke(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null): callable { return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operation): ?array { if (null === $resourceClass || null === $operation) { diff --git a/src/GraphQl/Resolver/Factory/ResolverFactory.php b/src/GraphQl/Resolver/Factory/ResolverFactory.php index ba7dee32f67..2ddb2941836 100644 --- a/src/GraphQl/Resolver/Factory/ResolverFactory.php +++ b/src/GraphQl/Resolver/Factory/ResolverFactory.php @@ -28,7 +28,7 @@ public function __construct( ) { } - public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable + public function __invoke(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null): callable { return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operation) { // Data already fetched and normalized (field or nested resource) diff --git a/src/GraphQl/Resolver/Factory/ResolverFactoryInterface.php b/src/GraphQl/Resolver/Factory/ResolverFactoryInterface.php index c8074ac8bab..c65e8f16682 100644 --- a/src/GraphQl/Resolver/Factory/ResolverFactoryInterface.php +++ b/src/GraphQl/Resolver/Factory/ResolverFactoryInterface.php @@ -22,5 +22,5 @@ */ interface ResolverFactoryInterface { - public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable; + public function __invoke(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null): callable; } diff --git a/src/GraphQl/Serializer/Exception/ErrorNormalizer.php b/src/GraphQl/Serializer/Exception/ErrorNormalizer.php index 215b3cee685..ec9ecf772a8 100644 --- a/src/GraphQl/Serializer/Exception/ErrorNormalizer.php +++ b/src/GraphQl/Serializer/Exception/ErrorNormalizer.php @@ -27,7 +27,7 @@ final class ErrorNormalizer implements NormalizerInterface /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { return FormattedError::createFromException($object); } @@ -35,7 +35,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Error; } diff --git a/src/GraphQl/Serializer/Exception/HttpExceptionNormalizer.php b/src/GraphQl/Serializer/Exception/HttpExceptionNormalizer.php index 48c44035bd2..3f16e4ef46c 100644 --- a/src/GraphQl/Serializer/Exception/HttpExceptionNormalizer.php +++ b/src/GraphQl/Serializer/Exception/HttpExceptionNormalizer.php @@ -28,7 +28,7 @@ final class HttpExceptionNormalizer implements NormalizerInterface /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { /** @var HttpExceptionInterface */ $httpException = $object->getPrevious(); @@ -46,7 +46,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Error && $data->getPrevious() instanceof HttpExceptionInterface; } diff --git a/src/GraphQl/Serializer/Exception/RuntimeExceptionNormalizer.php b/src/GraphQl/Serializer/Exception/RuntimeExceptionNormalizer.php index 01cc7a1afaf..cf7e3a449f1 100644 --- a/src/GraphQl/Serializer/Exception/RuntimeExceptionNormalizer.php +++ b/src/GraphQl/Serializer/Exception/RuntimeExceptionNormalizer.php @@ -27,7 +27,7 @@ final class RuntimeExceptionNormalizer implements NormalizerInterface /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { /** @var \RuntimeException */ $runtimeException = $object->getPrevious(); @@ -40,7 +40,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Error && $data->getPrevious() instanceof \RuntimeException; } diff --git a/src/GraphQl/Serializer/Exception/ValidationExceptionNormalizer.php b/src/GraphQl/Serializer/Exception/ValidationExceptionNormalizer.php index 95843d0aa50..0cf44f41f9a 100644 --- a/src/GraphQl/Serializer/Exception/ValidationExceptionNormalizer.php +++ b/src/GraphQl/Serializer/Exception/ValidationExceptionNormalizer.php @@ -35,7 +35,7 @@ public function __construct(private readonly array $exceptionToStatus = []) /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { /** @var ValidationException */ $validationException = $object->getPrevious(); @@ -73,7 +73,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Error && $data->getPrevious() instanceof ValidationException; } diff --git a/src/GraphQl/Serializer/ItemNormalizer.php b/src/GraphQl/Serializer/ItemNormalizer.php index 30e23d2d080..e8e6f2e77bb 100644 --- a/src/GraphQl/Serializer/ItemNormalizer.php +++ b/src/GraphQl/Serializer/ItemNormalizer.php @@ -47,7 +47,7 @@ final class ItemNormalizer extends BaseItemNormalizer private array $safeCacheKeysCache = []; - public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface $iriConverter, private readonly IdentifiersExtractorInterface $identifiersExtractor, ResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, LoggerInterface $logger = null, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, ResourceAccessCheckerInterface $resourceAccessChecker = null) + public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface $iriConverter, private readonly IdentifiersExtractorInterface $identifiersExtractor, ResourceClassResolverInterface $resourceClassResolver, ?PropertyAccessorInterface $propertyAccessor = null, ?NameConverterInterface $nameConverter = null, ?ClassMetadataFactoryInterface $classMetadataFactory = null, ?LoggerInterface $logger = null, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, ?ResourceAccessCheckerInterface $resourceAccessChecker = null) { parent::__construct($propertyNameCollectionFactory, $propertyMetadataFactory, $iriConverter, $resourceClassResolver, $propertyAccessor, $nameConverter, $classMetadataFactory, $logger ?: new NullLogger(), $resourceMetadataCollectionFactory, $resourceAccessChecker); } @@ -55,7 +55,7 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context); } @@ -72,7 +72,7 @@ public function getSupportedTypes($format): array * * @throws UnexpectedValueException */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $this->getObjectClass($object); @@ -117,7 +117,7 @@ protected function normalizeCollectionOfRelations(ApiProperty $propertyMetadata, /** * {@inheritdoc} */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format, $context); } diff --git a/src/GraphQl/Serializer/ObjectNormalizer.php b/src/GraphQl/Serializer/ObjectNormalizer.php index 3322f85c0b0..03f0272fb77 100644 --- a/src/GraphQl/Serializer/ObjectNormalizer.php +++ b/src/GraphQl/Serializer/ObjectNormalizer.php @@ -43,7 +43,7 @@ public function __construct(private readonly NormalizerInterface $decorated, pri /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context); } @@ -82,7 +82,7 @@ public function hasCacheableSupportsMethod(): bool * * @throws UnexpectedValueException */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { if (isset($context['api_resource'])) { $originalResource = $context['api_resource']; diff --git a/src/GraphQl/Subscription/MercureSubscriptionIriGenerator.php b/src/GraphQl/Subscription/MercureSubscriptionIriGenerator.php index 108c4382163..f7e3434f023 100644 --- a/src/GraphQl/Subscription/MercureSubscriptionIriGenerator.php +++ b/src/GraphQl/Subscription/MercureSubscriptionIriGenerator.php @@ -39,7 +39,7 @@ public function generateTopicIri(string $subscriptionId): string return "$scheme://$host/subscriptions/$subscriptionId"; } - public function generateMercureUrl(string $subscriptionId, string $hub = null): string + public function generateMercureUrl(string $subscriptionId, ?string $hub = null): string { return sprintf('%s?topic=%s', $this->registry->getHub($hub)->getUrl(), $this->generateTopicIri($subscriptionId)); } diff --git a/src/GraphQl/Subscription/MercureSubscriptionIriGeneratorInterface.php b/src/GraphQl/Subscription/MercureSubscriptionIriGeneratorInterface.php index 1068f94c386..903e8e6958c 100644 --- a/src/GraphQl/Subscription/MercureSubscriptionIriGeneratorInterface.php +++ b/src/GraphQl/Subscription/MercureSubscriptionIriGeneratorInterface.php @@ -22,5 +22,5 @@ interface MercureSubscriptionIriGeneratorInterface { public function generateTopicIri(string $subscriptionId): string; - public function generateMercureUrl(string $subscriptionId, string $hub = null): string; + public function generateMercureUrl(string $subscriptionId, ?string $hub = null): string; } diff --git a/src/GraphQl/Subscription/OperationAwareSubscriptionManagerInterface.php b/src/GraphQl/Subscription/OperationAwareSubscriptionManagerInterface.php index 5de5faedc77..621e304ebc0 100644 --- a/src/GraphQl/Subscription/OperationAwareSubscriptionManagerInterface.php +++ b/src/GraphQl/Subscription/OperationAwareSubscriptionManagerInterface.php @@ -22,5 +22,5 @@ */ interface OperationAwareSubscriptionManagerInterface extends SubscriptionManagerInterface { - public function retrieveSubscriptionId(array $context, ?array $result, Operation $operation = null): ?string; + public function retrieveSubscriptionId(array $context, ?array $result, ?Operation $operation = null): ?string; } diff --git a/src/GraphQl/Subscription/SubscriptionManager.php b/src/GraphQl/Subscription/SubscriptionManager.php index 126b188772b..2cd2c2c6873 100644 --- a/src/GraphQl/Subscription/SubscriptionManager.php +++ b/src/GraphQl/Subscription/SubscriptionManager.php @@ -41,7 +41,7 @@ public function __construct(private readonly CacheItemPoolInterface $subscriptio { } - public function retrieveSubscriptionId(array $context, ?array $result, Operation $operation = null): ?string + public function retrieveSubscriptionId(array $context, ?array $result, ?Operation $operation = null): ?string { /** @var ResolveInfo $info */ $info = $context['info']; diff --git a/src/GraphQl/Tests/Fixtures/ApiResource/Dummy.php b/src/GraphQl/Tests/Fixtures/ApiResource/Dummy.php index aac4550aac2..c90666c24f5 100644 --- a/src/GraphQl/Tests/Fixtures/ApiResource/Dummy.php +++ b/src/GraphQl/Tests/Fixtures/ApiResource/Dummy.php @@ -143,12 +143,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/src/GraphQl/Tests/Fixtures/Type/Definition/DateTimeType.php b/src/GraphQl/Tests/Fixtures/Type/Definition/DateTimeType.php index 2a0e475796b..2b6484b3e77 100644 --- a/src/GraphQl/Tests/Fixtures/Type/Definition/DateTimeType.php +++ b/src/GraphQl/Tests/Fixtures/Type/Definition/DateTimeType.php @@ -78,7 +78,7 @@ public function parseValue($value): string /** * {@inheritdoc} */ - public function parseLiteral(Node $valueNode, array $variables = null): string + public function parseLiteral(Node $valueNode, ?array $variables = null): string { if ($valueNode instanceof StringValueNode && false !== \DateTime::createFromFormat(\DateTime::ATOM, $valueNode->value)) { return $valueNode->value; diff --git a/src/GraphQl/Tests/Resolver/Factory/ResolverFactoryTest.php b/src/GraphQl/Tests/Resolver/Factory/ResolverFactoryTest.php index 7abacb5dafa..53874bc8889 100644 --- a/src/GraphQl/Tests/Resolver/Factory/ResolverFactoryTest.php +++ b/src/GraphQl/Tests/Resolver/Factory/ResolverFactoryTest.php @@ -27,7 +27,7 @@ class ResolverFactoryTest extends TestCase /** * @dataProvider graphQlQueries */ - public function testGraphQlResolver(string $resourceClass = null, string $rootClass = null, Operation $operation = null, Operation $providedOperation = null, Operation $processedOperation = null): void + public function testGraphQlResolver(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null, ?Operation $providedOperation = null, ?Operation $processedOperation = null): void { $returnValue = new \stdClass(); $body = new \stdClass(); diff --git a/src/GraphQl/Tests/Resolver/Stage/ReadStageTest.php b/src/GraphQl/Tests/Resolver/Stage/ReadStageTest.php index aa28e6aed75..40c6c37a03f 100644 --- a/src/GraphQl/Tests/Resolver/Stage/ReadStageTest.php +++ b/src/GraphQl/Tests/Resolver/Stage/ReadStageTest.php @@ -127,7 +127,7 @@ public static function itemProvider(): array /** * @dataProvider itemMutationOrSubscriptionProvider */ - public function testApplyMutationOrSubscription(bool $isMutation, bool $isSubscription, string $resourceClass, ?string $identifier, ?object $item, bool $throwNotFound, ?object $expectedResult, string $expectedExceptionClass = null, string $expectedExceptionMessage = null): void + public function testApplyMutationOrSubscription(bool $isMutation, bool $isSubscription, string $resourceClass, ?string $identifier, ?object $item, bool $throwNotFound, ?object $expectedResult, ?string $expectedExceptionClass = null, ?string $expectedExceptionMessage = null): void { $operationName = 'create'; $info = $this->prophesize(ResolveInfo::class)->reveal(); diff --git a/src/GraphQl/Tests/Resolver/Stage/SerializeStageTest.php b/src/GraphQl/Tests/Resolver/Stage/SerializeStageTest.php index 168123614f0..b7790daa0b1 100644 --- a/src/GraphQl/Tests/Resolver/Stage/SerializeStageTest.php +++ b/src/GraphQl/Tests/Resolver/Stage/SerializeStageTest.php @@ -127,7 +127,7 @@ public static function applyProvider(): iterable /** * @dataProvider applyCollectionWithPaginationProvider */ - public function testApplyCollectionWithPagination(iterable|callable $collection, array $args, ?array $expectedResult, bool $pageBasedPagination, array $getFieldSelection = [], string $expectedExceptionClass = null, string $expectedExceptionMessage = null): void + public function testApplyCollectionWithPagination(iterable|callable $collection, array $args, ?array $expectedResult, bool $pageBasedPagination, array $getFieldSelection = [], ?string $expectedExceptionClass = null, ?string $expectedExceptionMessage = null): void { $operationName = 'collection_query'; $resourceClass = 'myResource'; diff --git a/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php b/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php index 34b628a6208..32a6790b59d 100644 --- a/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php +++ b/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php @@ -42,12 +42,12 @@ protected function setUp(): void $this->serializerContextBuilder = $this->buildSerializerContextBuilder(); } - private function buildSerializerContextBuilder(AdvancedNameConverterInterface $advancedNameConverter = null): SerializerContextBuilder + private function buildSerializerContextBuilder(?AdvancedNameConverterInterface $advancedNameConverter = null): SerializerContextBuilder { return new SerializerContextBuilder($advancedNameConverter ?? new CustomConverter()); } - private function buildOperationFromContext(bool $isMutation, bool $isSubscription, array $expectedContext, bool $isNormalization = true, string $resourceClass = null): Operation + private function buildOperationFromContext(bool $isMutation, bool $isSubscription, array $expectedContext, bool $isNormalization = true, ?string $resourceClass = null): Operation { $operation = !$isMutation && !$isSubscription ? new Query() : new Mutation(); if ($isSubscription) { @@ -85,7 +85,7 @@ private function buildOperationFromContext(bool $isMutation, bool $isSubscriptio /** * @dataProvider createNormalizationContextProvider */ - public function testCreateNormalizationContext(?string $resourceClass, string $operationName, array $fields, bool $isMutation, bool $isSubscription, bool $noInfo, array $expectedContext, callable $advancedNameConverter = null, string $expectedExceptionClass = null, string $expectedExceptionMessage = null): void + public function testCreateNormalizationContext(?string $resourceClass, string $operationName, array $fields, bool $isMutation, bool $isSubscription, bool $noInfo, array $expectedContext, ?callable $advancedNameConverter = null, ?string $expectedExceptionClass = null, ?string $expectedExceptionMessage = null): void { $resolverContext = []; diff --git a/src/GraphQl/Tests/State/Processor/NormalizeProcessorTest.php b/src/GraphQl/Tests/State/Processor/NormalizeProcessorTest.php index 2ac140ead46..bc0a895a888 100644 --- a/src/GraphQl/Tests/State/Processor/NormalizeProcessorTest.php +++ b/src/GraphQl/Tests/State/Processor/NormalizeProcessorTest.php @@ -69,7 +69,7 @@ public function processItems(): array /** * @dataProvider processCollection */ - public function testProcessCollection($collection, $operation, $args, ?array $expectedResult, array $getFieldSelection, string $expectedExceptionClass = null, string $expectedExceptionMessage = null): void + public function testProcessCollection($collection, $operation, $args, ?array $expectedResult, array $getFieldSelection, ?string $expectedExceptionClass = null, ?string $expectedExceptionMessage = null): void { $this->resolveInfoProphecy->getFieldSelection(1)->willReturn($getFieldSelection); $context = ['args' => $args, 'info' => $this->resolveInfoProphecy->reveal()]; diff --git a/src/GraphQl/Tests/Type/FieldsBuilderTest.php b/src/GraphQl/Tests/Type/FieldsBuilderTest.php index af610ea05c4..603b77c2471 100644 --- a/src/GraphQl/Tests/Type/FieldsBuilderTest.php +++ b/src/GraphQl/Tests/Type/FieldsBuilderTest.php @@ -90,7 +90,7 @@ protected function setUp(): void $this->fieldsBuilder = $this->buildFieldsBuilder(); } - private function buildFieldsBuilder(AdvancedNameConverterInterface $advancedNameConverter = null): FieldsBuilder + private function buildFieldsBuilder(?AdvancedNameConverterInterface $advancedNameConverter = null): FieldsBuilder { return new FieldsBuilder($this->propertyNameCollectionFactoryProphecy->reveal(), $this->propertyMetadataFactoryProphecy->reveal(), $this->resourceMetadataCollectionFactoryProphecy->reveal(), $this->resourceClassResolverProphecy->reveal(), $this->typesContainerProphecy->reveal(), $this->typeBuilderProphecy->reveal(), $this->typeConverterProphecy->reveal(), $this->itemResolverFactoryProphecy->reveal(), $this->collectionResolverFactoryProphecy->reveal(), $this->itemMutationResolverFactoryProphecy->reveal(), $this->itemSubscriptionResolverFactoryProphecy->reveal(), $this->filterLocatorProphecy->reveal(), new Pagination(), $advancedNameConverter ?? new CustomConverter(), '__'); } @@ -483,7 +483,7 @@ public static function subscriptionFieldsProvider(): array /** * @dataProvider resourceObjectTypeFieldsProvider */ - public function testGetResourceObjectTypeFields(string $resourceClass, Operation $operation, array $properties, bool $input, int $depth, ?array $ioMetadata, array $expectedResourceObjectTypeFields, callable $advancedNameConverterFactory = null): void + public function testGetResourceObjectTypeFields(string $resourceClass, Operation $operation, array $properties, bool $input, int $depth, ?array $ioMetadata, array $expectedResourceObjectTypeFields, ?callable $advancedNameConverterFactory = null): void { $this->resourceClassResolverProphecy->isResourceClass($resourceClass)->willReturn(true); $this->resourceClassResolverProphecy->isResourceClass('nestedResourceClass')->willReturn(true); @@ -872,7 +872,7 @@ public function testGetEnumFields(): void /** * @dataProvider resolveResourceArgsProvider */ - public function testResolveResourceArgs(array $args, array $expectedResolvedArgs, string $expectedExceptionMessage = null): void + public function testResolveResourceArgs(array $args, array $expectedResolvedArgs, ?string $expectedExceptionMessage = null): void { if (null !== $expectedExceptionMessage) { $this->expectExceptionMessage($expectedExceptionMessage); diff --git a/src/GraphQl/Type/Definition/IterableType.php b/src/GraphQl/Type/Definition/IterableType.php index c3dfbfdcee5..26c08c0d694 100644 --- a/src/GraphQl/Type/Definition/IterableType.php +++ b/src/GraphQl/Type/Definition/IterableType.php @@ -75,7 +75,7 @@ public function parseValue(mixed $value): iterable * * @param ObjectValueNode|ListValueNode|IntValueNode|FloatValueNode|StringValueNode|BooleanValueNode|NullValueNode $valueNode */ - public function parseLiteral(Node $valueNode, array $variables = null): float|array|bool|int|string|null + public function parseLiteral(Node $valueNode, ?array $variables = null): float|array|bool|int|string|null { if ($valueNode instanceof ObjectValueNode || $valueNode instanceof ListValueNode) { return $this->parseIterableLiteral($valueNode); diff --git a/src/GraphQl/Type/Definition/UploadType.php b/src/GraphQl/Type/Definition/UploadType.php index 797e7186a8d..766a6d66645 100644 --- a/src/GraphQl/Type/Definition/UploadType.php +++ b/src/GraphQl/Type/Definition/UploadType.php @@ -62,7 +62,7 @@ public function parseValue(mixed $value): UploadedFile /** * {@inheritdoc} */ - public function parseLiteral(Node $valueNode, array $variables = null): void + public function parseLiteral(Node $valueNode, ?array $variables = null): void { throw new Error('`Upload` cannot be hardcoded in query, be sure to conform to GraphQL multipart request specification.', $valueNode); } diff --git a/src/GraphQl/Type/FieldsBuilder.php b/src/GraphQl/Type/FieldsBuilder.php index c70c32e29b9..55a2588a481 100644 --- a/src/GraphQl/Type/FieldsBuilder.php +++ b/src/GraphQl/Type/FieldsBuilder.php @@ -164,7 +164,7 @@ public function getSubscriptionFields(string $resourceClass, Operation $operatio /** * {@inheritdoc} */ - public function getResourceObjectTypeFields(?string $resourceClass, Operation $operation, bool $input, int $depth = 0, array $ioMetadata = null): array + public function getResourceObjectTypeFields(?string $resourceClass, Operation $operation, bool $input, int $depth = 0, ?array $ioMetadata = null): array { $fields = []; $idField = ['type' => GraphQLType::nonNull(GraphQLType::id())]; @@ -469,7 +469,7 @@ private function getFilterArgs(array $args, ?string $resourceClass, string $root return $this->convertFilterArgsToTypes($args); } - private function mergeFilterArgs(array $args, array $parsed, Operation $operation = null, string $original = ''): array + private function mergeFilterArgs(array $args, array $parsed, ?Operation $operation = null, string $original = ''): array { foreach ($parsed as $key => $value) { // Never override keys that cannot be merged diff --git a/src/GraphQl/Type/FieldsBuilderEnumInterface.php b/src/GraphQl/Type/FieldsBuilderEnumInterface.php index fd2b8723e74..0517796e71c 100644 --- a/src/GraphQl/Type/FieldsBuilderEnumInterface.php +++ b/src/GraphQl/Type/FieldsBuilderEnumInterface.php @@ -50,7 +50,7 @@ public function getSubscriptionFields(string $resourceClass, Operation $operatio /** * Gets the fields of the type of the given resource. */ - public function getResourceObjectTypeFields(?string $resourceClass, Operation $operation, bool $input, int $depth = 0, array $ioMetadata = null): array; + public function getResourceObjectTypeFields(?string $resourceClass, Operation $operation, bool $input, int $depth = 0, ?array $ioMetadata = null): array; /** * Gets the fields (cases) of the enum. diff --git a/src/GraphQl/Type/FieldsBuilderInterface.php b/src/GraphQl/Type/FieldsBuilderInterface.php index 57ea683c7a7..dc4bd57f003 100644 --- a/src/GraphQl/Type/FieldsBuilderInterface.php +++ b/src/GraphQl/Type/FieldsBuilderInterface.php @@ -52,7 +52,7 @@ public function getSubscriptionFields(string $resourceClass, Operation $operatio /** * Gets the fields of the type of the given resource. */ - public function getResourceObjectTypeFields(?string $resourceClass, Operation $operation, bool $input, int $depth = 0, array $ioMetadata = null): array; + public function getResourceObjectTypeFields(?string $resourceClass, Operation $operation, bool $input, int $depth = 0, ?array $ioMetadata = null): array; /** * Resolve the args of a resource by resolving its types. diff --git a/src/Hal/JsonSchema/SchemaFactory.php b/src/Hal/JsonSchema/SchemaFactory.php index fdb0f67b0aa..b20c855cce0 100644 --- a/src/Hal/JsonSchema/SchemaFactory.php +++ b/src/Hal/JsonSchema/SchemaFactory.php @@ -55,7 +55,7 @@ public function __construct(private readonly SchemaFactoryInterface $schemaFacto /** * {@inheritdoc} */ - public function buildSchema(string $className, string $format = 'jsonhal', string $type = Schema::TYPE_OUTPUT, Operation $operation = null, Schema $schema = null, array $serializerContext = null, bool $forceCollection = false): Schema + public function buildSchema(string $className, string $format = 'jsonhal', string $type = Schema::TYPE_OUTPUT, ?Operation $operation = null, ?Schema $schema = null, ?array $serializerContext = null, bool $forceCollection = false): Schema { $schema = $this->schemaFactory->buildSchema($className, $format, $type, $operation, $schema, $serializerContext, $forceCollection); if ('jsonhal' !== $format) { diff --git a/src/Hal/Serializer/CollectionNormalizer.php b/src/Hal/Serializer/CollectionNormalizer.php index a3e69f2ab8f..8cce319c174 100644 --- a/src/Hal/Serializer/CollectionNormalizer.php +++ b/src/Hal/Serializer/CollectionNormalizer.php @@ -83,7 +83,7 @@ protected function getPaginationData(iterable $object, array $context = []): arr * * @throws UnexpectedValueException */ - protected function getItemsData(iterable $object, string $format = null, array $context = []): array + protected function getItemsData(iterable $object, ?string $format = null, array $context = []): array { $data = []; diff --git a/src/Hal/Serializer/EntrypointNormalizer.php b/src/Hal/Serializer/EntrypointNormalizer.php index edcda9c7931..8bea0ac875c 100644 --- a/src/Hal/Serializer/EntrypointNormalizer.php +++ b/src/Hal/Serializer/EntrypointNormalizer.php @@ -43,7 +43,7 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { $entrypoint = ['_links' => ['self' => ['href' => $this->urlGenerator->generate('api_entrypoint')]]]; @@ -73,7 +73,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && ($data instanceof Entrypoint || $data instanceof DocumentationEntrypoint); } diff --git a/src/Hal/Serializer/ItemNormalizer.php b/src/Hal/Serializer/ItemNormalizer.php index 5c9cfff26cb..0b9baff4c8c 100644 --- a/src/Hal/Serializer/ItemNormalizer.php +++ b/src/Hal/Serializer/ItemNormalizer.php @@ -41,7 +41,7 @@ final class ItemNormalizer extends AbstractItemNormalizer /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context); } @@ -54,7 +54,7 @@ public function getSupportedTypes($format): array /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $this->getObjectClass($object); if ($this->getOutputClass($context)) { @@ -98,7 +98,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { // prevent the use of lower priority normalizers (e.g. serializer.normalizer.object) for this format return self::FORMAT === $format; @@ -109,7 +109,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma * * @throws LogicException */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): never + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): never { throw new LogicException(sprintf('%s is a read-only format.', self::FORMAT)); } diff --git a/src/Hal/Serializer/ObjectNormalizer.php b/src/Hal/Serializer/ObjectNormalizer.php index 576d4d7bfd7..ec1ec5df213 100644 --- a/src/Hal/Serializer/ObjectNormalizer.php +++ b/src/Hal/Serializer/ObjectNormalizer.php @@ -37,7 +37,7 @@ public function __construct(private readonly NormalizerInterface $decorated, pri /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context); } @@ -74,7 +74,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { if (isset($context['api_resource'])) { $originalResource = $context['api_resource']; @@ -104,7 +104,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { // prevent the use of lower priority normalizers (e.g. serializer.normalizer.object) for this format return self::FORMAT === $format; @@ -115,7 +115,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma * * @throws LogicException */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { throw new LogicException(sprintf('%s is a read-only format.', self::FORMAT)); } diff --git a/src/HttpCache/EventListener/AddHeadersListener.php b/src/HttpCache/EventListener/AddHeadersListener.php index ef12bbba8c7..31a2612f708 100644 --- a/src/HttpCache/EventListener/AddHeadersListener.php +++ b/src/HttpCache/EventListener/AddHeadersListener.php @@ -29,7 +29,7 @@ final class AddHeadersListener { use OperationRequestInitiatorTrait; - public function __construct(private readonly bool $etag = false, private readonly ?int $maxAge = null, private readonly ?int $sharedMaxAge = null, private readonly ?array $vary = null, private readonly ?bool $public = null, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?int $staleWhileRevalidate = null, private readonly ?int $staleIfError = null) + public function __construct(private readonly bool $etag = false, private readonly ?int $maxAge = null, private readonly ?int $sharedMaxAge = null, private readonly ?array $vary = null, private readonly ?bool $public = null, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?int $staleWhileRevalidate = null, private readonly ?int $staleIfError = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/HttpCache/EventListener/AddTagsListener.php b/src/HttpCache/EventListener/AddTagsListener.php index 9d600a79d7e..feff8463b79 100644 --- a/src/HttpCache/EventListener/AddTagsListener.php +++ b/src/HttpCache/EventListener/AddTagsListener.php @@ -42,7 +42,7 @@ final class AddTagsListener use OperationRequestInitiatorTrait; use UriVariablesResolverTrait; - public function __construct(private readonly IriConverterInterface $iriConverter, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?PurgerInterface $purger = null) + public function __construct(private readonly IriConverterInterface $iriConverter, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?PurgerInterface $purger = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/Hydra/JsonSchema/SchemaFactory.php b/src/Hydra/JsonSchema/SchemaFactory.php index cecb0391ee6..b04ba616b80 100644 --- a/src/Hydra/JsonSchema/SchemaFactory.php +++ b/src/Hydra/JsonSchema/SchemaFactory.php @@ -69,7 +69,7 @@ public function __construct(private readonly SchemaFactoryInterface $schemaFacto /** * {@inheritdoc} */ - public function buildSchema(string $className, string $format = 'jsonld', string $type = Schema::TYPE_OUTPUT, Operation $operation = null, Schema $schema = null, array $serializerContext = null, bool $forceCollection = false): Schema + public function buildSchema(string $className, string $format = 'jsonld', string $type = Schema::TYPE_OUTPUT, ?Operation $operation = null, ?Schema $schema = null, ?array $serializerContext = null, bool $forceCollection = false): Schema { $schema = $this->schemaFactory->buildSchema($className, $format, $type, $operation, $schema, $serializerContext, $forceCollection); if ('jsonld' !== $format) { diff --git a/src/Hydra/Serializer/CollectionFiltersNormalizer.php b/src/Hydra/Serializer/CollectionFiltersNormalizer.php index 2b58890249d..c39f3ac621e 100644 --- a/src/Hydra/Serializer/CollectionFiltersNormalizer.php +++ b/src/Hydra/Serializer/CollectionFiltersNormalizer.php @@ -50,7 +50,7 @@ public function __construct(private readonly NormalizerInterface $collectionNorm /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $this->collectionNormalizer->supportsNormalization($data, $format, $context); } @@ -82,7 +82,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { if (($context[AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS] ?? false) && $object instanceof \ArrayObject && !\count($object)) { return $object; diff --git a/src/Hydra/Serializer/CollectionNormalizer.php b/src/Hydra/Serializer/CollectionNormalizer.php index d58bcad2a00..5eb308a6c64 100644 --- a/src/Hydra/Serializer/CollectionNormalizer.php +++ b/src/Hydra/Serializer/CollectionNormalizer.php @@ -78,7 +78,7 @@ protected function getPaginationData(iterable $object, array $context = []): arr /** * Gets items data. */ - protected function getItemsData(iterable $object, string $format = null, array $context = []): array + protected function getItemsData(iterable $object, ?string $format = null, array $context = []): array { $data = []; $data['hydra:member'] = []; diff --git a/src/Hydra/Serializer/ConstraintViolationListNormalizer.php b/src/Hydra/Serializer/ConstraintViolationListNormalizer.php index 04a09b6db34..86c5d088930 100644 --- a/src/Hydra/Serializer/ConstraintViolationListNormalizer.php +++ b/src/Hydra/Serializer/ConstraintViolationListNormalizer.php @@ -26,7 +26,7 @@ final class ConstraintViolationListNormalizer extends AbstractConstraintViolatio { public const FORMAT = 'jsonld'; - public function __construct(private readonly UrlGeneratorInterface $urlGenerator, array $serializePayloadFields = null, NameConverterInterface $nameConverter = null) + public function __construct(private readonly UrlGeneratorInterface $urlGenerator, ?array $serializePayloadFields = null, ?NameConverterInterface $nameConverter = null) { parent::__construct($serializePayloadFields, $nameConverter); } @@ -34,7 +34,7 @@ public function __construct(private readonly UrlGeneratorInterface $urlGenerator /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { [$messages, $violations] = $this->getMessagesAndViolations($object); diff --git a/src/Hydra/Serializer/DocumentationNormalizer.php b/src/Hydra/Serializer/DocumentationNormalizer.php index f9e0c84f69c..aa0493c5811 100644 --- a/src/Hydra/Serializer/DocumentationNormalizer.php +++ b/src/Hydra/Serializer/DocumentationNormalizer.php @@ -51,7 +51,7 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $classes = []; $entrypointProperties = []; @@ -72,7 +72,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * Populates entrypoint properties. */ - private function populateEntrypointProperties(ApiResource $resourceMetadata, string $shortName, string $prefixedShortName, array &$entrypointProperties, ResourceMetadataCollection $resourceMetadataCollection = null): void + private function populateEntrypointProperties(ApiResource $resourceMetadata, string $shortName, string $prefixedShortName, array &$entrypointProperties, ?ResourceMetadataCollection $resourceMetadataCollection = null): void { $hydraCollectionOperations = $this->getHydraOperations(true, $resourceMetadataCollection); if (empty($hydraCollectionOperations)) { @@ -112,7 +112,7 @@ private function populateEntrypointProperties(ApiResource $resourceMetadata, str /** * Gets a Hydra class. */ - private function getClass(string $resourceClass, ApiResource $resourceMetadata, string $shortName, string $prefixedShortName, array $context, ResourceMetadataCollection $resourceMetadataCollection = null): array + private function getClass(string $resourceClass, ApiResource $resourceMetadata, string $shortName, string $prefixedShortName, array $context, ?ResourceMetadataCollection $resourceMetadataCollection = null): array { $description = $resourceMetadata->getDescription(); $isDeprecated = $resourceMetadata->getDeprecationReason(); @@ -223,7 +223,7 @@ private function getHydraProperties(string $resourceClass, ApiResource $resource /** * Gets Hydra operations. */ - private function getHydraOperations(bool $collection, ResourceMetadataCollection $resourceMetadataCollection = null): array + private function getHydraOperations(bool $collection, ?ResourceMetadataCollection $resourceMetadataCollection = null): array { $hydraOperations = []; foreach ($resourceMetadataCollection as $resourceMetadata) { @@ -578,7 +578,7 @@ private function getContext(): array /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && $data instanceof Documentation; } diff --git a/src/Hydra/Serializer/EntrypointNormalizer.php b/src/Hydra/Serializer/EntrypointNormalizer.php index 29ffccb9802..669099a33f6 100644 --- a/src/Hydra/Serializer/EntrypointNormalizer.php +++ b/src/Hydra/Serializer/EntrypointNormalizer.php @@ -43,7 +43,7 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { $entrypoint = [ '@context' => $this->urlGenerator->generate('api_jsonld_context', ['shortName' => 'Entrypoint']), @@ -82,7 +82,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && ($data instanceof Entrypoint || $data instanceof DocumentationEntrypoint); } diff --git a/src/Hydra/Serializer/ErrorNormalizer.php b/src/Hydra/Serializer/ErrorNormalizer.php index 66257d2ab99..6117a3323cd 100644 --- a/src/Hydra/Serializer/ErrorNormalizer.php +++ b/src/Hydra/Serializer/ErrorNormalizer.php @@ -43,7 +43,7 @@ public function __construct(private readonly UrlGeneratorInterface $urlGenerator /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $data = [ '@context' => $this->urlGenerator->generate('api_jsonld_context', ['shortName' => 'Error']), @@ -62,7 +62,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { if ($context['api_error_resource'] ?? false) { return false; diff --git a/src/Hydra/Serializer/PartialCollectionViewNormalizer.php b/src/Hydra/Serializer/PartialCollectionViewNormalizer.php index ac64696db4f..0c1f6432a75 100644 --- a/src/Hydra/Serializer/PartialCollectionViewNormalizer.php +++ b/src/Hydra/Serializer/PartialCollectionViewNormalizer.php @@ -37,7 +37,7 @@ final class PartialCollectionViewNormalizer implements NormalizerInterface, Norm { private readonly PropertyAccessorInterface $propertyAccessor; - public function __construct(private readonly NormalizerInterface $collectionNormalizer, private readonly string $pageParameterName = 'page', private string $enabledParameterName = 'pagination', private readonly ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, PropertyAccessorInterface $propertyAccessor = null) + public function __construct(private readonly NormalizerInterface $collectionNormalizer, private readonly string $pageParameterName = 'page', private string $enabledParameterName = 'pagination', private readonly ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, ?PropertyAccessorInterface $propertyAccessor = null) { $this->propertyAccessor = $propertyAccessor ?? PropertyAccess::createPropertyAccessor(); } @@ -45,7 +45,7 @@ public function __construct(private readonly NormalizerInterface $collectionNorm /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $data = $this->collectionNormalizer->normalize($object, $format, $context); @@ -106,7 +106,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $this->collectionNormalizer->supportsNormalization($data, $format, $context); } diff --git a/src/JsonApi/Serializer/CollectionNormalizer.php b/src/JsonApi/Serializer/CollectionNormalizer.php index 5ef4cfa1acf..8fe2be7c32b 100644 --- a/src/JsonApi/Serializer/CollectionNormalizer.php +++ b/src/JsonApi/Serializer/CollectionNormalizer.php @@ -85,7 +85,7 @@ protected function getPaginationData($object, array $context = []): array * * @throws UnexpectedValueException */ - protected function getItemsData($object, string $format = null, array $context = []): array + protected function getItemsData($object, ?string $format = null, array $context = []): array { $data = [ 'data' => [], diff --git a/src/JsonApi/Serializer/ConstraintViolationListNormalizer.php b/src/JsonApi/Serializer/ConstraintViolationListNormalizer.php index 90c87a881cf..92afba9744f 100644 --- a/src/JsonApi/Serializer/ConstraintViolationListNormalizer.php +++ b/src/JsonApi/Serializer/ConstraintViolationListNormalizer.php @@ -37,7 +37,7 @@ public function __construct(private readonly PropertyMetadataFactoryInterface $p /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { $violations = []; foreach ($object as $violation) { @@ -55,7 +55,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && $data instanceof ConstraintViolationListInterface; } diff --git a/src/JsonApi/Serializer/EntrypointNormalizer.php b/src/JsonApi/Serializer/EntrypointNormalizer.php index 911119508b4..5414d4da658 100644 --- a/src/JsonApi/Serializer/EntrypointNormalizer.php +++ b/src/JsonApi/Serializer/EntrypointNormalizer.php @@ -44,7 +44,7 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $entrypoint = ['links' => ['self' => $this->urlGenerator->generate('api_entrypoint', [], UrlGeneratorInterface::ABS_URL)]]; @@ -73,7 +73,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && ($data instanceof Entrypoint || $data instanceof DocumentationEntrypoint); } diff --git a/src/JsonApi/Serializer/ErrorNormalizer.php b/src/JsonApi/Serializer/ErrorNormalizer.php index 7d2de52fc05..55a2f12adbc 100644 --- a/src/JsonApi/Serializer/ErrorNormalizer.php +++ b/src/JsonApi/Serializer/ErrorNormalizer.php @@ -44,7 +44,7 @@ public function __construct(private readonly bool $debug = false, array $default /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { // TODO: in api platform 4 this will be the default, note that JSON:API is close to Problem so we should use the same normalizer if ($context['rfc_7807_compliant_errors'] ?? false) { @@ -80,7 +80,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && ($data instanceof \Exception || $data instanceof FlattenException); } diff --git a/src/JsonApi/Serializer/ItemNormalizer.php b/src/JsonApi/Serializer/ItemNormalizer.php index 4a48334b6b6..54ab6725a68 100644 --- a/src/JsonApi/Serializer/ItemNormalizer.php +++ b/src/JsonApi/Serializer/ItemNormalizer.php @@ -55,7 +55,7 @@ final class ItemNormalizer extends AbstractItemNormalizer private array $componentsCache = []; - public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface|LegacyIriConverterInterface $iriConverter, ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, ResourceAccessCheckerInterface $resourceAccessChecker = null) + public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface|LegacyIriConverterInterface $iriConverter, ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, ?PropertyAccessorInterface $propertyAccessor = null, ?NameConverterInterface $nameConverter = null, ?ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, ?ResourceAccessCheckerInterface $resourceAccessChecker = null) { parent::__construct($propertyNameCollectionFactory, $propertyMetadataFactory, $iriConverter, $resourceClassResolver, $propertyAccessor, $nameConverter, $classMetadataFactory, $defaultContext, $resourceMetadataCollectionFactory, $resourceAccessChecker); } @@ -63,7 +63,7 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context) && !($data instanceof \Exception || $data instanceof FlattenException); } @@ -76,7 +76,7 @@ public function getSupportedTypes($format): array /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $this->getObjectClass($object); if ($this->getOutputClass($context)) { @@ -146,7 +146,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format, $context); } @@ -156,7 +156,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma * * @throws NotNormalizableValueException */ - public function denormalize(mixed $data, string $class, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $class, ?string $format = null, array $context = []): mixed { // Avoid issues with proxies if we populated the object if (!isset($context[self::OBJECT_TO_POPULATE]) && isset($data['data']['id'])) { @@ -187,7 +187,7 @@ public function denormalize(mixed $data, string $class, string $format = null, a /** * {@inheritdoc} */ - protected function getAttributes(object $object, string $format = null, array $context = []): array + protected function getAttributes(object $object, ?string $format = null, array $context = []): array { return $this->getComponents($object, $format, $context)['attributes']; } @@ -195,7 +195,7 @@ protected function getAttributes(object $object, string $format = null, array $c /** * {@inheritdoc} */ - protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = []): void + protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []): void { parent::setAttributeValue($object, $attribute, \is_array($value) && \array_key_exists('data', $value) ? $value['data'] : $value, $format, $context); } @@ -274,7 +274,7 @@ protected function normalizeRelation(ApiProperty $propertyMetadata, ?object $rel /** * {@inheritdoc} */ - protected function isAllowedAttribute(object|string $classOrObject, string $attribute, string $format = null, array $context = []): bool + protected function isAllowedAttribute(object|string $classOrObject, string $attribute, ?string $format = null, array $context = []): bool { return preg_match('/^\\w[-\\w_]*$/', $attribute) && parent::isAllowedAttribute($classOrObject, $attribute, $format, $context); } diff --git a/src/JsonApi/Serializer/ObjectNormalizer.php b/src/JsonApi/Serializer/ObjectNormalizer.php index 5671df3fc95..2dc6a4c9274 100644 --- a/src/JsonApi/Serializer/ObjectNormalizer.php +++ b/src/JsonApi/Serializer/ObjectNormalizer.php @@ -41,7 +41,7 @@ public function __construct(private readonly NormalizerInterface $decorated, pri /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context); } @@ -75,7 +75,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { if (isset($context['api_resource'])) { $originalResource = $context['api_resource']; diff --git a/src/JsonApi/Serializer/ReservedAttributeNameConverter.php b/src/JsonApi/Serializer/ReservedAttributeNameConverter.php index 9bf8dc9456b..e25ad566dc9 100644 --- a/src/JsonApi/Serializer/ReservedAttributeNameConverter.php +++ b/src/JsonApi/Serializer/ReservedAttributeNameConverter.php @@ -38,7 +38,7 @@ public function __construct(private readonly ?NameConverterInterface $nameConver /** * {@inheritdoc} */ - public function normalize(string $propertyName, string $class = null, string $format = null, array $context = []): string + public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { if (null !== $this->nameConverter) { $propertyName = $this->nameConverter->normalize($propertyName, $class, $format, $context); @@ -54,7 +54,7 @@ public function normalize(string $propertyName, string $class = null, string $fo /** * {@inheritdoc} */ - public function denormalize(string $propertyName, string $class = null, string $format = null, array $context = []): string + public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { if (\in_array($propertyName, self::JSON_API_RESERVED_ATTRIBUTES, true)) { $propertyName = substr($propertyName, 1); diff --git a/src/JsonLd/Action/ContextAction.php b/src/JsonLd/Action/ContextAction.php index 30d944da268..a6f0a5a7148 100644 --- a/src/JsonLd/Action/ContextAction.php +++ b/src/JsonLd/Action/ContextAction.php @@ -54,7 +54,7 @@ public function __construct( * * @return array{'@context': array}|Response */ - public function __invoke(string $shortName = 'Entrypoint', Request $request = null): array|Response + public function __invoke(string $shortName = 'Entrypoint', ?Request $request = null): array|Response { if (null !== $request && $this->provider && $this->processor && $this->serializer) { $operation = new Get( diff --git a/src/JsonLd/ContextBuilder.php b/src/JsonLd/ContextBuilder.php index 1214ca78d77..67673dbbb4e 100644 --- a/src/JsonLd/ContextBuilder.php +++ b/src/JsonLd/ContextBuilder.php @@ -94,7 +94,7 @@ public function getResourceContext(string $resourceClass, int $referenceType = U /** * {@inheritdoc} */ - public function getResourceContextUri(string $resourceClass, int $referenceType = null): string + public function getResourceContextUri(string $resourceClass, ?int $referenceType = null): string { $resourceMetadata = $this->resourceMetadataFactory->create($resourceClass)[0]; if (null === $referenceType) { @@ -140,7 +140,7 @@ public function getAnonymousResourceContext(object $object, array $context = [], return $jsonLdContext; } - private function getResourceContextWithShortname(string $resourceClass, int $referenceType, string $shortName, HttpOperation $operation = null): array + private function getResourceContextWithShortname(string $resourceClass, int $referenceType, string $shortName, ?HttpOperation $operation = null): array { $context = $this->getBaseContext($referenceType); $propertyContext = $operation ? ['normalization_groups' => $operation->getNormalizationContext()['groups'] ?? null, 'denormalization_groups' => $operation->getDenormalizationContext()['groups'] ?? null] : ['normalization_groups' => [], 'denormalization_groups' => []]; diff --git a/src/JsonLd/Serializer/ItemNormalizer.php b/src/JsonLd/Serializer/ItemNormalizer.php index 5eafbc7a31e..2729eb02301 100644 --- a/src/JsonLd/Serializer/ItemNormalizer.php +++ b/src/JsonLd/Serializer/ItemNormalizer.php @@ -47,7 +47,7 @@ final class ItemNormalizer extends AbstractItemNormalizer public const FORMAT = 'jsonld'; - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface|LegacyIriConverterInterface $iriConverter, ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, private readonly ContextBuilderInterface $contextBuilder, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ResourceAccessCheckerInterface $resourceAccessChecker = null) + public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface|LegacyIriConverterInterface $iriConverter, ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, private readonly ContextBuilderInterface $contextBuilder, ?PropertyAccessorInterface $propertyAccessor = null, ?NameConverterInterface $nameConverter = null, ?ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ?ResourceAccessCheckerInterface $resourceAccessChecker = null) { parent::__construct($propertyNameCollectionFactory, $propertyMetadataFactory, $iriConverter, $resourceClassResolver, $propertyAccessor, $nameConverter, $classMetadataFactory, $defaultContext, $resourceMetadataCollectionFactory, $resourceAccessChecker); } @@ -55,7 +55,7 @@ public function __construct(ResourceMetadataCollectionFactoryInterface $resource /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context); } @@ -70,7 +70,7 @@ public function getSupportedTypes($format): array * * @throws LogicException */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $this->getObjectClass($object); @@ -129,7 +129,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format, $context); } @@ -139,7 +139,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma * * @throws NotNormalizableValueException */ - public function denormalize(mixed $data, string $class, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $class, ?string $format = null, array $context = []): mixed { // Avoid issues with proxies if we populated the object if (isset($data['@id']) && !isset($context[self::OBJECT_TO_POPULATE])) { diff --git a/src/JsonLd/Serializer/ObjectNormalizer.php b/src/JsonLd/Serializer/ObjectNormalizer.php index cadcbebe8bc..5339e520728 100644 --- a/src/JsonLd/Serializer/ObjectNormalizer.php +++ b/src/JsonLd/Serializer/ObjectNormalizer.php @@ -39,7 +39,7 @@ public function __construct(private readonly NormalizerInterface $decorated, pri /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context); } @@ -73,7 +73,7 @@ public function hasCacheableSupportsMethod(): bool /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { if (isset($context['api_resource'])) { $originalResource = $context['api_resource']; diff --git a/src/JsonSchema/BackwardCompatibleSchemaFactory.php b/src/JsonSchema/BackwardCompatibleSchemaFactory.php index 35b43168b99..9228d815e71 100644 --- a/src/JsonSchema/BackwardCompatibleSchemaFactory.php +++ b/src/JsonSchema/BackwardCompatibleSchemaFactory.php @@ -33,7 +33,7 @@ public function __construct(private readonly SchemaFactoryInterface $decorated) /** * {@inheritDoc} */ - public function buildSchema(string $className, string $format = 'json', string $type = Schema::TYPE_OUTPUT, Operation $operation = null, Schema $schema = null, array $serializerContext = null, bool $forceCollection = false): Schema + public function buildSchema(string $className, string $format = 'json', string $type = Schema::TYPE_OUTPUT, ?Operation $operation = null, ?Schema $schema = null, ?array $serializerContext = null, bool $forceCollection = false): Schema { $schema = $this->decorated->buildSchema($className, $format, $type, $operation, $schema, $serializerContext, $forceCollection); diff --git a/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php b/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php index f2713a51866..087de10f6f1 100644 --- a/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php +++ b/src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php @@ -154,7 +154,7 @@ public function create(string $resourceClass, string $property, array $options = return $propertyMetadata->withSchema($propertySchema + [$composition => $valueSchema]); } - private function getType(Type $type, bool $readableLink = null): array + private function getType(Type $type, ?bool $readableLink = null): array { if (!$type->isCollection()) { return $this->addNullabilityToTypeDefinition($this->typeToArray($type, $readableLink), $type); @@ -176,7 +176,7 @@ private function getType(Type $type, bool $readableLink = null): array ], $type); } - private function typeToArray(Type $type, bool $readableLink = null): array + private function typeToArray(Type $type, ?bool $readableLink = null): array { return match ($type->getBuiltinType()) { Type::BUILTIN_TYPE_INT => ['type' => 'integer'], diff --git a/src/JsonSchema/SchemaFactory.php b/src/JsonSchema/SchemaFactory.php index 42af8dd413d..a128a896878 100644 --- a/src/JsonSchema/SchemaFactory.php +++ b/src/JsonSchema/SchemaFactory.php @@ -43,7 +43,7 @@ final class SchemaFactory implements SchemaFactoryInterface, SchemaFactoryAwareI public const FORCE_SUBSCHEMA = '_api_subschema_force_readable_link'; public const OPENAPI_DEFINITION_NAME = 'openapi_definition_name'; - public function __construct(?TypeFactoryInterface $typeFactory, ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, private readonly ?NameConverterInterface $nameConverter = null, ResourceClassResolverInterface $resourceClassResolver = null) + public function __construct(?TypeFactoryInterface $typeFactory, ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, private readonly ?NameConverterInterface $nameConverter = null, ?ResourceClassResolverInterface $resourceClassResolver = null) { if ($typeFactory) { $this->typeFactory = $typeFactory; @@ -66,7 +66,7 @@ public function addDistinctFormat(string $format): void /** * {@inheritdoc} */ - public function buildSchema(string $className, string $format = 'json', string $type = Schema::TYPE_OUTPUT, Operation $operation = null, Schema $schema = null, array $serializerContext = null, bool $forceCollection = false): Schema + public function buildSchema(string $className, string $format = 'json', string $type = Schema::TYPE_OUTPUT, ?Operation $operation = null, ?Schema $schema = null, ?array $serializerContext = null, bool $forceCollection = false): Schema { $schema = $schema ? clone $schema : new Schema(); @@ -243,7 +243,7 @@ private function buildPropertySchema(Schema $schema, string $definitionName, str $schema->getDefinitions()[$definitionName]['properties'][$normalizedPropertyName] = new \ArrayObject($propertySchema); } - private function buildDefinitionName(string $className, string $format = 'json', string $inputOrOutputClass = null, Operation $operation = null, array $serializerContext = null): string + private function buildDefinitionName(string $className, string $format = 'json', ?string $inputOrOutputClass = null, ?Operation $operation = null, ?array $serializerContext = null): string { if ($operation) { $prefix = $operation->getShortName(); @@ -279,7 +279,7 @@ private function encodeDefinitionName(string $name): string return preg_replace('/[^a-zA-Z0-9.\-_]/', '.', $name); } - private function getMetadata(string $className, string $type = Schema::TYPE_OUTPUT, Operation $operation = null, array $serializerContext = null): ?array + private function getMetadata(string $className, string $type = Schema::TYPE_OUTPUT, ?Operation $operation = null, ?array $serializerContext = null): ?array { if (!$this->isResourceClass($className)) { return [ @@ -368,7 +368,7 @@ private function getValidationGroups(Operation $operation): array /** * Gets the options for the property name collection / property metadata factories. */ - private function getFactoryOptions(array $serializerContext, array $validationGroups, HttpOperation $operation = null): array + private function getFactoryOptions(array $serializerContext, array $validationGroups, ?HttpOperation $operation = null): array { $options = [ /* @see https://github.com/symfony/symfony/blob/v5.1.0/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php */ diff --git a/src/JsonSchema/SchemaFactoryInterface.php b/src/JsonSchema/SchemaFactoryInterface.php index 3248156f5a8..ec992908a50 100644 --- a/src/JsonSchema/SchemaFactoryInterface.php +++ b/src/JsonSchema/SchemaFactoryInterface.php @@ -25,5 +25,5 @@ interface SchemaFactoryInterface /** * Builds the JSON Schema document corresponding to the given PHP class. */ - public function buildSchema(string $className, string $format = 'json', string $type = Schema::TYPE_OUTPUT, Operation $operation = null, Schema $schema = null, array $serializerContext = null, bool $forceCollection = false): Schema; + public function buildSchema(string $className, string $format = 'json', string $type = Schema::TYPE_OUTPUT, ?Operation $operation = null, ?Schema $schema = null, ?array $serializerContext = null, bool $forceCollection = false): Schema; } diff --git a/src/JsonSchema/Tests/Fixtures/ApiResource/Dummy.php b/src/JsonSchema/Tests/Fixtures/ApiResource/Dummy.php index 919f8498278..ee45c52e851 100644 --- a/src/JsonSchema/Tests/Fixtures/ApiResource/Dummy.php +++ b/src/JsonSchema/Tests/Fixtures/ApiResource/Dummy.php @@ -147,12 +147,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/src/JsonSchema/TypeFactory.php b/src/JsonSchema/TypeFactory.php index 34f1f3f0080..3921913e82e 100644 --- a/src/JsonSchema/TypeFactory.php +++ b/src/JsonSchema/TypeFactory.php @@ -33,7 +33,7 @@ final class TypeFactory implements TypeFactoryInterface private ?SchemaFactoryInterface $schemaFactory = null; - public function __construct(ResourceClassResolverInterface $resourceClassResolver = null) + public function __construct(?ResourceClassResolverInterface $resourceClassResolver = null) { $this->resourceClassResolver = $resourceClassResolver; } @@ -46,7 +46,7 @@ public function setSchemaFactory(SchemaFactoryInterface $schemaFactory): void /** * {@inheritdoc} */ - public function getType(Type $type, string $format = 'json', bool $readableLink = null, array $serializerContext = null, Schema $schema = null): array + public function getType(Type $type, string $format = 'json', ?bool $readableLink = null, ?array $serializerContext = null, ?Schema $schema = null): array { if ('jsonschema' === $format) { return []; @@ -73,7 +73,7 @@ public function getType(Type $type, string $format = 'json', bool $readableLink return $this->addNullabilityToTypeDefinition($this->makeBasicType($type, $format, $readableLink, $serializerContext, $schema), $type, $schema); } - private function makeBasicType(Type $type, string $format = 'json', bool $readableLink = null, array $serializerContext = null, Schema $schema = null): array + private function makeBasicType(Type $type, string $format = 'json', ?bool $readableLink = null, ?array $serializerContext = null, ?Schema $schema = null): array { return match ($type->getBuiltinType()) { Type::BUILTIN_TYPE_INT => ['type' => 'integer'], diff --git a/src/JsonSchema/TypeFactoryInterface.php b/src/JsonSchema/TypeFactoryInterface.php index 795854dbf87..b2ba889c14e 100644 --- a/src/JsonSchema/TypeFactoryInterface.php +++ b/src/JsonSchema/TypeFactoryInterface.php @@ -25,5 +25,5 @@ interface TypeFactoryInterface /** * Gets the JSON Schema document which specifies the data type corresponding to the given PHP type, and recursively adds needed new schema to the current schema if provided. */ - public function getType(Type $type, string $format = 'json', bool $readableLink = null, array $serializerContext = null, Schema $schema = null): array; + public function getType(Type $type, string $format = 'json', ?bool $readableLink = null, ?array $serializerContext = null, ?Schema $schema = null): array; } diff --git a/src/Metadata/Delete.php b/src/Metadata/Delete.php index b381971746d..280a85367cb 100644 --- a/src/Metadata/Delete.php +++ b/src/Metadata/Delete.php @@ -20,78 +20,78 @@ final class Delete extends HttpOperation implements DeleteOperationInterface { public function __construct( - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - array $cacheHeaders = null, - array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, - bool|OpenApiOperation $openapi = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + bool|OpenApiOperation|null $openapi = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], ) { parent::__construct( diff --git a/src/Metadata/Error.php b/src/Metadata/Error.php index 988521523a3..9126a26c0a6 100644 --- a/src/Metadata/Error.php +++ b/src/Metadata/Error.php @@ -20,78 +20,78 @@ final class Error extends HttpOperation { public function __construct( - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - array $cacheHeaders = null, - array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, - bool|OpenApiOperation $openapi = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + bool|OpenApiOperation|null $openapi = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], ) { parent::__construct( diff --git a/src/Metadata/ErrorResource.php b/src/Metadata/ErrorResource.php index 7a637771b26..a58fb14e990 100644 --- a/src/Metadata/ErrorResource.php +++ b/src/Metadata/ErrorResource.php @@ -20,71 +20,71 @@ class ErrorResource extends ApiResource { public function __construct( - string $uriTemplate = null, - string $shortName = null, - string $description = null, - array|string $types = null, + ?string $uriTemplate = null, + ?string $shortName = null, + ?string $description = null, + array|string|null $types = null, $operations = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, - int $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - string $class = null, - int $urlGenerationStrategy = null, - string $deprecationReason = null, - array $cacheHeaders = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - array $hydraContext = null, - array $openapiContext = null, - OpenApiOperation|bool $openapi = null, - array $validationContext = null, - array $filters = null, - bool $elasticsearch = null, + ?string $routePrefix = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, + ?int $status = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?string $class = null, + ?int $urlGenerationStrategy = null, + ?string $deprecationReason = null, + ?array $cacheHeaders = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + OpenApiOperation|bool|null $openapi = null, + ?array $validationContext = null, + ?array $filters = null, + ?bool $elasticsearch = null, $mercure = null, $messenger = null, $input = null, $output = null, - array $order = null, - bool $fetchPartial = null, - bool $forceEager = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - array $paginationViaCursor = null, - bool $paginationEnabled = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - string $paginationType = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - bool $compositeIdentifier = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $graphQlOperations = null, + ?array $order = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?array $paginationViaCursor = null, + ?bool $paginationEnabled = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?string $paginationType = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?bool $compositeIdentifier = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $graphQlOperations = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [] ) { parent::__construct( diff --git a/src/Metadata/Extractor/XmlPropertyExtractor.php b/src/Metadata/Extractor/XmlPropertyExtractor.php index 761a73e5424..1efb235b52a 100644 --- a/src/Metadata/Extractor/XmlPropertyExtractor.php +++ b/src/Metadata/Extractor/XmlPropertyExtractor.php @@ -77,7 +77,7 @@ protected function extractPath(string $path): void } } - private function buildExtraProperties(\SimpleXMLElement $resource, string $key = null): ?array + private function buildExtraProperties(\SimpleXMLElement $resource, ?string $key = null): ?array { if (null !== $key) { if (!isset($resource->{$key})) { diff --git a/src/Metadata/Extractor/XmlResourceExtractor.php b/src/Metadata/Extractor/XmlResourceExtractor.php index c5b7881b3b0..6115bde4e41 100644 --- a/src/Metadata/Extractor/XmlResourceExtractor.php +++ b/src/Metadata/Extractor/XmlResourceExtractor.php @@ -358,7 +358,7 @@ private function buildExceptionToStatus(\SimpleXMLElement $resource): ?array return $data; } - private function buildExtraProperties(\SimpleXMLElement $resource, string $key = null): ?array + private function buildExtraProperties(\SimpleXMLElement $resource, ?string $key = null): ?array { if (null !== $key) { if (!isset($resource->{$key})) { diff --git a/src/Metadata/Get.php b/src/Metadata/Get.php index ad1e6d08408..1b89fbc9791 100644 --- a/src/Metadata/Get.php +++ b/src/Metadata/Get.php @@ -20,78 +20,78 @@ final class Get extends HttpOperation { public function __construct( - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - array $cacheHeaders = null, - array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, - bool|OpenApiOperation $openapi = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + bool|OpenApiOperation|null $openapi = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], ) { parent::__construct( diff --git a/src/Metadata/GetCollection.php b/src/Metadata/GetCollection.php index b9b2073dabc..de47c5aada3 100644 --- a/src/Metadata/GetCollection.php +++ b/src/Metadata/GetCollection.php @@ -20,78 +20,78 @@ final class GetCollection extends HttpOperation implements CollectionOperationInterface { public function __construct( - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - array $cacheHeaders = null, - array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, - bool|OpenApiOperation $openapi = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + bool|OpenApiOperation|null $openapi = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], private ?string $itemUriTemplate = null, ) { diff --git a/src/Metadata/GraphQl/Operation.php b/src/Metadata/GraphQl/Operation.php index 0833b84bfc2..c51370967e8 100644 --- a/src/Metadata/GraphQl/Operation.php +++ b/src/Metadata/GraphQl/Operation.php @@ -40,50 +40,50 @@ public function __construct( protected ?array $extraArgs = null, protected ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [] ) { parent::__construct( @@ -140,7 +140,7 @@ public function getResolver(): ?string return $this->resolver; } - public function withResolver(string $resolver = null): self + public function withResolver(?string $resolver = null): self { $self = clone $this; $self->resolver = $resolver; @@ -153,7 +153,7 @@ public function getArgs(): ?array return $this->args; } - public function withArgs(array $args = null): self + public function withArgs(?array $args = null): self { $self = clone $this; $self->args = $args; @@ -166,7 +166,7 @@ public function getExtraArgs(): ?array return $this->extraArgs; } - public function withExtraArgs(array $extraArgs = null): self + public function withExtraArgs(?array $extraArgs = null): self { $self = clone $this; $self->extraArgs = $extraArgs; diff --git a/src/Metadata/GraphQl/Query.php b/src/Metadata/GraphQl/Query.php index 5f3546f8873..c86de8e0b07 100644 --- a/src/Metadata/GraphQl/Query.php +++ b/src/Metadata/GraphQl/Query.php @@ -19,55 +19,55 @@ class Query extends Operation { public function __construct( - string $resolver = null, - array $args = null, - array $extraArgs = null, - array $links = null, + ?string $resolver = null, + ?array $args = null, + ?array $extraArgs = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], protected ?bool $nested = null, @@ -130,7 +130,7 @@ public function getNested(): ?bool return $this->nested; } - public function withNested(bool $nested = null): self + public function withNested(?bool $nested = null): self { $self = clone $this; $self->nested = $nested; diff --git a/src/Metadata/GraphQl/QueryCollection.php b/src/Metadata/GraphQl/QueryCollection.php index bf8a962f275..a23fa44aa04 100644 --- a/src/Metadata/GraphQl/QueryCollection.php +++ b/src/Metadata/GraphQl/QueryCollection.php @@ -20,58 +20,58 @@ final class QueryCollection extends Query implements CollectionOperationInterface { public function __construct( - string $resolver = null, - array $args = null, - array $extraArgs = null, - array $links = null, + ?string $resolver = null, + ?array $args = null, + ?array $extraArgs = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, protected ?OptionsInterface $stateOptions = null, array $extraProperties = [], - bool $nested = null, + ?bool $nested = null, ) { parent::__construct( resolver: $resolver, diff --git a/src/Metadata/GraphQl/Subscription.php b/src/Metadata/GraphQl/Subscription.php index c58208b6448..1ebec3e4c95 100644 --- a/src/Metadata/GraphQl/Subscription.php +++ b/src/Metadata/GraphQl/Subscription.php @@ -19,55 +19,55 @@ final class Subscription extends Operation { public function __construct( - string $resolver = null, - array $args = null, - array $extraArgs = null, - array $links = null, + ?string $resolver = null, + ?array $args = null, + ?array $extraArgs = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], ) { parent::__construct( diff --git a/src/Metadata/HttpOperation.php b/src/Metadata/HttpOperation.php index ed77bb58604..4b78cafd044 100644 --- a/src/Metadata/HttpOperation.php +++ b/src/Metadata/HttpOperation.php @@ -153,50 +153,50 @@ public function __construct( protected ?bool $queryParameterValidationEnabled = null, protected ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], ) { parent::__construct( @@ -266,7 +266,7 @@ public function getUriTemplate(): ?string return $this->uriTemplate; } - public function withUriTemplate(string $uriTemplate = null) + public function withUriTemplate(?string $uriTemplate = null) { $self = clone $this; $self->uriTemplate = $uriTemplate; diff --git a/src/Metadata/IdentifiersExtractor.php b/src/Metadata/IdentifiersExtractor.php index ee706d45244..3ad989848c3 100644 --- a/src/Metadata/IdentifiersExtractor.php +++ b/src/Metadata/IdentifiersExtractor.php @@ -38,7 +38,7 @@ final class IdentifiersExtractor implements IdentifiersExtractorInterface /** * @param LegacyResourceClassResolverInterface|ResourceClassResolverInterface $resourceClassResolver */ - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, $resourceClassResolver, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, PropertyAccessorInterface $propertyAccessor = null) + public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, $resourceClassResolver, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, ?PropertyAccessorInterface $propertyAccessor = null) { $this->resourceMetadataFactory = $resourceMetadataFactory; $this->resourceClassResolver = $resourceClassResolver; @@ -50,7 +50,7 @@ public function __construct(ResourceMetadataCollectionFactoryInterface $resource * * TODO: 3.0 identifiers should be stringable? */ - public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array + public function getIdentifiersFromItem(object $item, ?Operation $operation = null, array $context = []): array { if (!$this->isResourceClass($this->getObjectClass($item))) { return ['id' => $this->propertyAccessor->getValue($item, 'id')]; @@ -96,7 +96,7 @@ private function getIdentifiersFromOperation(object $item, Operation $operation, /** * Gets the value of the given class property. */ - private function getIdentifierValue(object $item, string $class, string $property, string $parameterName, string $toProperty = null): float|bool|int|string + private function getIdentifierValue(object $item, string $class, string $property, string $parameterName, ?string $toProperty = null): float|bool|int|string { if ($item instanceof $class) { try { diff --git a/src/Metadata/IdentifiersExtractorInterface.php b/src/Metadata/IdentifiersExtractorInterface.php index c8ac46d9929..ee3b11f9f32 100644 --- a/src/Metadata/IdentifiersExtractorInterface.php +++ b/src/Metadata/IdentifiersExtractorInterface.php @@ -39,6 +39,6 @@ interface IdentifiersExtractorInterface * * @throws RuntimeException */ - public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array; + public function getIdentifiersFromItem(object $item, ?Operation $operation = null, array $context = []): array; } } diff --git a/src/Metadata/IriConverterInterface.php b/src/Metadata/IriConverterInterface.php index 56fd9618fba..7c16b2f729a 100644 --- a/src/Metadata/IriConverterInterface.php +++ b/src/Metadata/IriConverterInterface.php @@ -42,7 +42,7 @@ interface IriConverterInterface * @throws InvalidArgumentException * @throws ItemNotFoundException */ - public function getResourceFromIri(string $iri, array $context = [], Operation $operation = null): object; + public function getResourceFromIri(string $iri, array $context = [], ?Operation $operation = null): object; /** * Gets the IRI associated with the given item. @@ -52,6 +52,6 @@ public function getResourceFromIri(string $iri, array $context = [], Operation $ * @throws InvalidArgumentException * @throws RuntimeException */ - public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = []): ?string; + public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): ?string; } } diff --git a/src/Metadata/Metadata.php b/src/Metadata/Metadata.php index 0b409ac8c34..56049747138 100644 --- a/src/Metadata/Metadata.php +++ b/src/Metadata/Metadata.php @@ -104,7 +104,7 @@ public function getDescription(): ?string return $this->description; } - public function withDescription(string $description = null): static + public function withDescription(?string $description = null): static { $self = clone $this; $self->description = $description; @@ -169,7 +169,7 @@ public function getCollectDenormalizationErrors(): ?bool return $this->collectDenormalizationErrors; } - public function withCollectDenormalizationErrors(bool $collectDenormalizationErrors = null): static + public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors = null): static { $self = clone $this; $self->collectDenormalizationErrors = $collectDenormalizationErrors; @@ -506,7 +506,7 @@ public function getSecurityPostValidation(): ?string return $this->securityPostValidation; } - public function withSecurityPostValidation(string $securityPostValidation = null): static + public function withSecurityPostValidation(?string $securityPostValidation = null): static { $self = clone $this; $self->securityPostValidation = $securityPostValidation; @@ -519,7 +519,7 @@ public function getSecurityPostValidationMessage(): ?string return $this->securityPostValidationMessage; } - public function withSecurityPostValidationMessage(string $securityPostValidationMessage = null): static + public function withSecurityPostValidationMessage(?string $securityPostValidationMessage = null): static { $self = clone $this; $self->securityPostValidationMessage = $securityPostValidationMessage; diff --git a/src/Metadata/NotExposed.php b/src/Metadata/NotExposed.php index f7fa24af895..4d054bb75b0 100644 --- a/src/Metadata/NotExposed.php +++ b/src/Metadata/NotExposed.php @@ -31,81 +31,81 @@ final class NotExposed extends HttpOperation */ public function __construct( string $method = 'GET', - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = 404, - string $host = null, - array $schemes = null, - string $condition = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, ?string $controller = 'api_platform.action.not_exposed', - array $cacheHeaders = null, - array $paginationViaCursor = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, + ?array $hydraContext = null, + ?array $openapiContext = null, bool|OpenApiOperation|null $openapi = false, - array $exceptionToStatus = null, + ?array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = false, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, ?bool $read = false, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, array $extraProperties = [], - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, ) { parent::__construct( method: $method, diff --git a/src/Metadata/Patch.php b/src/Metadata/Patch.php index ba6e61f196a..f9f530a38b0 100644 --- a/src/Metadata/Patch.php +++ b/src/Metadata/Patch.php @@ -20,78 +20,78 @@ final class Patch extends HttpOperation { public function __construct( - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - array $cacheHeaders = null, - array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, - bool|OpenApiOperation $openapi = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + bool|OpenApiOperation|null $openapi = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], ) { parent::__construct( diff --git a/src/Metadata/Post.php b/src/Metadata/Post.php index feba797ab9e..bf57ca48d00 100644 --- a/src/Metadata/Post.php +++ b/src/Metadata/Post.php @@ -20,78 +20,78 @@ final class Post extends HttpOperation { public function __construct( - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - array $cacheHeaders = null, - array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, - bool|OpenApiOperation $openapi = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + bool|OpenApiOperation|null $openapi = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], private ?string $itemUriTemplate = null ) { diff --git a/src/Metadata/Property/Factory/AttributePropertyMetadataFactory.php b/src/Metadata/Property/Factory/AttributePropertyMetadataFactory.php index fb982eafe57..523168f10bd 100644 --- a/src/Metadata/Property/Factory/AttributePropertyMetadataFactory.php +++ b/src/Metadata/Property/Factory/AttributePropertyMetadataFactory.php @@ -110,7 +110,7 @@ private function handleNotFound(?ApiProperty $parentPropertyMetadata, string $re throw new PropertyNotFoundException(sprintf('Property "%s" of class "%s" not found.', $property, $resourceClass)); } - private function createMetadata(ApiProperty $attribute, ApiProperty $propertyMetadata = null): ApiProperty + private function createMetadata(ApiProperty $attribute, ?ApiProperty $propertyMetadata = null): ApiProperty { if (null === $propertyMetadata) { return $this->handleUserDefinedSchema($attribute); diff --git a/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php b/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php index ef0f660f8b2..e539a8906da 100644 --- a/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php +++ b/src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php @@ -30,7 +30,7 @@ final class SerializerPropertyMetadataFactory implements PropertyMetadataFactory { use ResourceClassInfoTrait; - public function __construct(private readonly SerializerClassMetadataFactoryInterface $serializerClassMetadataFactory, private readonly PropertyMetadataFactoryInterface $decorated, ResourceClassResolverInterface $resourceClassResolver = null) + public function __construct(private readonly SerializerClassMetadataFactoryInterface $serializerClassMetadataFactory, private readonly PropertyMetadataFactoryInterface $decorated, ?ResourceClassResolverInterface $resourceClassResolver = null) { $this->resourceClassResolver = $resourceClassResolver; } @@ -80,7 +80,7 @@ public function create(string $resourceClass, string $property, array $options = * @param string[]|null $normalizationGroups * @param string[]|null $denormalizationGroups */ - private function transformReadWrite(ApiProperty $propertyMetadata, string $resourceClass, string $propertyName, array $normalizationGroups = null, array $denormalizationGroups = null): ApiProperty + private function transformReadWrite(ApiProperty $propertyMetadata, string $resourceClass, string $propertyName, ?array $normalizationGroups = null, ?array $denormalizationGroups = null): ApiProperty { $serializerAttributeMetadata = $this->getSerializerAttributeMetadata($resourceClass, $propertyName); $groups = $serializerAttributeMetadata ? $serializerAttributeMetadata->getGroups() : []; @@ -106,7 +106,7 @@ private function transformReadWrite(ApiProperty $propertyMetadata, string $resou * @param string[]|null $normalizationGroups * @param string[]|null $denormalizationGroups */ - private function transformLinkStatus(ApiProperty $propertyMetadata, array $normalizationGroups = null, array $denormalizationGroups = null, array $types = null): ApiProperty + private function transformLinkStatus(ApiProperty $propertyMetadata, ?array $normalizationGroups = null, ?array $denormalizationGroups = null, ?array $types = null): ApiProperty { // No need to check link status if property is not readable and not writable if (false === $propertyMetadata->isReadable() && false === $propertyMetadata->isWritable()) { diff --git a/src/Metadata/Put.php b/src/Metadata/Put.php index 3157ddf1fea..230845711c7 100644 --- a/src/Metadata/Put.php +++ b/src/Metadata/Put.php @@ -20,78 +20,78 @@ final class Put extends HttpOperation { public function __construct( - string $uriTemplate = null, - array $types = null, + ?string $uriTemplate = null, + ?array $types = null, $formats = null, $inputFormats = null, $outputFormats = null, $uriVariables = null, - string $routePrefix = null, - string $routeName = null, - array $defaults = null, - array $requirements = null, - array $options = null, - bool $stateless = null, - string $sunset = null, - string $acceptPatch = null, + ?string $routePrefix = null, + ?string $routeName = null, + ?array $defaults = null, + ?array $requirements = null, + ?array $options = null, + ?bool $stateless = null, + ?string $sunset = null, + ?string $acceptPatch = null, $status = null, - string $host = null, - array $schemes = null, - string $condition = null, - string $controller = null, - array $cacheHeaders = null, - array $paginationViaCursor = null, - array $hydraContext = null, - array $openapiContext = null, - bool|OpenApiOperation $openapi = null, - array $exceptionToStatus = null, - bool $queryParameterValidationEnabled = null, - array $links = null, + ?string $host = null, + ?array $schemes = null, + ?string $condition = null, + ?string $controller = null, + ?array $cacheHeaders = null, + ?array $paginationViaCursor = null, + ?array $hydraContext = null, + ?array $openapiContext = null, + bool|OpenApiOperation|null $openapi = null, + ?array $exceptionToStatus = null, + ?bool $queryParameterValidationEnabled = null, + ?array $links = null, - string $shortName = null, - string $class = null, - bool $paginationEnabled = null, - string $paginationType = null, - int $paginationItemsPerPage = null, - int $paginationMaximumItemsPerPage = null, - bool $paginationPartial = null, - bool $paginationClientEnabled = null, - bool $paginationClientItemsPerPage = null, - bool $paginationClientPartial = null, - bool $paginationFetchJoinCollection = null, - bool $paginationUseOutputWalkers = null, - array $order = null, - string $description = null, - array $normalizationContext = null, - array $denormalizationContext = null, - bool $collectDenormalizationErrors = null, - string $security = null, - string $securityMessage = null, - string $securityPostDenormalize = null, - string $securityPostDenormalizeMessage = null, - string $securityPostValidation = null, - string $securityPostValidationMessage = null, - string $deprecationReason = null, - array $filters = null, - array $validationContext = null, + ?string $shortName = null, + ?string $class = null, + ?bool $paginationEnabled = null, + ?string $paginationType = null, + ?int $paginationItemsPerPage = null, + ?int $paginationMaximumItemsPerPage = null, + ?bool $paginationPartial = null, + ?bool $paginationClientEnabled = null, + ?bool $paginationClientItemsPerPage = null, + ?bool $paginationClientPartial = null, + ?bool $paginationFetchJoinCollection = null, + ?bool $paginationUseOutputWalkers = null, + ?array $order = null, + ?string $description = null, + ?array $normalizationContext = null, + ?array $denormalizationContext = null, + ?bool $collectDenormalizationErrors = null, + ?string $security = null, + ?string $securityMessage = null, + ?string $securityPostDenormalize = null, + ?string $securityPostDenormalizeMessage = null, + ?string $securityPostValidation = null, + ?string $securityPostValidationMessage = null, + ?string $deprecationReason = null, + ?array $filters = null, + ?array $validationContext = null, $input = null, $output = null, $mercure = null, $messenger = null, - bool $elasticsearch = null, - int $urlGenerationStrategy = null, - bool $read = null, - bool $deserialize = null, - bool $validate = null, - bool $write = null, - bool $serialize = null, - bool $fetchPartial = null, - bool $forceEager = null, - int $priority = null, - string $name = null, + ?bool $elasticsearch = null, + ?int $urlGenerationStrategy = null, + ?bool $read = null, + ?bool $deserialize = null, + ?bool $validate = null, + ?bool $write = null, + ?bool $serialize = null, + ?bool $fetchPartial = null, + ?bool $forceEager = null, + ?int $priority = null, + ?string $name = null, $provider = null, $processor = null, - OptionsInterface $stateOptions = null, + ?OptionsInterface $stateOptions = null, array $extraProperties = [], private ?bool $allowCreate = null, ) { diff --git a/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php b/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php index 8ea3fc76cdc..969de3a4a67 100644 --- a/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php +++ b/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php @@ -32,7 +32,7 @@ final class AttributesResourceMetadataCollectionFactory implements ResourceMetad { use OperationDefaultsTrait; - public function __construct(private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null, LoggerInterface $logger = null, array $defaults = [], private readonly bool $graphQlEnabled = false) + public function __construct(private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null, ?LoggerInterface $logger = null, array $defaults = [], private readonly bool $graphQlEnabled = false) { $this->logger = $logger ?? new NullLogger(); $this->defaults = $defaults; diff --git a/src/Metadata/Resource/Factory/ExtractorResourceMetadataCollectionFactory.php b/src/Metadata/Resource/Factory/ExtractorResourceMetadataCollectionFactory.php index e15764ff642..8c2b6b28de2 100644 --- a/src/Metadata/Resource/Factory/ExtractorResourceMetadataCollectionFactory.php +++ b/src/Metadata/Resource/Factory/ExtractorResourceMetadataCollectionFactory.php @@ -32,7 +32,7 @@ final class ExtractorResourceMetadataCollectionFactory implements ResourceMetada { use OperationDefaultsTrait; - public function __construct(private readonly ResourceExtractorInterface $extractor, private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null, array $defaults = [], LoggerInterface $logger = null, private readonly bool $graphQlEnabled = false) + public function __construct(private readonly ResourceExtractorInterface $extractor, private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null, array $defaults = [], ?LoggerInterface $logger = null, private readonly bool $graphQlEnabled = false) { $this->logger = $logger ?? new NullLogger(); $this->defaults = $defaults; diff --git a/src/Metadata/Resource/Factory/NotExposedOperationResourceMetadataCollectionFactory.php b/src/Metadata/Resource/Factory/NotExposedOperationResourceMetadataCollectionFactory.php index 2bd4401ceb2..cc84c0869ad 100644 --- a/src/Metadata/Resource/Factory/NotExposedOperationResourceMetadataCollectionFactory.php +++ b/src/Metadata/Resource/Factory/NotExposedOperationResourceMetadataCollectionFactory.php @@ -35,7 +35,7 @@ final class NotExposedOperationResourceMetadataCollectionFactory implements Reso private $linkFactory; private $decorated; - public function __construct(LinkFactoryInterface $linkFactory, ResourceMetadataCollectionFactoryInterface $decorated = null) + public function __construct(LinkFactoryInterface $linkFactory, ?ResourceMetadataCollectionFactoryInterface $decorated = null) { $this->linkFactory = $linkFactory; $this->decorated = $decorated; diff --git a/src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php b/src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php index d8f61484ea8..2a5163f424c 100644 --- a/src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php +++ b/src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php @@ -41,7 +41,7 @@ final class PhpDocResourceMetadataCollectionFactory implements ResourceMetadataC /** @var array */ private array $docBlocks = []; - public function __construct(private readonly ResourceMetadataCollectionFactoryInterface $decorated, DocBlockFactoryInterface $docBlockFactory = null) + public function __construct(private readonly ResourceMetadataCollectionFactoryInterface $decorated, ?DocBlockFactoryInterface $docBlockFactory = null) { $contextFactory = null; if ($docBlockFactory instanceof DocBlockFactoryInterface) { diff --git a/src/Metadata/Resource/ResourceMetadataCollection.php b/src/Metadata/Resource/ResourceMetadataCollection.php index 2a6c526ac7c..4e27d21bfce 100644 --- a/src/Metadata/Resource/ResourceMetadataCollection.php +++ b/src/Metadata/Resource/ResourceMetadataCollection.php @@ -35,7 +35,7 @@ public function __construct(private readonly string $resourceClass, array $input parent::__construct($input); } - public function getOperation(string $operationName = null, bool $forceCollection = false, bool $httpOperation = false): Operation + public function getOperation(?string $operationName = null, bool $forceCollection = false, bool $httpOperation = false): Operation { $operationName ??= ''; $cachePrefix = ($forceCollection ? self::FORCE_COLLECTION : '').($httpOperation ? self::HTTP_OPERATION : ''); diff --git a/src/Metadata/ResourceClassResolver.php b/src/Metadata/ResourceClassResolver.php index f2eb4f4dedb..54bca45dc86 100644 --- a/src/Metadata/ResourceClassResolver.php +++ b/src/Metadata/ResourceClassResolver.php @@ -36,7 +36,7 @@ public function __construct(private readonly ResourceNameCollectionFactoryInterf /** * {@inheritdoc} */ - public function getResourceClass(mixed $value, string $resourceClass = null, bool $strict = false): string + public function getResourceClass(mixed $value, ?string $resourceClass = null, bool $strict = false): string { if ($strict && null === $resourceClass) { throw new InvalidArgumentException('Strict checking is only possible when resource class is specified.'); diff --git a/src/Metadata/ResourceClassResolverInterface.php b/src/Metadata/ResourceClassResolverInterface.php index afb460bb252..95e6426b3a2 100644 --- a/src/Metadata/ResourceClassResolverInterface.php +++ b/src/Metadata/ResourceClassResolverInterface.php @@ -42,7 +42,7 @@ interface ResourceClassResolverInterface * * @throws InvalidArgumentException */ - public function getResourceClass(mixed $value, string $resourceClass = null, bool $strict = false): string; + public function getResourceClass(mixed $value, ?string $resourceClass = null, bool $strict = false): string; /** * Is the given class a resource class? diff --git a/src/Metadata/Tests/Extractor/Adapter/XmlResourceAdapter.php b/src/Metadata/Tests/Extractor/Adapter/XmlResourceAdapter.php index 98432490002..d826c2390d7 100644 --- a/src/Metadata/Tests/Extractor/Adapter/XmlResourceAdapter.php +++ b/src/Metadata/Tests/Extractor/Adapter/XmlResourceAdapter.php @@ -495,7 +495,7 @@ private function buildValues(\SimpleXMLElement $resource, array $values): void } } - private function buildLinks(\SimpleXMLElement $resource, array $values = null): void + private function buildLinks(\SimpleXMLElement $resource, ?array $values = null): void { if (!$values) { return; diff --git a/src/Metadata/Tests/Fixtures/ApiResource/Dummy.php b/src/Metadata/Tests/Fixtures/ApiResource/Dummy.php index b87852b2fcd..c2eaa83d8c1 100644 --- a/src/Metadata/Tests/Fixtures/ApiResource/Dummy.php +++ b/src/Metadata/Tests/Fixtures/ApiResource/Dummy.php @@ -147,12 +147,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/src/Metadata/Tests/Resource/Factory/LinkFactoryTest.php b/src/Metadata/Tests/Resource/Factory/LinkFactoryTest.php index ac7136f6062..499db9e4104 100644 --- a/src/Metadata/Tests/Resource/Factory/LinkFactoryTest.php +++ b/src/Metadata/Tests/Resource/Factory/LinkFactoryTest.php @@ -39,7 +39,7 @@ final class LinkFactoryTest extends TestCase /** * @dataProvider provideCreateLinksFromIdentifiersCases */ - public function testCreateLinksFromIdentifiers(array $propertyNames, bool $compositeIdentifier, array $expectedLinks, bool $idAsIdentifier = null): void + public function testCreateLinksFromIdentifiers(array $propertyNames, bool $compositeIdentifier, array $expectedLinks, ?bool $idAsIdentifier = null): void { $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class); $propertyNameCollectionFactoryProphecy->create(Argument::cetera())->willReturn(new PropertyNameCollection($propertyNames)); diff --git a/src/Metadata/Util/AttributeFilterExtractorTrait.php b/src/Metadata/Util/AttributeFilterExtractorTrait.php index 44871a32989..70bf390fb0a 100644 --- a/src/Metadata/Util/AttributeFilterExtractorTrait.php +++ b/src/Metadata/Util/AttributeFilterExtractorTrait.php @@ -41,7 +41,7 @@ private function getFilterAttributes(\ReflectionClass|\ReflectionProperty $refle /** * Given a filter attribute and reflection elements, find out the properties where the filter is applied. */ - private function getFilterProperties(ApiFilter $filterAttribute, \ReflectionClass $reflectionClass, \ReflectionProperty $reflectionProperty = null): array + private function getFilterProperties(ApiFilter $filterAttribute, \ReflectionClass $reflectionClass, ?\ReflectionProperty $reflectionProperty = null): array { $properties = []; @@ -129,7 +129,7 @@ private function readFilterAttributes(\ReflectionClass $reflectionClass): array * @param string $filterClass the filter class * @param string|null $filterId the filter id */ - private function generateFilterId(\ReflectionClass $reflectionClass, string $filterClass, string $filterId = null): string + private function generateFilterId(\ReflectionClass $reflectionClass, string $filterClass, ?string $filterId = null): string { $suffix = null !== $filterId ? '_'.$filterId : $filterId; diff --git a/src/Metadata/Util/CamelCaseToSnakeCaseNameConverter.php b/src/Metadata/Util/CamelCaseToSnakeCaseNameConverter.php index 4153eac434b..2135d8a588f 100644 --- a/src/Metadata/Util/CamelCaseToSnakeCaseNameConverter.php +++ b/src/Metadata/Util/CamelCaseToSnakeCaseNameConverter.php @@ -38,7 +38,7 @@ class CamelCaseToSnakeCaseNameConverter * @param array|null $attributes The list of attributes to rename or null for all attributes * @param bool $lowerCamelCase Use lowerCamelCase style */ - public function __construct(array $attributes = null, bool $lowerCamelCase = true) + public function __construct(?array $attributes = null, bool $lowerCamelCase = true) { $this->attributes = $attributes; $this->lowerCamelCase = $lowerCamelCase; diff --git a/src/OpenApi/Factory/OpenApiFactory.php b/src/OpenApi/Factory/OpenApiFactory.php index 6f18de73814..89548f43574 100644 --- a/src/OpenApi/Factory/OpenApiFactory.php +++ b/src/OpenApi/Factory/OpenApiFactory.php @@ -70,7 +70,7 @@ final class OpenApiFactory implements OpenApiFactoryInterface */ public const OPENAPI_DEFINITION_NAME = 'openapi_definition_name'; - public function __construct(private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, private readonly SchemaFactoryInterface $jsonSchemaFactory, private readonly TypeFactoryInterface $jsonSchemaTypeFactory, ContainerInterface $filterLocator, private readonly array $formats = [], Options $openApiOptions = null, PaginationOptions $paginationOptions = null, private readonly ?RouterInterface $router = null) + public function __construct(private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, private readonly SchemaFactoryInterface $jsonSchemaFactory, private readonly TypeFactoryInterface $jsonSchemaTypeFactory, ContainerInterface $filterLocator, private readonly array $formats = [], ?Options $openApiOptions = null, ?PaginationOptions $paginationOptions = null, private readonly ?RouterInterface $router = null) { $this->filterLocator = $filterLocator; $this->openApiOptions = $openApiOptions ?: new Options('API Platform'); @@ -388,7 +388,7 @@ private function collectPaths(ApiResource $resource, ResourceMetadataCollection } } - private function buildOpenApiResponse(array $existingResponses, int|string $status, string $description, Model\Operation $openapiOperation = null, HttpOperation $operation = null, array $responseMimeTypes = null, array $operationOutputSchemas = null, ResourceMetadataCollection $resourceMetadataCollection = null): Model\Operation + private function buildOpenApiResponse(array $existingResponses, int|string $status, string $description, ?Model\Operation $openapiOperation = null, ?HttpOperation $operation = null, ?array $responseMimeTypes = null, ?array $operationOutputSchemas = null, ?ResourceMetadataCollection $resourceMetadataCollection = null): Model\Operation { if (isset($existingResponses[$status])) { return $openapiOperation; diff --git a/src/OpenApi/Model/Components.php b/src/OpenApi/Model/Components.php index 8500575afe2..cc420cf1f3e 100644 --- a/src/OpenApi/Model/Components.php +++ b/src/OpenApi/Model/Components.php @@ -31,7 +31,7 @@ final class Components * @param \ArrayObject>|\ArrayObject> $callbacks * @param \ArrayObject|\ArrayObject $pathItems */ - public function __construct(\ArrayObject $schemas = null, private ?\ArrayObject $responses = null, private ?\ArrayObject $parameters = null, private ?\ArrayObject $examples = null, private ?\ArrayObject $requestBodies = null, private ?\ArrayObject $headers = null, private ?\ArrayObject $securitySchemes = null, private ?\ArrayObject $links = null, private ?\ArrayObject $callbacks = null, private ?\ArrayObject $pathItems = null) + public function __construct(?\ArrayObject $schemas = null, private ?\ArrayObject $responses = null, private ?\ArrayObject $parameters = null, private ?\ArrayObject $examples = null, private ?\ArrayObject $requestBodies = null, private ?\ArrayObject $headers = null, private ?\ArrayObject $securitySchemes = null, private ?\ArrayObject $links = null, private ?\ArrayObject $callbacks = null, private ?\ArrayObject $pathItems = null) { $schemas?->ksort(); diff --git a/src/OpenApi/Model/Operation.php b/src/OpenApi/Model/Operation.php index 22de521fbd7..db2aac878be 100644 --- a/src/OpenApi/Model/Operation.php +++ b/src/OpenApi/Model/Operation.php @@ -167,7 +167,7 @@ public function withParameter(Parameter $parameter): self return $clone; } - public function withRequestBody(RequestBody $requestBody = null): self + public function withRequestBody(?RequestBody $requestBody = null): self { $clone = clone $this; $clone->requestBody = $requestBody; @@ -191,7 +191,7 @@ public function withDeprecated(bool $deprecated): self return $clone; } - public function withSecurity(array $security = null): self + public function withSecurity(?array $security = null): self { $clone = clone $this; $clone->security = $security; @@ -199,7 +199,7 @@ public function withSecurity(array $security = null): self return $clone; } - public function withServers(array $servers = null): self + public function withServers(?array $servers = null): self { $clone = clone $this; $clone->servers = $servers; diff --git a/src/OpenApi/Model/PathItem.php b/src/OpenApi/Model/PathItem.php index 5a101bcf3a7..42a6d883e3f 100644 --- a/src/OpenApi/Model/PathItem.php +++ b/src/OpenApi/Model/PathItem.php @@ -176,7 +176,7 @@ public function withTrace(Operation $trace): self return $clone; } - public function withServers(array $servers = null): self + public function withServers(?array $servers = null): self { $clone = clone $this; $clone->servers = $servers; diff --git a/src/OpenApi/Serializer/ApiGatewayNormalizer.php b/src/OpenApi/Serializer/ApiGatewayNormalizer.php index 78b84c63ce1..66e36e4bf1c 100644 --- a/src/OpenApi/Serializer/ApiGatewayNormalizer.php +++ b/src/OpenApi/Serializer/ApiGatewayNormalizer.php @@ -44,7 +44,7 @@ public function __construct(private readonly NormalizerInterface $documentationN * * @throws UnexpectedValueException */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $data = $this->documentationNormalizer->normalize($object, $format, $context); if (!\is_array($data)) { @@ -116,7 +116,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $this->documentationNormalizer->supportsNormalization($data, $format); } diff --git a/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php b/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php index 16a6b730e0e..64d7f166f97 100644 --- a/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php +++ b/src/OpenApi/Serializer/LegacyOpenApiNormalizer.php @@ -27,7 +27,7 @@ public function __construct(private readonly NormalizerInterface $decorated, $de $this->defaultContext = array_merge($this->defaultContext, $defaultContext); } - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { $openapi = $this->decorated->normalize($object, $format, $context); @@ -54,7 +54,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $this->decorated->supportsNormalization($data, $format, $context); } diff --git a/src/OpenApi/Serializer/OpenApiNormalizer.php b/src/OpenApi/Serializer/OpenApiNormalizer.php index a11fcb6e5dc..b2d179450a9 100644 --- a/src/OpenApi/Serializer/OpenApiNormalizer.php +++ b/src/OpenApi/Serializer/OpenApiNormalizer.php @@ -37,7 +37,7 @@ public function __construct(private readonly NormalizerInterface $decorated) /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { $pathsCallback = static fn ($decoratedObject): array => $decoratedObject instanceof Paths ? $decoratedObject->getPaths() : []; $context[AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS] = true; @@ -72,7 +72,7 @@ private function recursiveClean(array $data): array /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return (self::FORMAT === $format || self::JSON_FORMAT === $format || self::YAML_FORMAT === $format) && $data instanceof OpenApi; } diff --git a/src/OpenApi/Tests/Fixtures/Dummy.php b/src/OpenApi/Tests/Fixtures/Dummy.php index c8a0349a2fa..f6d73d7556d 100644 --- a/src/OpenApi/Tests/Fixtures/Dummy.php +++ b/src/OpenApi/Tests/Fixtures/Dummy.php @@ -156,12 +156,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/src/Problem/Serializer/ConstraintViolationListNormalizer.php b/src/Problem/Serializer/ConstraintViolationListNormalizer.php index 86ad62875c4..a23f4255e7e 100644 --- a/src/Problem/Serializer/ConstraintViolationListNormalizer.php +++ b/src/Problem/Serializer/ConstraintViolationListNormalizer.php @@ -34,7 +34,7 @@ final class ConstraintViolationListNormalizer extends AbstractConstraintViolatio self::TITLE => 'An error occurred', ]; - public function __construct(array $serializePayloadFields = null, NameConverterInterface $nameConverter = null, array $defaultContext = []) + public function __construct(?array $serializePayloadFields = null, ?NameConverterInterface $nameConverter = null, array $defaultContext = []) { parent::__construct($serializePayloadFields, $nameConverter); @@ -44,7 +44,7 @@ public function __construct(array $serializePayloadFields = null, NameConverterI /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { [$messages, $violations] = $this->getMessagesAndViolations($object); diff --git a/src/Problem/Serializer/ErrorNormalizer.php b/src/Problem/Serializer/ErrorNormalizer.php index 7f68e3b8042..d62b32e64fb 100644 --- a/src/Problem/Serializer/ErrorNormalizer.php +++ b/src/Problem/Serializer/ErrorNormalizer.php @@ -45,7 +45,7 @@ public function __construct(private readonly bool $debug = false, array $default /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { $data = [ 'type' => $context[self::TYPE] ?? $this->defaultContext[self::TYPE], @@ -63,7 +63,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { if ($context['api_error_resource'] ?? false) { return false; diff --git a/src/RamseyUuid/Serializer/UuidDenormalizer.php b/src/RamseyUuid/Serializer/UuidDenormalizer.php index 5f9f5d7c3b9..2cb8b0b3050 100644 --- a/src/RamseyUuid/Serializer/UuidDenormalizer.php +++ b/src/RamseyUuid/Serializer/UuidDenormalizer.php @@ -24,7 +24,7 @@ final class UuidDenormalizer implements DenormalizerInterface /** * {@inheritdoc} */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): UuidInterface + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): UuidInterface { try { return Uuid::fromString($data); @@ -33,7 +33,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar } } - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return \is_string($data) && is_a($type, UuidInterface::class, true); } diff --git a/src/Serializer/AbstractCollectionNormalizer.php b/src/Serializer/AbstractCollectionNormalizer.php index f45c1328267..96d2eb06c7f 100644 --- a/src/Serializer/AbstractCollectionNormalizer.php +++ b/src/Serializer/AbstractCollectionNormalizer.php @@ -50,7 +50,7 @@ public function __construct(protected ResourceClassResolverInterface|LegacyResou /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return static::FORMAT === $format && is_iterable($data); } @@ -91,7 +91,7 @@ public function getSupportedTypes(?string $format): array * * @param iterable $object */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { if (!isset($context['resource_class']) || isset($context['api_sub_level'])) { return $this->normalizeRawCollection($object, $format, $context); @@ -111,7 +111,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * Normalizes a raw collection (not API resources). */ - protected function normalizeRawCollection(iterable $object, string $format = null, array $context = []): array|\ArrayObject + protected function normalizeRawCollection(iterable $object, ?string $format = null, array $context = []): array|\ArrayObject { if (!$object && ($context[Serializer::EMPTY_ARRAY_AS_OBJECT] ?? false) && \is_array($object)) { return new \ArrayObject(); @@ -166,5 +166,5 @@ abstract protected function getPaginationData(iterable $object, array $context = /** * Gets items data. */ - abstract protected function getItemsData(iterable $object, string $format = null, array $context = []): array; + abstract protected function getItemsData(iterable $object, ?string $format = null, array $context = []): array; } diff --git a/src/Serializer/AbstractConstraintViolationListNormalizer.php b/src/Serializer/AbstractConstraintViolationListNormalizer.php index 45eca2ef9bd..edded9d7c48 100644 --- a/src/Serializer/AbstractConstraintViolationListNormalizer.php +++ b/src/Serializer/AbstractConstraintViolationListNormalizer.php @@ -33,7 +33,7 @@ abstract class AbstractConstraintViolationListNormalizer implements NormalizerIn private readonly ?array $serializePayloadFields; - public function __construct(array $serializePayloadFields = null, private readonly ?NameConverterInterface $nameConverter = null) + public function __construct(?array $serializePayloadFields = null, private readonly ?NameConverterInterface $nameConverter = null) { $this->serializePayloadFields = null === $serializePayloadFields ? null : array_flip($serializePayloadFields); } @@ -41,7 +41,7 @@ public function __construct(array $serializePayloadFields = null, private readon /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return static::FORMAT === $format && $data instanceof ConstraintViolationListInterface; } diff --git a/src/Serializer/AbstractItemNormalizer.php b/src/Serializer/AbstractItemNormalizer.php index 53ba64f31b2..b74a97a78ad 100644 --- a/src/Serializer/AbstractItemNormalizer.php +++ b/src/Serializer/AbstractItemNormalizer.php @@ -63,7 +63,7 @@ abstract class AbstractItemNormalizer extends AbstractObjectNormalizer protected array $localCache = []; protected array $localFactoryOptionsCache = []; - public function __construct(protected PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, protected PropertyMetadataFactoryInterface $propertyMetadataFactory, protected LegacyIriConverterInterface|IriConverterInterface $iriConverter, protected LegacyResourceClassResolverInterface|ResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, protected ?ResourceAccessCheckerInterface $resourceAccessChecker = null) + public function __construct(protected PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, protected PropertyMetadataFactoryInterface $propertyMetadataFactory, protected LegacyIriConverterInterface|IriConverterInterface $iriConverter, protected LegacyResourceClassResolverInterface|ResourceClassResolverInterface $resourceClassResolver, ?PropertyAccessorInterface $propertyAccessor = null, ?NameConverterInterface $nameConverter = null, ?ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, protected ?ResourceAccessCheckerInterface $resourceAccessChecker = null) { if (!isset($defaultContext['circular_reference_handler'])) { $defaultContext['circular_reference_handler'] = fn ($object): ?string => $this->iriConverter->getIriFromResource($object); @@ -77,7 +77,7 @@ public function __construct(protected PropertyNameCollectionFactoryInterface $pr /** * {@inheritdoc} */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { if (!\is_object($data) || is_iterable($data)) { return false; @@ -120,7 +120,7 @@ public function hasCacheableSupportsMethod(): bool * * @throws LogicException */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $resourceClass = $context['force_resource_class'] ?? $this->getObjectClass($object); if ($outputClass = $this->getOutputClass($context)) { @@ -180,7 +180,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * {@inheritdoc} */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { if (($context['input']['class'] ?? null) === $type) { return true; @@ -192,7 +192,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma /** * {@inheritdoc} */ - public function denormalize(mixed $data, string $class, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $class, ?string $format = null, array $context = []): mixed { $resourceClass = $class; @@ -281,7 +281,7 @@ public function denormalize(mixed $data, string $class, string $format = null, a * * @internal */ - protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, string $format = null): object + protected function instantiateObject(array &$data, string $class, array &$context, \ReflectionClass $reflectionClass, array|bool $allowedAttributes, ?string $format = null): object { if (null !== $object = $this->extractObjectToPopulate($class, $context, static::OBJECT_TO_POPULATE)) { unset($context[static::OBJECT_TO_POPULATE]); @@ -371,7 +371,7 @@ protected function getClassDiscriminatorResolvedClass(array $data, string $class return $mappedClass; } - protected function createConstructorArgument($parameterData, string $key, \ReflectionParameter $constructorParameter, array &$context, string $format = null): mixed + protected function createConstructorArgument($parameterData, string $key, \ReflectionParameter $constructorParameter, array &$context, ?string $format = null): mixed { return $this->createAndValidateAttributeValue($constructorParameter->name, $parameterData, $format, $context); } @@ -421,7 +421,7 @@ protected function getAllowedAttributes(string|object $classOrObject, array $con /** * {@inheritdoc} */ - protected function isAllowedAttribute(object|string $classOrObject, string $attribute, string $format = null, array $context = []): bool + protected function isAllowedAttribute(object|string $classOrObject, string $attribute, ?string $format = null, array $context = []): bool { if (!parent::isAllowedAttribute($classOrObject, $attribute, $format, $context)) { return false; @@ -472,7 +472,7 @@ protected function canAccessAttributePostDenormalize(?object $object, ?object $p /** * {@inheritdoc} */ - protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = []): void + protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []): void { try { $this->setValue($object, $attribute, $this->createAttributeValue($attribute, $value, $format, $context)); @@ -489,7 +489,7 @@ protected function setAttributeValue(object $object, string $attribute, mixed $v * * @throws NotNormalizableValueException */ - protected function validateType(string $attribute, Type $type, mixed $value, string $format = null, array $context = []): void + protected function validateType(string $attribute, Type $type, mixed $value, ?string $format = null, array $context = []): void { $builtinType = $type->getBuiltinType(); if (Type::BUILTIN_TYPE_FLOAT === $builtinType && null !== $format && str_contains($format, 'json')) { @@ -631,7 +631,7 @@ protected function getFactoryOptions(array $context): array * * @throws UnexpectedValueException */ - protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed + protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed { $context['api_attribute'] = $attribute; $propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $this->getFactoryOptions($context)); @@ -804,7 +804,7 @@ protected function normalizeRelation(ApiProperty $propertyMetadata, ?object $rel return $iri; } - private function createAttributeValue(string $attribute, mixed $value, string $format = null, array &$context = []): mixed + private function createAttributeValue(string $attribute, mixed $value, ?string $format = null, array &$context = []): mixed { try { return $this->createAndValidateAttributeValue($attribute, $value, $format, $context); @@ -818,7 +818,7 @@ private function createAttributeValue(string $attribute, mixed $value, string $f } } - private function createAndValidateAttributeValue(string $attribute, mixed $value, string $format = null, array $context = []): mixed + private function createAndValidateAttributeValue(string $attribute, mixed $value, ?string $format = null, array $context = []): mixed { $propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $this->getFactoryOptions($context)); $types = $propertyMetadata->getBuiltinTypes() ?? []; diff --git a/src/Serializer/ConstraintViolationListNormalizer.php b/src/Serializer/ConstraintViolationListNormalizer.php index 567e89437f9..d6c2e7907af 100644 --- a/src/Serializer/ConstraintViolationListNormalizer.php +++ b/src/Serializer/ConstraintViolationListNormalizer.php @@ -26,7 +26,7 @@ final class ConstraintViolationListNormalizer extends AbstractConstraintViolatio { public const FORMAT = 'json'; - public function __construct(array $serializePayloadFields = null, NameConverterInterface $nameConverter = null) + public function __construct(?array $serializePayloadFields = null, ?NameConverterInterface $nameConverter = null) { parent::__construct($serializePayloadFields, $nameConverter); } @@ -34,7 +34,7 @@ public function __construct(array $serializePayloadFields = null, NameConverterI /** * {@inheritdoc} */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { [$messages, $violations] = $this->getMessagesAndViolations($object); diff --git a/src/Serializer/Filter/PropertyFilter.php b/src/Serializer/Filter/PropertyFilter.php index d9291757c75..85a5085f874 100644 --- a/src/Serializer/Filter/PropertyFilter.php +++ b/src/Serializer/Filter/PropertyFilter.php @@ -117,7 +117,7 @@ final class PropertyFilter implements FilterInterface { private ?array $whitelist; - public function __construct(private readonly string $parameterName = 'properties', private readonly bool $overrideDefaultProperties = false, array $whitelist = null, private readonly ?NameConverterInterface $nameConverter = null) + public function __construct(private readonly string $parameterName = 'properties', private readonly bool $overrideDefaultProperties = false, ?array $whitelist = null, private readonly ?NameConverterInterface $nameConverter = null) { $this->whitelist = null === $whitelist ? null : $this->formatWhitelist($whitelist); } @@ -213,7 +213,7 @@ private function formatWhitelist(array $whitelist): array return $whitelist; } - private function getProperties(array $properties, array $whitelist = null): array + private function getProperties(array $properties, ?array $whitelist = null): array { $whitelist ??= $this->whitelist; $result = []; diff --git a/src/Serializer/ItemNormalizer.php b/src/Serializer/ItemNormalizer.php index c5b971f7c0b..c532127fc10 100644 --- a/src/Serializer/ItemNormalizer.php +++ b/src/Serializer/ItemNormalizer.php @@ -39,7 +39,7 @@ class ItemNormalizer extends AbstractItemNormalizer { private readonly LoggerInterface $logger; - public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface $iriConverter, ResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, LoggerInterface $logger = null, ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, ResourceAccessCheckerInterface $resourceAccessChecker = null, array $defaultContext = []) + public function __construct(PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface $iriConverter, ResourceClassResolverInterface $resourceClassResolver, ?PropertyAccessorInterface $propertyAccessor = null, ?NameConverterInterface $nameConverter = null, ?ClassMetadataFactoryInterface $classMetadataFactory = null, ?LoggerInterface $logger = null, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, ?ResourceAccessCheckerInterface $resourceAccessChecker = null, array $defaultContext = []) { parent::__construct($propertyNameCollectionFactory, $propertyMetadataFactory, $iriConverter, $resourceClassResolver, $propertyAccessor, $nameConverter, $classMetadataFactory, $defaultContext, $resourceMetadataFactory, $resourceAccessChecker); @@ -51,7 +51,7 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName * * @throws NotNormalizableValueException */ - public function denormalize(mixed $data, string $class, string $format = null, array $context = []): mixed + public function denormalize(mixed $data, string $class, ?string $format = null, array $context = []): mixed { // Avoid issues with proxies if we populated the object if (isset($data['id']) && !isset($context[self::OBJECT_TO_POPULATE])) { diff --git a/src/Serializer/OperationContextTrait.php b/src/Serializer/OperationContextTrait.php index c0d188a7004..ff96945c183 100644 --- a/src/Serializer/OperationContextTrait.php +++ b/src/Serializer/OperationContextTrait.php @@ -22,7 +22,7 @@ trait OperationContextTrait * This context is created when working on a relation context or items of a collection. It cleans the previously given * context as the operation changes. */ - protected function createOperationContext(array $context, string $resourceClass = null): array + protected function createOperationContext(array $context, ?string $resourceClass = null): array { if (isset($context['operation']) && !isset($context['root_operation'])) { $context['root_operation'] = $context['operation']; diff --git a/src/Serializer/SerializerContextBuilder.php b/src/Serializer/SerializerContextBuilder.php index 19c2c9c75f1..ee17ba56090 100644 --- a/src/Serializer/SerializerContextBuilder.php +++ b/src/Serializer/SerializerContextBuilder.php @@ -38,7 +38,7 @@ public function __construct(private readonly ?ResourceMetadataCollectionFactoryI /** * {@inheritdoc} */ - public function createFromRequest(Request $request, bool $normalization, array $attributes = null): array + public function createFromRequest(Request $request, bool $normalization, ?array $attributes = null): array { if (null === $attributes && !$attributes = RequestAttributesExtractor::extractAttributes($request)) { throw new RuntimeException('Request attributes are not valid.'); diff --git a/src/Serializer/SerializerContextBuilderInterface.php b/src/Serializer/SerializerContextBuilderInterface.php index 96ac637defa..ba6eb4707f4 100644 --- a/src/Serializer/SerializerContextBuilderInterface.php +++ b/src/Serializer/SerializerContextBuilderInterface.php @@ -28,5 +28,5 @@ interface SerializerContextBuilderInterface * * @throws RuntimeException */ - public function createFromRequest(Request $request, bool $normalization, array $extractedAttributes = null): array; + public function createFromRequest(Request $request, bool $normalization, ?array $extractedAttributes = null): array; } diff --git a/src/Serializer/SerializerFilterContextBuilder.php b/src/Serializer/SerializerFilterContextBuilder.php index cf80894b459..7e5a7199800 100644 --- a/src/Serializer/SerializerFilterContextBuilder.php +++ b/src/Serializer/SerializerFilterContextBuilder.php @@ -34,7 +34,7 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn /** * {@inheritdoc} */ - public function createFromRequest(Request $request, bool $normalization, array $attributes = null): array + public function createFromRequest(Request $request, bool $normalization, ?array $attributes = null): array { if (null === $attributes && !$attributes = RequestAttributesExtractor::extractAttributes($request)) { throw new RuntimeException('Request attributes are not valid.'); diff --git a/src/Serializer/Tests/Fixtures/ApiResource/Dummy.php b/src/Serializer/Tests/Fixtures/ApiResource/Dummy.php index 748d9338578..ea62a525bae 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/Dummy.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/Dummy.php @@ -158,12 +158,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/src/Serializer/Tests/SerializerFilterContextBuilderTest.php b/src/Serializer/Tests/SerializerFilterContextBuilderTest.php index 1631f21c0b8..a06b8ce34f7 100644 --- a/src/Serializer/Tests/SerializerFilterContextBuilderTest.php +++ b/src/Serializer/Tests/SerializerFilterContextBuilderTest.php @@ -178,7 +178,7 @@ public function testCreateFromRequestThrowsExceptionWithoutAttributesAndRequestA $serializerContextBuilderFilter->createFromRequest($request, true); } - private function getMetadataWithFilter(string $class, array $filters = null): ResourceMetadataCollection + private function getMetadataWithFilter(string $class, ?array $filters = null): ResourceMetadataCollection { return new ResourceMetadataCollection($class, [ new ApiResource(operations: [ diff --git a/src/State/ApiResource/Error.php b/src/State/ApiResource/Error.php index d606fc72fb2..3141026c0d2 100644 --- a/src/State/ApiResource/Error.php +++ b/src/State/ApiResource/Error.php @@ -69,11 +69,11 @@ public function __construct( private string $title, private string $detail, #[ApiProperty(identifier: true)] private int $status, - array $originalTrace = null, + ?array $originalTrace = null, private ?string $instance = null, private string $type = 'about:blank', private array $headers = [], - \Throwable $previous = null + ?\Throwable $previous = null ) { parent::__construct($title, $status, $previous); @@ -156,7 +156,7 @@ public function getTitle(): ?string return $this->title; } - public function setTitle(string $title = null): void + public function setTitle(?string $title = null): void { $this->title = $title; } @@ -178,7 +178,7 @@ public function getDetail(): ?string return $this->detail; } - public function setDetail(string $detail = null): void + public function setDetail(?string $detail = null): void { $this->detail = $detail; } @@ -189,7 +189,7 @@ public function getInstance(): ?string return $this->instance; } - public function setInstance(string $instance = null): void + public function setInstance(?string $instance = null): void { $this->instance = $instance; } diff --git a/src/State/Pagination/Pagination.php b/src/State/Pagination/Pagination.php index e680a474db6..28c21a60c90 100644 --- a/src/State/Pagination/Pagination.php +++ b/src/State/Pagination/Pagination.php @@ -70,7 +70,7 @@ public function getPage(array $context = []): int /** * Gets the current offset. */ - public function getOffset(Operation $operation = null, array $context = []): int + public function getOffset(?Operation $operation = null, array $context = []): int { $graphql = (bool) ($context['graphql_operation_name'] ?? false); @@ -102,7 +102,7 @@ public function getOffset(Operation $operation = null, array $context = []): int * * @throws InvalidArgumentException */ - public function getLimit(Operation $operation = null, array $context = []): int + public function getLimit(?Operation $operation = null, array $context = []): int { $graphql = (bool) ($context['graphql_operation_name'] ?? false); @@ -148,7 +148,7 @@ public function getLimit(Operation $operation = null, array $context = []): int * * @throws InvalidArgumentException */ - public function getPagination(Operation $operation = null, array $context = []): array + public function getPagination(?Operation $operation = null, array $context = []): array { $page = $this->getPage($context); $limit = $this->getLimit($operation, $context); @@ -163,7 +163,7 @@ public function getPagination(Operation $operation = null, array $context = []): /** * Is the pagination enabled? */ - public function isEnabled(Operation $operation = null, array $context = []): bool + public function isEnabled(?Operation $operation = null, array $context = []): bool { return $this->getEnabled($context, $operation); } @@ -171,7 +171,7 @@ public function isEnabled(Operation $operation = null, array $context = []): boo /** * Is the pagination enabled for GraphQL? */ - public function isGraphQlEnabled(Operation $operation = null, array $context = []): bool + public function isGraphQlEnabled(?Operation $operation = null, array $context = []): bool { return $this->getGraphQlEnabled($operation); } @@ -179,7 +179,7 @@ public function isGraphQlEnabled(Operation $operation = null, array $context = [ /** * Is the partial pagination enabled? */ - public function isPartialEnabled(Operation $operation = null, array $context = []): bool + public function isPartialEnabled(?Operation $operation = null, array $context = []): bool { return $this->getEnabled($context, $operation, true); } @@ -197,7 +197,7 @@ public function getGraphQlPaginationType(Operation $operation): string /** * Is the classic or partial pagination enabled? */ - private function getEnabled(array $context, Operation $operation = null, bool $partial = false): bool + private function getEnabled(array $context, ?Operation $operation = null, bool $partial = false): bool { $enabled = $this->options[$partial ? 'partial' : 'enabled']; $clientEnabled = $this->options[$partial ? 'client_partial' : 'client_enabled']; diff --git a/src/State/Provider/ContentNegotiationProvider.php b/src/State/Provider/ContentNegotiationProvider.php index 05da2a02b65..a6baf0eea9d 100644 --- a/src/State/Provider/ContentNegotiationProvider.php +++ b/src/State/Provider/ContentNegotiationProvider.php @@ -30,7 +30,7 @@ final class ContentNegotiationProvider implements ProviderInterface * @param array $formats * @param array $errorFormats */ - public function __construct(private readonly ProviderInterface $decorated, Negotiator $negotiator = null, private readonly array $formats = [], private readonly array $errorFormats = []) + public function __construct(private readonly ProviderInterface $decorated, ?Negotiator $negotiator = null, private readonly array $formats = [], private readonly array $errorFormats = []) { $this->negotiator = $negotiator ?? new Negotiator(); } diff --git a/src/State/UriVariablesResolverTrait.php b/src/State/UriVariablesResolverTrait.php index b67695b92a9..ffabb6d7154 100644 --- a/src/State/UriVariablesResolverTrait.php +++ b/src/State/UriVariablesResolverTrait.php @@ -21,12 +21,12 @@ trait UriVariablesResolverTrait { - private null|LegacyUriVariablesConverterInterface|UriVariablesConverterInterface $uriVariablesConverter = null; + private LegacyUriVariablesConverterInterface|UriVariablesConverterInterface|null $uriVariablesConverter = null; /** * Resolves an operation's UriVariables to their identifiers values. */ - private function getOperationUriVariables(HttpOperation $operation = null, array $parameters = [], string $resourceClass = null): array + private function getOperationUriVariables(?HttpOperation $operation = null, array $parameters = [], ?string $resourceClass = null): array { $identifiers = []; diff --git a/src/Symfony/Bundle/CacheWarmer/CachePoolClearerCacheWarmer.php b/src/Symfony/Bundle/CacheWarmer/CachePoolClearerCacheWarmer.php index 4dba3c714f5..cf18f736010 100644 --- a/src/Symfony/Bundle/CacheWarmer/CachePoolClearerCacheWarmer.php +++ b/src/Symfony/Bundle/CacheWarmer/CachePoolClearerCacheWarmer.php @@ -34,7 +34,7 @@ public function __construct(private readonly Psr6CacheClearer $poolClearer, priv * * @return string[] */ - public function warmUp(string $cacheDir, string $buildDir = null): array + public function warmUp(string $cacheDir, ?string $buildDir = null): array { foreach ($this->pools as $pool) { if ($this->poolClearer->hasPool($pool)) { diff --git a/src/Symfony/Bundle/DataCollector/RequestDataCollector.php b/src/Symfony/Bundle/DataCollector/RequestDataCollector.php index 38386ddb2a1..cd347421171 100644 --- a/src/Symfony/Bundle/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Bundle/DataCollector/RequestDataCollector.php @@ -36,7 +36,7 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn /** * {@inheritdoc} */ - public function collect(Request $request, Response $response, \Throwable $exception = null): void + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { if ($request->attributes->get('_graphql', false)) { $resourceClasses = array_keys($request->attributes->get('_graphql_args', [])); diff --git a/src/Symfony/Bundle/Test/ApiTestAssertionsTrait.php b/src/Symfony/Bundle/Test/ApiTestAssertionsTrait.php index 715ab6d99ef..5c3c0f2437b 100644 --- a/src/Symfony/Bundle/Test/ApiTestAssertionsTrait.php +++ b/src/Symfony/Bundle/Test/ApiTestAssertionsTrait.php @@ -102,14 +102,14 @@ public static function assertArraySubset(iterable $subset, iterable $array, bool static::assertThat($array, $constraint, $message); } - public static function assertMatchesJsonSchema(object|array|string $jsonSchema, int $checkMode = null, string $message = ''): void + public static function assertMatchesJsonSchema(object|array|string $jsonSchema, ?int $checkMode = null, string $message = ''): void { $constraint = new MatchesJsonSchema($jsonSchema, $checkMode); static::assertThat(self::getHttpResponse()->toArray(false), $constraint, $message); } - public static function assertMatchesResourceCollectionJsonSchema(string $resourceClass, string $operationName = null, string $format = 'jsonld', array $serializationContext = null): void + public static function assertMatchesResourceCollectionJsonSchema(string $resourceClass, ?string $operationName = null, string $format = 'jsonld', ?array $serializationContext = null): void { $schemaFactory = self::getSchemaFactory(); @@ -124,7 +124,7 @@ public static function assertMatchesResourceCollectionJsonSchema(string $resourc static::assertMatchesJsonSchema($schema->getArrayCopy()); } - public static function assertMatchesResourceItemJsonSchema(string $resourceClass, string $operationName = null, string $format = 'jsonld', array $serializationContext = null): void + public static function assertMatchesResourceItemJsonSchema(string $resourceClass, ?string $operationName = null, string $format = 'jsonld', ?array $serializationContext = null): void { $schemaFactory = self::getSchemaFactory(); @@ -142,12 +142,12 @@ public static function assertMatchesResourceItemJsonSchema(string $resourceClass /** * @return Update[] */ - public static function getMercureMessages(string $hubName = null): array + public static function getMercureMessages(?string $hubName = null): array { return array_map(fn (array $update) => $update['object'], self::getMercureHub($hubName)->getMessages()); } - public static function getMercureMessage(int $index = 0, string $hubName = null): ?Update + public static function getMercureMessage(int $index = 0, ?string $hubName = null): ?Update { return static::getMercureMessages($hubName)[$index] ?? null; } @@ -155,7 +155,7 @@ public static function getMercureMessage(int $index = 0, string $hubName = null) /** * @throws \JsonException */ - public static function assertMercureUpdateMatchesJsonSchema(Update $update, array $topics, array|object|string $jsonSchema = '', bool $private = false, string $id = null, string $type = null, int $retry = null, string $message = ''): void + public static function assertMercureUpdateMatchesJsonSchema(Update $update, array $topics, array|object|string $jsonSchema = '', bool $private = false, ?string $id = null, ?string $type = null, ?int $retry = null, string $message = ''): void { static::assertSame($topics, $update->getTopics(), $message); static::assertThat(json_decode($update->getData(), true, \JSON_THROW_ON_ERROR), new MatchesJsonSchema($jsonSchema), $message); @@ -175,7 +175,7 @@ public static function getMercureRegistry(): HubRegistry static::fail('A client must have Mercure enabled to make update assertions. Did you forget to require symfony/mercure?'); } - public static function getMercureHub(string $name = null): TraceableHub + public static function getMercureHub(?string $name = null): TraceableHub { $hub = self::getMercureRegistry()->getHub($name); if (!$hub instanceof TraceableHub) { @@ -185,7 +185,7 @@ public static function getMercureHub(string $name = null): TraceableHub return $hub; } - private static function getHttpClient(Client $newClient = null): ?Client + private static function getHttpClient(?Client $newClient = null): ?Client { static $client; diff --git a/src/Symfony/Bundle/Test/Client.php b/src/Symfony/Bundle/Test/Client.php index dc77d3304ff..fb7d56cb431 100644 --- a/src/Symfony/Bundle/Test/Client.php +++ b/src/Symfony/Bundle/Test/Client.php @@ -121,7 +121,7 @@ public function request(string $method, string $url, array $options = []): Respo /** * {@inheritdoc} */ - public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface + public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface { throw new \LogicException('Not implemented yet'); } diff --git a/src/Symfony/Bundle/Test/Response.php b/src/Symfony/Bundle/Test/Response.php index 966b7ece4d2..29ca0647ff0 100644 --- a/src/Symfony/Bundle/Test/Response.php +++ b/src/Symfony/Bundle/Test/Response.php @@ -58,7 +58,7 @@ public function __construct(private readonly HttpFoundationResponse $httpFoundat ] + $info; } - public function getInfo(string $type = null): mixed + public function getInfo(?string $type = null): mixed { if ($type) { return $this->info[$type] ?? null; diff --git a/src/Symfony/Controller/MainController.php b/src/Symfony/Controller/MainController.php index d9363848476..b75d549b2db 100644 --- a/src/Symfony/Controller/MainController.php +++ b/src/Symfony/Controller/MainController.php @@ -38,7 +38,7 @@ public function __construct( ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ProviderInterface $provider, private readonly ProcessorInterface $processor, - UriVariablesConverterInterface $uriVariablesConverter = null, + ?UriVariablesConverterInterface $uriVariablesConverter = null, private readonly ?LoggerInterface $logger = null ) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; diff --git a/src/Symfony/EventListener/AddFormatListener.php b/src/Symfony/EventListener/AddFormatListener.php index 8ec2041e244..a2a319ef8ad 100644 --- a/src/Symfony/EventListener/AddFormatListener.php +++ b/src/Symfony/EventListener/AddFormatListener.php @@ -34,7 +34,7 @@ final class AddFormatListener { use OperationRequestInitiatorTrait; - public function __construct(private readonly Negotiator $negotiator, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly array $formats = [], private readonly array $errorFormats = [], private readonly array $docsFormats = [], private readonly ?bool $eventsBackwardCompatibility = null) // @phpstan-ignore-line + public function __construct(private readonly Negotiator $negotiator, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly array $formats = [], private readonly array $errorFormats = [], private readonly array $docsFormats = [], private readonly ?bool $eventsBackwardCompatibility = null) // @phpstan-ignore-line { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/Symfony/EventListener/AddHeadersListener.php b/src/Symfony/EventListener/AddHeadersListener.php index 02663db3146..73ac0d2b464 100644 --- a/src/Symfony/EventListener/AddHeadersListener.php +++ b/src/Symfony/EventListener/AddHeadersListener.php @@ -27,7 +27,7 @@ final class AddHeadersListener { use OperationRequestInitiatorTrait; - public function __construct(private readonly bool $etag = false, private readonly ?int $maxAge = null, private readonly ?int $sharedMaxAge = null, private readonly ?array $vary = null, private readonly ?bool $public = null, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?int $staleWhileRevalidate = null, private readonly ?int $staleIfError = null) + public function __construct(private readonly bool $etag = false, private readonly ?int $maxAge = null, private readonly ?int $sharedMaxAge = null, private readonly ?array $vary = null, private readonly ?bool $public = null, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?int $staleWhileRevalidate = null, private readonly ?int $staleIfError = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/Symfony/EventListener/AddLinkHeaderListener.php b/src/Symfony/EventListener/AddLinkHeaderListener.php index fecd341729f..43b4e1132bc 100644 --- a/src/Symfony/EventListener/AddLinkHeaderListener.php +++ b/src/Symfony/EventListener/AddLinkHeaderListener.php @@ -34,7 +34,7 @@ final class AddLinkHeaderListener public function __construct( private readonly Discovery $discovery, - ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, + ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly HttpHeaderSerializer $serializer = new HttpHeaderSerializer() ) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; diff --git a/src/Symfony/EventListener/AddTagsListener.php b/src/Symfony/EventListener/AddTagsListener.php index 1281ab2bcb8..f386fb918c9 100644 --- a/src/Symfony/EventListener/AddTagsListener.php +++ b/src/Symfony/EventListener/AddTagsListener.php @@ -40,7 +40,7 @@ final class AddTagsListener use OperationRequestInitiatorTrait; use UriVariablesResolverTrait; - public function __construct(private readonly IriConverterInterface $iriConverter, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?PurgerInterface $purger = null) + public function __construct(private readonly IriConverterInterface $iriConverter, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?PurgerInterface $purger = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/Symfony/EventListener/DenyAccessListener.php b/src/Symfony/EventListener/DenyAccessListener.php index fdaa9f9a881..ebc887e09d9 100644 --- a/src/Symfony/EventListener/DenyAccessListener.php +++ b/src/Symfony/EventListener/DenyAccessListener.php @@ -31,7 +31,7 @@ final class DenyAccessListener { use OperationRequestInitiatorTrait; - public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?ResourceAccessCheckerInterface $resourceAccessChecker = null) + public function __construct(?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?ResourceAccessCheckerInterface $resourceAccessChecker = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/Symfony/EventListener/DeserializeListener.php b/src/Symfony/EventListener/DeserializeListener.php index 00b53ec42eb..1dc6bfa3da5 100644 --- a/src/Symfony/EventListener/DeserializeListener.php +++ b/src/Symfony/EventListener/DeserializeListener.php @@ -44,7 +44,7 @@ final class DeserializeListener public const OPERATION_ATTRIBUTE_KEY = 'deserialize'; - public function __construct(private readonly SerializerInterface $serializer, private readonly SerializerContextBuilderInterface $serializerContextBuilder, ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, private ?TranslatorInterface $translator = null) + public function __construct(private readonly SerializerInterface $serializer, private readonly SerializerContextBuilderInterface $serializerContextBuilder, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, private ?TranslatorInterface $translator = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataFactory; if (null === $this->translator) { diff --git a/src/Symfony/EventListener/ErrorListener.php b/src/Symfony/EventListener/ErrorListener.php index a9ad9d7f16a..41ed3aaae11 100644 --- a/src/Symfony/EventListener/ErrorListener.php +++ b/src/Symfony/EventListener/ErrorListener.php @@ -49,16 +49,16 @@ final class ErrorListener extends SymfonyErrorListener public function __construct( object|array|string|null $controller, - LoggerInterface $logger = null, + ?LoggerInterface $logger = null, bool $debug = false, array $exceptionsMapping = [], - ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, + ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly array $errorFormats = [], private readonly array $exceptionToStatus = [], /** @phpstan-ignore-next-line we're not using this anymore but keeping for bc layer */ - private readonly null|IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface $identifiersExtractor = null, - private readonly null|ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver = null, - Negotiator $negotiator = null, + private readonly IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface|null $identifiersExtractor = null, + private readonly ResourceClassResolverInterface|LegacyResourceClassResolverInterface|null $resourceClassResolver = null, + ?Negotiator $negotiator = null, private readonly bool $problemCompliantErrors = true, ) { parent::__construct($controller, $logger, $debug, $exceptionsMapping); diff --git a/src/Symfony/EventListener/QueryParameterValidateListener.php b/src/Symfony/EventListener/QueryParameterValidateListener.php index ea83890bf95..0f540d07e4b 100644 --- a/src/Symfony/EventListener/QueryParameterValidateListener.php +++ b/src/Symfony/EventListener/QueryParameterValidateListener.php @@ -34,7 +34,7 @@ final class QueryParameterValidateListener public const OPERATION_ATTRIBUTE_KEY = 'query_parameter_validate'; - public function __construct(private readonly QueryParameterValidator $queryParameterValidator, ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null) + public function __construct(private readonly QueryParameterValidator $queryParameterValidator, ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; } diff --git a/src/Symfony/EventListener/ReadListener.php b/src/Symfony/EventListener/ReadListener.php index 54f8c1d46b8..0cecffc790f 100644 --- a/src/Symfony/EventListener/ReadListener.php +++ b/src/Symfony/EventListener/ReadListener.php @@ -43,9 +43,9 @@ final class ReadListener public function __construct( private readonly ProviderInterface $provider, - ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, + ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, private readonly ?SerializerContextBuilderInterface $serializerContextBuilder = null, - LegacyUriVariablesConverterInterface|UriVariablesConverterInterface $uriVariablesConverter = null, + LegacyUriVariablesConverterInterface|UriVariablesConverterInterface|null $uriVariablesConverter = null, ) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; $this->uriVariablesConverter = $uriVariablesConverter; diff --git a/src/Symfony/EventListener/RespondListener.php b/src/Symfony/EventListener/RespondListener.php index cdf2fe0076b..df53f671850 100644 --- a/src/Symfony/EventListener/RespondListener.php +++ b/src/Symfony/EventListener/RespondListener.php @@ -39,8 +39,8 @@ final class RespondListener ]; public function __construct( - ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, - private readonly null|IriConverterInterface|LegacyIriConverterInterface $iriConverter = null, + ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, + private readonly IriConverterInterface|LegacyIriConverterInterface|null $iriConverter = null, ) { $this->resourceMetadataCollectionFactory = $resourceMetadataFactory; } diff --git a/src/Symfony/EventListener/SerializeListener.php b/src/Symfony/EventListener/SerializeListener.php index aaa0775f02a..3f998626acd 100644 --- a/src/Symfony/EventListener/SerializeListener.php +++ b/src/Symfony/EventListener/SerializeListener.php @@ -46,7 +46,7 @@ final class SerializeListener public function __construct( private readonly SerializerInterface $serializer, private readonly SerializerContextBuilderInterface $serializerContextBuilder, - ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, + ?ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory = null, private readonly array $errorFormats = [], // @phpstan-ignore-next-line we don't need this anymore private readonly bool $debug = false, diff --git a/src/Symfony/EventListener/WriteListener.php b/src/Symfony/EventListener/WriteListener.php index 88559a323d7..bd3880a1c42 100644 --- a/src/Symfony/EventListener/WriteListener.php +++ b/src/Symfony/EventListener/WriteListener.php @@ -46,8 +46,8 @@ public function __construct( private readonly ProcessorInterface $processor, private readonly LegacyIriConverterInterface|IriConverterInterface $iriConverter, private readonly ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, - ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, - LegacyUriVariablesConverterInterface|UriVariablesConverterInterface $uriVariablesConverter = null, + ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, + LegacyUriVariablesConverterInterface|UriVariablesConverterInterface|null $uriVariablesConverter = null, ) { $this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory; $this->uriVariablesConverter = $uriVariablesConverter; diff --git a/src/Symfony/GraphQl/Resolver/Factory/DataCollectorResolverFactory.php b/src/Symfony/GraphQl/Resolver/Factory/DataCollectorResolverFactory.php index 5cb0efdbd5b..9091ab3dc9e 100644 --- a/src/Symfony/GraphQl/Resolver/Factory/DataCollectorResolverFactory.php +++ b/src/Symfony/GraphQl/Resolver/Factory/DataCollectorResolverFactory.php @@ -24,7 +24,7 @@ public function __construct(private readonly ResolverFactoryInterface $resolverF { } - public function __invoke(string $resourceClass = null, string $rootClass = null, Operation $operation = null): callable + public function __invoke(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null): callable { return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operation) { if ($this->requestStack && null !== $request = $this->requestStack->getCurrentRequest()) { diff --git a/src/Symfony/Routing/ApiLoader.php b/src/Symfony/Routing/ApiLoader.php index e7f08dfdf79..0d30198622b 100644 --- a/src/Symfony/Routing/ApiLoader.php +++ b/src/Symfony/Routing/ApiLoader.php @@ -46,7 +46,7 @@ public function __construct(KernelInterface $kernel, private readonly ResourceNa /** * {@inheritdoc} */ - public function load(mixed $data, string $type = null): RouteCollection + public function load(mixed $data, ?string $type = null): RouteCollection { $routeCollection = new RouteCollection(); foreach ($this->resourceClassDirectories as $directory) { @@ -114,7 +114,7 @@ public function load(mixed $data, string $type = null): RouteCollection /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null): bool + public function supports(mixed $resource, ?string $type = null): bool { return 'api_platform' === $type; } diff --git a/src/Symfony/Routing/IriConverter.php b/src/Symfony/Routing/IriConverter.php index 6134ab8c5a7..9b8773afd89 100644 --- a/src/Symfony/Routing/IriConverter.php +++ b/src/Symfony/Routing/IriConverter.php @@ -55,7 +55,7 @@ final class IriConverter implements IriConverterInterface private $localOperationCache = []; private $localIdentifiersExtractorOperationCache = []; - public function __construct(private readonly ProviderInterface $provider, private readonly RouterInterface $router, private readonly IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface $identifiersExtractor, ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, UriVariablesConverterInterface|LegacyUriVariablesConverterInterface $uriVariablesConverter = null, private readonly ?IriConverterInterface $decorated = null, private readonly ?OperationMetadataFactoryInterface $operationMetadataFactory = null) + public function __construct(private readonly ProviderInterface $provider, private readonly RouterInterface $router, private readonly IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface $identifiersExtractor, ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, UriVariablesConverterInterface|LegacyUriVariablesConverterInterface|null $uriVariablesConverter = null, private readonly ?IriConverterInterface $decorated = null, private readonly ?OperationMetadataFactoryInterface $operationMetadataFactory = null) { $this->resourceClassResolver = $resourceClassResolver; $this->uriVariablesConverter = $uriVariablesConverter; @@ -64,7 +64,7 @@ public function __construct(private readonly ProviderInterface $provider, privat /** * {@inheritdoc} */ - public function getResourceFromIri(string $iri, array $context = [], Operation $operation = null): object + public function getResourceFromIri(string $iri, array $context = [], ?Operation $operation = null): object { try { $parameters = $this->router->match($iri); @@ -105,7 +105,7 @@ public function getResourceFromIri(string $iri, array $context = [], Operation $ /** * {@inheritdoc} */ - public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = []): ?string + public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): ?string { $resourceClass = $context['force_resource_class'] ?? (\is_string($resource) ? $resource : $this->getObjectClass($resource)); @@ -160,7 +160,7 @@ public function getIriFromResource(object|string $resource, int $referenceType = return $this->generateSymfonyRoute($resource, $referenceType, $operation, $context, $identifiersExtractorOperation); } - private function generateSkolemIri(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = [], string $resourceClass = null): string + private function generateSkolemIri(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = [], ?string $resourceClass = null): string { if (!$this->decorated) { throw new InvalidArgumentException(sprintf('Unable to generate an IRI for the item of type "%s"', $resourceClass)); @@ -170,7 +170,7 @@ private function generateSkolemIri(object|string $resource, int $referenceType = return $this->decorated->getIriFromResource($resource, $referenceType, $operation, $context); } - private function generateSymfonyRoute(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = [], Operation $identifiersExtractorOperation = null): string + private function generateSymfonyRoute(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = [], ?Operation $identifiersExtractorOperation = null): string { $identifiers = $context['uri_variables'] ?? []; diff --git a/src/Symfony/Routing/Router.php b/src/Symfony/Routing/Router.php index 8bfd109a651..0b0a76d8f24 100644 --- a/src/Symfony/Routing/Router.php +++ b/src/Symfony/Routing/Router.php @@ -97,7 +97,7 @@ public function match(string $pathInfo): array /** * {@inheritdoc} */ - public function generate(string $name, array $parameters = [], int $referenceType = null): string + public function generate(string $name, array $parameters = [], ?int $referenceType = null): string { return $this->router->generate($name, $parameters, self::CONST_MAP[$referenceType ?? $this->urlGenerationStrategy]); } diff --git a/src/Symfony/Routing/SkolemIriConverter.php b/src/Symfony/Routing/SkolemIriConverter.php index 9f7c7f3ecee..d21561e48a9 100644 --- a/src/Symfony/Routing/SkolemIriConverter.php +++ b/src/Symfony/Routing/SkolemIriConverter.php @@ -41,7 +41,7 @@ public function __construct(RouterInterface $router) /** * {@inheritdoc} */ - public function getResourceFromIri(string $iri, array $context = [], Operation $operation = null): object + public function getResourceFromIri(string $iri, array $context = [], ?Operation $operation = null): object { throw new ItemNotFoundException(sprintf('Item not found for "%s".', $iri)); } @@ -49,7 +49,7 @@ public function getResourceFromIri(string $iri, array $context = [], Operation $ /** * {@inheritdoc} */ - public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = []): ?string + public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): ?string { $referenceType = $operation ? ($operation->getUrlGenerationStrategy() ?? $referenceType) : $referenceType; if (($isObject = \is_object($resource)) && $this->objectHashMap->contains($resource)) { diff --git a/src/Symfony/Validator/Exception/ValidationException.php b/src/Symfony/Validator/Exception/ValidationException.php index 839319dc928..cc0cd251499 100644 --- a/src/Symfony/Validator/Exception/ValidationException.php +++ b/src/Symfony/Validator/Exception/ValidationException.php @@ -67,7 +67,7 @@ final class ValidationException extends BaseValidationException implements Const { private int $status = 422; - public function __construct(private readonly ConstraintViolationListInterface $constraintViolationList, string $message = '', int $code = 0, \Throwable $previous = null, string $errorTitle = null) + public function __construct(private readonly ConstraintViolationListInterface $constraintViolationList, string $message = '', int $code = 0, ?\Throwable $previous = null, ?string $errorTitle = null) { parent::__construct($message ?: $this->__toString(), $code, $previous, $errorTitle); } diff --git a/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php b/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php index caa0ac72fa1..d45d32a37fa 100644 --- a/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php +++ b/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php @@ -26,7 +26,7 @@ public function __construct(private readonly NormalizerInterface $decorated, pri { } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { $messages = []; foreach ($object->getConstraintViolationList() as $violation) { @@ -49,7 +49,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $this->decorated->normalize($object, $format, $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof ValidationException && $this->decorated->supportsNormalization($data, $format, $context); } diff --git a/src/Test/DoctrineMongoDbOdmFilterTestCase.php b/src/Test/DoctrineMongoDbOdmFilterTestCase.php index a87cf891c4f..bb23ff76660 100644 --- a/src/Test/DoctrineMongoDbOdmFilterTestCase.php +++ b/src/Test/DoctrineMongoDbOdmFilterTestCase.php @@ -48,14 +48,14 @@ protected function setUp(): void /** * @dataProvider provideApplyTestData */ - public function testApply(?array $properties, array $filterParameters, array $expectedPipeline, callable $factory = null, string $resourceClass = null): void + public function testApply(?array $properties, array $filterParameters, array $expectedPipeline, ?callable $factory = null, ?string $resourceClass = null): void { $this->doTestApply($properties, $filterParameters, $expectedPipeline, $factory, $resourceClass); } - protected function doTestApply(?array $properties, array $filterParameters, array $expectedPipeline, callable $filterFactory = null, string $resourceClass = null): void + protected function doTestApply(?array $properties, array $filterParameters, array $expectedPipeline, ?callable $filterFactory = null, ?string $resourceClass = null): void { - $filterFactory ??= fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): FilterInterface => new ($this->filterClass)($managerRegistry, null, $properties); + $filterFactory ??= fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): FilterInterface => new ($this->filterClass)($managerRegistry, null, $properties); $repository = $this->repository; if ($resourceClass) { @@ -75,7 +75,7 @@ protected function doTestApply(?array $properties, array $filterParameters, arra $this->assertEquals($expectedPipeline, $pipeline); } - protected function buildFilter(array $properties = null) + protected function buildFilter(?array $properties = null) { return new $this->filterClass($this->managerRegistry, null, $properties); } diff --git a/src/Test/DoctrineMongoDbOdmSetup.php b/src/Test/DoctrineMongoDbOdmSetup.php index d514ae85568..43eb5fe33ab 100644 --- a/src/Test/DoctrineMongoDbOdmSetup.php +++ b/src/Test/DoctrineMongoDbOdmSetup.php @@ -35,7 +35,7 @@ class DoctrineMongoDbOdmSetup /** * Creates a configuration with an attribute metadata driver. */ - public static function createAttributeMetadataConfiguration(array $paths, bool $isDevMode = false, string $proxyDir = null, string $hydratorDir = null, Cache $cache = null): Configuration + public static function createAttributeMetadataConfiguration(array $paths, bool $isDevMode = false, ?string $proxyDir = null, ?string $hydratorDir = null, ?Cache $cache = null): Configuration { $config = self::createConfiguration($isDevMode, $proxyDir, $hydratorDir, $cache); $config->setMetadataDriverImpl(new AttributeDriver($paths)); @@ -46,7 +46,7 @@ public static function createAttributeMetadataConfiguration(array $paths, bool $ /** * Creates a configuration with a xml metadata driver. */ - public static function createXMLMetadataConfiguration(array $paths, bool $isDevMode = false, string $proxyDir = null, string $hydratorDir = null, Cache $cache = null): Configuration + public static function createXMLMetadataConfiguration(array $paths, bool $isDevMode = false, ?string $proxyDir = null, ?string $hydratorDir = null, ?Cache $cache = null): Configuration { $config = self::createConfiguration($isDevMode, $proxyDir, $hydratorDir, $cache); $config->setMetadataDriverImpl(new XmlDriver($paths)); @@ -57,7 +57,7 @@ public static function createXMLMetadataConfiguration(array $paths, bool $isDevM /** * Creates a configuration without a metadata driver. */ - public static function createConfiguration(bool $isDevMode = false, string $proxyDir = null, string $hydratorDir = null, Cache $cache = null): Configuration + public static function createConfiguration(bool $isDevMode = false, ?string $proxyDir = null, ?string $hydratorDir = null, ?Cache $cache = null): Configuration { $proxyDir = $proxyDir ?: sys_get_temp_dir(); $hydratorDir = $hydratorDir ?: sys_get_temp_dir(); diff --git a/src/Test/DoctrineOrmFilterTestCase.php b/src/Test/DoctrineOrmFilterTestCase.php index ab90ca8107c..ff934894d5f 100644 --- a/src/Test/DoctrineOrmFilterTestCase.php +++ b/src/Test/DoctrineOrmFilterTestCase.php @@ -48,15 +48,15 @@ protected function setUp(): void /** * @dataProvider provideApplyTestData */ - public function testApply(?array $properties, array $filterParameters, string $expectedDql, array $expectedParameters = null, callable $factory = null, string $resourceClass = null): void + public function testApply(?array $properties, array $filterParameters, string $expectedDql, ?array $expectedParameters = null, ?callable $factory = null, ?string $resourceClass = null): void { $this->doTestApply($properties, $filterParameters, $expectedDql, $expectedParameters, $factory, $resourceClass); } - protected function doTestApply(?array $properties, array $filterParameters, string $expectedDql, array $expectedParameters = null, callable $filterFactory = null, string $resourceClass = null): void + protected function doTestApply(?array $properties, array $filterParameters, string $expectedDql, ?array $expectedParameters = null, ?callable $filterFactory = null, ?string $resourceClass = null): void { if (null === $filterFactory) { - $filterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): FilterInterface => new ($this->filterClass)($managerRegistry, null, $properties); + $filterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): FilterInterface => new ($this->filterClass)($managerRegistry, null, $properties); } $repository = $this->repository; @@ -83,7 +83,7 @@ protected function doTestApply(?array $properties, array $filterParameters, stri } } - protected function buildFilter(array $properties = null) + protected function buildFilter(?array $properties = null) { return new $this->filterClass($this->managerRegistry, null, $properties); } diff --git a/src/Util/AttributeFilterExtractorTrait.php b/src/Util/AttributeFilterExtractorTrait.php index 8c07307732b..3ccbf4d0b3f 100644 --- a/src/Util/AttributeFilterExtractorTrait.php +++ b/src/Util/AttributeFilterExtractorTrait.php @@ -41,7 +41,7 @@ private function getFilterAttributes(\ReflectionClass|\ReflectionProperty $refle /** * Given a filter attribute and reflection elements, find out the properties where the filter is applied. */ - private function getFilterProperties(ApiFilter $filterAttribute, \ReflectionClass $reflectionClass, \ReflectionProperty $reflectionProperty = null): array + private function getFilterProperties(ApiFilter $filterAttribute, \ReflectionClass $reflectionClass, ?\ReflectionProperty $reflectionProperty = null): array { $properties = []; @@ -129,7 +129,7 @@ private function readFilterAttributes(\ReflectionClass $reflectionClass): array * @param string $filterClass the filter class * @param string|null $filterId the filter id */ - private function generateFilterId(\ReflectionClass $reflectionClass, string $filterClass, string $filterId = null): string + private function generateFilterId(\ReflectionClass $reflectionClass, string $filterClass, ?string $filterId = null): string { $suffix = null !== $filterId ? '_'.$filterId : $filterId; diff --git a/src/Util/IriHelper.php b/src/Util/IriHelper.php index 174336ba377..d4c8915e6ac 100644 --- a/src/Util/IriHelper.php +++ b/src/Util/IriHelper.php @@ -56,7 +56,7 @@ public static function parseIri(string $iri, string $pageParameterName): array /** * Gets a collection IRI for the given parameters. */ - public static function createIri(array $parts, array $parameters, string $pageParameterName = null, float $page = null, $urlGenerationStrategy = UrlGeneratorInterface::ABS_PATH): string + public static function createIri(array $parts, array $parameters, ?string $pageParameterName = null, ?float $page = null, $urlGenerationStrategy = UrlGeneratorInterface::ABS_PATH): string { if (null !== $page && null !== $pageParameterName) { $parameters[$pageParameterName] = $page; diff --git a/src/Validator/Exception/ValidationException.php b/src/Validator/Exception/ValidationException.php index c710cfee867..9e5985ad5ee 100644 --- a/src/Validator/Exception/ValidationException.php +++ b/src/Validator/Exception/ValidationException.php @@ -22,7 +22,7 @@ */ class ValidationException extends RuntimeException { - public function __construct(string $message = '', int $code = 0, \Throwable $previous = null, protected readonly ?string $errorTitle = null) + public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, protected readonly ?string $errorTitle = null) { parent::__construct($message, $code, $previous); } diff --git a/tests/Doctrine/Odm/Filter/ExistsFilterTest.php b/tests/Doctrine/Odm/Filter/ExistsFilterTest.php index 4348617e5e2..3f43bbd11ef 100644 --- a/tests/Doctrine/Odm/Filter/ExistsFilterTest.php +++ b/tests/Doctrine/Odm/Filter/ExistsFilterTest.php @@ -116,8 +116,8 @@ public function testGetDescriptionDefaultFields(): void public static function provideApplyTestData(): array { - $existsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'exists'); - $customExistsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'customExists'); + $existsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'exists'); + $customExistsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'customExists'); return array_merge_recursive( self::provideApplyTestArguments(), @@ -426,7 +426,7 @@ public static function provideApplyTestData(): array ); } - protected function buildFilter(array $properties = null) + protected function buildFilter(?array $properties = null) { return new $this->filterClass($this->managerRegistry, null, $properties, 'exists'); } diff --git a/tests/Doctrine/Odm/Filter/OrderFilterTest.php b/tests/Doctrine/Odm/Filter/OrderFilterTest.php index 43ceb21de3e..cf8180a6050 100644 --- a/tests/Doctrine/Odm/Filter/OrderFilterTest.php +++ b/tests/Doctrine/Odm/Filter/OrderFilterTest.php @@ -235,8 +235,8 @@ public function testGetDescriptionDefaultFields(): void public static function provideApplyTestData(): array { - $orderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'order', null, $properties); - $customOrderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'customOrder', null, $properties); + $orderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'order', null, $properties); + $customOrderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'customOrder', null, $properties); return array_merge_recursive( self::provideApplyTestArguments(), @@ -580,7 +580,7 @@ public static function provideApplyTestData(): array ); } - protected function buildFilter(array $properties = null) + protected function buildFilter(?array $properties = null) { return new $this->filterClass($this->managerRegistry, 'order', null, $properties, new CustomConverter()); } diff --git a/tests/Doctrine/Odm/Filter/SearchFilterTest.php b/tests/Doctrine/Odm/Filter/SearchFilterTest.php index 845e3a3d11c..70c95d5bc66 100644 --- a/tests/Doctrine/Odm/Filter/SearchFilterTest.php +++ b/tests/Doctrine/Odm/Filter/SearchFilterTest.php @@ -753,7 +753,7 @@ public static function provideApplyTestData(): array ); } - protected static function buildSearchFilter(self $that, ManagerRegistry $managerRegistry, array $properties = null): SearchFilter + protected static function buildSearchFilter(self $that, ManagerRegistry $managerRegistry, ?array $properties = null): SearchFilter { $relatedDummyProphecy = $that->prophesize(RelatedDummy::class); $iriConverterProphecy = $that->prophesize(IriConverterInterface::class); diff --git a/tests/Doctrine/Odm/Metadata/Resource/DoctrineMongoDbOdmResourceCollectionMetadataFactoryTest.php b/tests/Doctrine/Odm/Metadata/Resource/DoctrineMongoDbOdmResourceCollectionMetadataFactoryTest.php index deb100f26ce..f2a4e95b466 100644 --- a/tests/Doctrine/Odm/Metadata/Resource/DoctrineMongoDbOdmResourceCollectionMetadataFactoryTest.php +++ b/tests/Doctrine/Odm/Metadata/Resource/DoctrineMongoDbOdmResourceCollectionMetadataFactoryTest.php @@ -73,7 +73,7 @@ public function testWithoutManager(): void /** * @dataProvider operationProvider */ - public function testWithProvider(Operation $operation, string $expectedProvider = null, string $expectedProcessor = null): void + public function testWithProvider(Operation $operation, ?string $expectedProvider = null, ?string $expectedProcessor = null): void { if (!class_exists(DocumentManager::class)) { $this->markTestSkipped('ODM not installed'); diff --git a/tests/Doctrine/Odm/PropertyInfo/DoctrineExtractorTest.php b/tests/Doctrine/Odm/PropertyInfo/DoctrineExtractorTest.php index e6eb44768f1..6b6f5598721 100644 --- a/tests/Doctrine/Odm/PropertyInfo/DoctrineExtractorTest.php +++ b/tests/Doctrine/Odm/PropertyInfo/DoctrineExtractorTest.php @@ -87,7 +87,7 @@ public function testTestGetPropertiesWithEmbedded(): void /** * @dataProvider typesProvider */ - public function testExtract(string $property, array $type = null): void + public function testExtract(string $property, ?array $type = null): void { $this->assertEquals($type, $this->createExtractor()->getTypes(DoctrineDummy::class, $property)); } diff --git a/tests/Doctrine/Orm/Filter/ExistsFilterTest.php b/tests/Doctrine/Orm/Filter/ExistsFilterTest.php index 82286240505..a345324342a 100644 --- a/tests/Doctrine/Orm/Filter/ExistsFilterTest.php +++ b/tests/Doctrine/Orm/Filter/ExistsFilterTest.php @@ -94,8 +94,8 @@ public function testGetDescriptionDefaultFields(): void public static function provideApplyTestData(): array { - $existsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'exists'); - $customExistsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'customExists'); + $existsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'exists'); + $customExistsFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): ExistsFilter => new ExistsFilter($managerRegistry, null, $properties, 'customExists'); return array_merge_recursive( self::provideApplyTestArguments(), @@ -223,7 +223,7 @@ public static function provideApplyTestData(): array ); } - protected function buildFilter(array $properties = null) + protected function buildFilter(?array $properties = null) { return new $this->filterClass($this->managerRegistry, null, $properties, 'exists', new CustomConverter()); } diff --git a/tests/Doctrine/Orm/Filter/OrderFilterTest.php b/tests/Doctrine/Orm/Filter/OrderFilterTest.php index 76454322505..b22d9cf125f 100644 --- a/tests/Doctrine/Orm/Filter/OrderFilterTest.php +++ b/tests/Doctrine/Orm/Filter/OrderFilterTest.php @@ -296,8 +296,8 @@ public function testGetDescriptionDefaultFields(): void public static function provideApplyTestData(): array { - $orderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'order', null, $properties); - $customOrderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'customOrder', null, $properties); + $orderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'order', null, $properties); + $customOrderFilterFactory = fn (self $that, ManagerRegistry $managerRegistry, ?array $properties = null): OrderFilter => new OrderFilter($managerRegistry, 'customOrder', null, $properties); return array_merge_recursive( self::provideApplyTestArguments(), @@ -423,7 +423,7 @@ public static function provideApplyTestData(): array ); } - protected function buildFilter(array $properties = null) + protected function buildFilter(?array $properties = null) { return new $this->filterClass($this->managerRegistry, 'order', null, $properties, new CustomConverter()); } diff --git a/tests/Doctrine/Orm/Filter/SearchFilterTest.php b/tests/Doctrine/Orm/Filter/SearchFilterTest.php index 8644ec7a289..34f5618ca4c 100644 --- a/tests/Doctrine/Orm/Filter/SearchFilterTest.php +++ b/tests/Doctrine/Orm/Filter/SearchFilterTest.php @@ -504,7 +504,7 @@ public static function provideApplyTestData(): array ); } - protected static function buildSearchFilter(self $that, ManagerRegistry $managerRegistry, array $properties = null): SearchFilter + protected static function buildSearchFilter(self $that, ManagerRegistry $managerRegistry, ?array $properties = null): SearchFilter { $relatedDummyProphecy = $that->prophesize(RelatedDummy::class); $iriConverterProphecy = $that->prophesize(IriConverterInterface::class); diff --git a/tests/Doctrine/Orm/Metadata/Resource/DoctrineOrmResourceCollectionMetadataFactoryTest.php b/tests/Doctrine/Orm/Metadata/Resource/DoctrineOrmResourceCollectionMetadataFactoryTest.php index 4188aec389a..34cf53c22d3 100644 --- a/tests/Doctrine/Orm/Metadata/Resource/DoctrineOrmResourceCollectionMetadataFactoryTest.php +++ b/tests/Doctrine/Orm/Metadata/Resource/DoctrineOrmResourceCollectionMetadataFactoryTest.php @@ -65,7 +65,7 @@ public function testWithoutManager(): void /** * @dataProvider operationProvider */ - public function testWithProvider(Operation $operation, string $expectedProvider = null, string $expectedProcessor = null): void + public function testWithProvider(Operation $operation, ?string $expectedProvider = null, ?string $expectedProcessor = null): void { $objectManager = $this->prophesize(EntityManagerInterface::class); $managerRegistry = $this->prophesize(ManagerRegistry::class); diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue5648/CustomFilter.php b/tests/Fixtures/TestBundle/ApiResource/Issue5648/CustomFilter.php index e6c8d62ed3a..ec914a66b4f 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue5648/CustomFilter.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue5648/CustomFilter.php @@ -21,7 +21,7 @@ class CustomFilter extends AbstractFilter { - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { if ('custom' !== $property) { return; diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue5896/TypeFactoryDecorator.php b/tests/Fixtures/TestBundle/ApiResource/Issue5896/TypeFactoryDecorator.php index ff28992f826..939259fbb37 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue5896/TypeFactoryDecorator.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue5896/TypeFactoryDecorator.php @@ -24,7 +24,7 @@ public function __construct( ) { } - public function getType(Type $type, string $format = 'json', bool $readableLink = null, array $serializerContext = null, Schema $schema = null): array + public function getType(Type $type, string $format = 'json', ?bool $readableLink = null, ?array $serializerContext = null, ?Schema $schema = null): array { if (is_a($type->getClassName(), LocalDate::class, true)) { return [ diff --git a/tests/Fixtures/TestBundle/Document/Answer.php b/tests/Fixtures/TestBundle/Document/Answer.php index 2b45253e55d..28d91bc7e71 100644 --- a/tests/Fixtures/TestBundle/Document/Answer.php +++ b/tests/Fixtures/TestBundle/Document/Answer.php @@ -81,7 +81,7 @@ public function getContent(): ?string /** * Set question. */ - public function setQuestion(Question $question = null): self + public function setQuestion(?Question $question = null): self { $this->question = $question; diff --git a/tests/Fixtures/TestBundle/Document/CompositeItem.php b/tests/Fixtures/TestBundle/Document/CompositeItem.php index fa9b44e52c4..cfe73fb374c 100644 --- a/tests/Fixtures/TestBundle/Document/CompositeItem.php +++ b/tests/Fixtures/TestBundle/Document/CompositeItem.php @@ -59,7 +59,7 @@ public function getField1(): ?string /** * Sets field1. */ - public function setField1(string $field1 = null): void + public function setField1(?string $field1 = null): void { $this->field1 = $field1; } diff --git a/tests/Fixtures/TestBundle/Document/Dummy.php b/tests/Fixtures/TestBundle/Document/Dummy.php index 96700070608..24516bfbcd4 100644 --- a/tests/Fixtures/TestBundle/Document/Dummy.php +++ b/tests/Fixtures/TestBundle/Document/Dummy.php @@ -163,12 +163,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php b/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php index 492f41ef050..8d1d875eed2 100644 --- a/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php +++ b/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php @@ -11,7 +11,7 @@ declare(strict_types=1); -namespace Fixtures\TestBundle\Document; +namespace ApiPlatform\Tests\Fixtures\TestBundle\Document; use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\GetCollection; diff --git a/tests/Fixtures/TestBundle/Document/Question.php b/tests/Fixtures/TestBundle/Document/Question.php index 417f78864b9..881d70fc540 100644 --- a/tests/Fixtures/TestBundle/Document/Question.php +++ b/tests/Fixtures/TestBundle/Document/Question.php @@ -62,7 +62,7 @@ public function getId(): ?int /** * Set answer. */ - public function setAnswer(Answer $answer = null): self + public function setAnswer(?Answer $answer = null): self { $this->answer = $answer; diff --git a/tests/Fixtures/TestBundle/Document/RelatedDummy.php b/tests/Fixtures/TestBundle/Document/RelatedDummy.php index 6f8998ab1a4..6a3678b6484 100644 --- a/tests/Fixtures/TestBundle/Document/RelatedDummy.php +++ b/tests/Fixtures/TestBundle/Document/RelatedDummy.php @@ -148,7 +148,7 @@ public function getThirdLevel(): ?ThirdLevel return $this->thirdLevel; } - public function setThirdLevel(ThirdLevel $thirdLevel = null): void + public function setThirdLevel(?ThirdLevel $thirdLevel = null): void { $this->thirdLevel = $thirdLevel; } diff --git a/tests/Fixtures/TestBundle/Document/SlugChildDummy.php b/tests/Fixtures/TestBundle/Document/SlugChildDummy.php index f9644c8d738..890cf391652 100644 --- a/tests/Fixtures/TestBundle/Document/SlugChildDummy.php +++ b/tests/Fixtures/TestBundle/Document/SlugChildDummy.php @@ -62,7 +62,7 @@ public function getParentDummy(): SlugParentDummy return $this->parentDummy; } - public function setParentDummy(SlugParentDummy $parentDummy = null): self + public function setParentDummy(?SlugParentDummy $parentDummy = null): self { $this->parentDummy = $parentDummy; diff --git a/tests/Fixtures/TestBundle/Document/ThirdLevel.php b/tests/Fixtures/TestBundle/Document/ThirdLevel.php index 7a79df0032a..ef482a6564a 100644 --- a/tests/Fixtures/TestBundle/Document/ThirdLevel.php +++ b/tests/Fixtures/TestBundle/Document/ThirdLevel.php @@ -89,7 +89,7 @@ public function getFourthLevel(): ?FourthLevel return $this->fourthLevel; } - public function setFourthLevel(FourthLevel $fourthLevel = null): void + public function setFourthLevel(?FourthLevel $fourthLevel = null): void { $this->fourthLevel = $fourthLevel; } diff --git a/tests/Fixtures/TestBundle/Document/VoDummyInspection.php b/tests/Fixtures/TestBundle/Document/VoDummyInspection.php index 5ef268b444e..31b8c4d51ca 100644 --- a/tests/Fixtures/TestBundle/Document/VoDummyInspection.php +++ b/tests/Fixtures/TestBundle/Document/VoDummyInspection.php @@ -28,7 +28,7 @@ class VoDummyInspection private $attributeWithoutConstructorEquivalent; - public function __construct(#[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] #[ODM\Field(type: 'bool')] private bool $accepted, #[Groups(['inspection_read', 'inspection_write'])] #[ODM\ReferenceOne(targetDocument: VoDummyCar::class, inversedBy: 'inspections')] private VoDummyCar $car, \DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') + public function __construct(#[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] #[ODM\Field(type: 'bool')] private bool $accepted, #[Groups(['inspection_read', 'inspection_write'])] #[ODM\ReferenceOne(targetDocument: VoDummyCar::class, inversedBy: 'inspections')] private VoDummyCar $car, ?\DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') { $this->performed = $performed ?: new \DateTime(); $this->attributeWithoutConstructorEquivalent = $parameterWhichIsNotClassAttribute; diff --git a/tests/Fixtures/TestBundle/Entity/Answer.php b/tests/Fixtures/TestBundle/Entity/Answer.php index 945fd5e3b6d..ec22268a5be 100644 --- a/tests/Fixtures/TestBundle/Entity/Answer.php +++ b/tests/Fixtures/TestBundle/Entity/Answer.php @@ -88,7 +88,7 @@ public function getContent(): ?string /** * Set question. */ - public function setQuestion(Question $question = null): self + public function setQuestion(?Question $question = null): self { $this->question = $question; diff --git a/tests/Fixtures/TestBundle/Entity/CompositeLabel.php b/tests/Fixtures/TestBundle/Entity/CompositeLabel.php index 9803d639da1..f94218d6550 100644 --- a/tests/Fixtures/TestBundle/Entity/CompositeLabel.php +++ b/tests/Fixtures/TestBundle/Entity/CompositeLabel.php @@ -53,7 +53,7 @@ public function getValue(): ?string * * @param string|null $value the value to set */ - public function setValue(string $value = null): void + public function setValue(?string $value = null): void { $this->value = $value; } diff --git a/tests/Fixtures/TestBundle/Entity/Dummy.php b/tests/Fixtures/TestBundle/Entity/Dummy.php index afd6c9a7c32..55dce62d2ba 100644 --- a/tests/Fixtures/TestBundle/Entity/Dummy.php +++ b/tests/Fixtures/TestBundle/Entity/Dummy.php @@ -194,12 +194,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/tests/Fixtures/TestBundle/Entity/DummyProblem.php b/tests/Fixtures/TestBundle/Entity/DummyProblem.php index affe43ed248..a6bf31b5dc9 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyProblem.php +++ b/tests/Fixtures/TestBundle/Entity/DummyProblem.php @@ -191,12 +191,12 @@ public function getFoo(): ?array return $this->foo; } - public function setFoo(array $foo = null): void + public function setFoo(?array $foo = null): void { $this->foo = $foo; } - public function setDummyDate(\DateTime $dummyDate = null): void + public function setDummyDate(?\DateTime $dummyDate = null): void { $this->dummyDate = $dummyDate; } diff --git a/tests/Fixtures/TestBundle/Entity/DummyWithCollectDenormalizationErrors.php b/tests/Fixtures/TestBundle/Entity/DummyWithCollectDenormalizationErrors.php index bf461b9e0c7..07c9035a5b2 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyWithCollectDenormalizationErrors.php +++ b/tests/Fixtures/TestBundle/Entity/DummyWithCollectDenormalizationErrors.php @@ -55,7 +55,7 @@ class DummyWithCollectDenormalizationErrors #[ORM\ManyToMany(targetEntity: RelatedDummy::class)] public Collection|iterable $relatedDummies; - public function __construct(string $baz, string $qux = null) + public function __construct(string $baz, ?string $qux = null) { $this->baz = $baz; $this->qux = $qux; diff --git a/tests/Fixtures/TestBundle/Entity/Question.php b/tests/Fixtures/TestBundle/Entity/Question.php index 78b1afd5026..aa1b82cd74e 100644 --- a/tests/Fixtures/TestBundle/Entity/Question.php +++ b/tests/Fixtures/TestBundle/Entity/Question.php @@ -65,7 +65,7 @@ public function getId(): ?int /** * Set answer. */ - public function setAnswer(Answer $answer = null): self + public function setAnswer(?Answer $answer = null): self { $this->answer = $answer; diff --git a/tests/Fixtures/TestBundle/Entity/RamseyUuidDummy.php b/tests/Fixtures/TestBundle/Entity/RamseyUuidDummy.php index e0f66a2da22..480c0327603 100644 --- a/tests/Fixtures/TestBundle/Entity/RamseyUuidDummy.php +++ b/tests/Fixtures/TestBundle/Entity/RamseyUuidDummy.php @@ -31,7 +31,7 @@ class RamseyUuidDummy #[ORM\Column(type: 'uuid', nullable: true)] private ?UuidInterface $other = null; - public function __construct(UuidInterface $id = null) + public function __construct(?UuidInterface $id = null) { $this->id = $id ?? Uuid::uuid4(); } diff --git a/tests/Fixtures/TestBundle/Entity/RelatedDummy.php b/tests/Fixtures/TestBundle/Entity/RelatedDummy.php index 79fef63b979..f51c467159a 100644 --- a/tests/Fixtures/TestBundle/Entity/RelatedDummy.php +++ b/tests/Fixtures/TestBundle/Entity/RelatedDummy.php @@ -169,7 +169,7 @@ public function getThirdLevel(): ?ThirdLevel return $this->thirdLevel; } - public function setThirdLevel(ThirdLevel $thirdLevel = null): void + public function setThirdLevel(?ThirdLevel $thirdLevel = null): void { $this->thirdLevel = $thirdLevel; } diff --git a/tests/Fixtures/TestBundle/Entity/SlugChildDummy.php b/tests/Fixtures/TestBundle/Entity/SlugChildDummy.php index 4c470196f7a..c1d8c5b21e4 100644 --- a/tests/Fixtures/TestBundle/Entity/SlugChildDummy.php +++ b/tests/Fixtures/TestBundle/Entity/SlugChildDummy.php @@ -65,7 +65,7 @@ public function getParentDummy(): ?SlugParentDummy return $this->parentDummy; } - public function setParentDummy(SlugParentDummy $parentDummy = null): self + public function setParentDummy(?SlugParentDummy $parentDummy = null): self { $this->parentDummy = $parentDummy; diff --git a/tests/Fixtures/TestBundle/Entity/SymfonyUuidDummy.php b/tests/Fixtures/TestBundle/Entity/SymfonyUuidDummy.php index 911107493bb..53bece1021a 100644 --- a/tests/Fixtures/TestBundle/Entity/SymfonyUuidDummy.php +++ b/tests/Fixtures/TestBundle/Entity/SymfonyUuidDummy.php @@ -32,7 +32,7 @@ class SymfonyUuidDummy #[ORM\Column(nullable: true)] private ?string $number = null; - public function __construct(Uuid $id = null) + public function __construct(?Uuid $id = null) { $this->id = $id ?? Uuid::v4(); } diff --git a/tests/Fixtures/TestBundle/Entity/ThirdLevel.php b/tests/Fixtures/TestBundle/Entity/ThirdLevel.php index ba099ce257e..672d2e5ba78 100644 --- a/tests/Fixtures/TestBundle/Entity/ThirdLevel.php +++ b/tests/Fixtures/TestBundle/Entity/ThirdLevel.php @@ -97,7 +97,7 @@ public function getFourthLevel(): ?FourthLevel return $this->fourthLevel; } - public function setFourthLevel(FourthLevel $fourthLevel = null): void + public function setFourthLevel(?FourthLevel $fourthLevel = null): void { $this->fourthLevel = $fourthLevel; } diff --git a/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php b/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php index c8de195e5bc..2fccd9b1b20 100644 --- a/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php +++ b/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php @@ -29,7 +29,7 @@ class VoDummyInspection private $attributeWithoutConstructorEquivalent; - public function __construct(#[ORM\Column(type: 'boolean')] #[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] private bool $accepted, #[ORM\ManyToOne(targetEntity: VoDummyCar::class, inversedBy: 'inspections')] #[Groups(['inspection_read', 'inspection_write'])] private ?VoDummyCar $car, \DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') + public function __construct(#[ORM\Column(type: 'boolean')] #[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] private bool $accepted, #[ORM\ManyToOne(targetEntity: VoDummyCar::class, inversedBy: 'inspections')] #[Groups(['inspection_read', 'inspection_write'])] private ?VoDummyCar $car, ?\DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') { $this->performed = $performed ?: new \DateTime(); $this->attributeWithoutConstructorEquivalent = $parameterWhichIsNotClassAttribute; diff --git a/tests/Fixtures/TestBundle/Exception/NotFoundException.php b/tests/Fixtures/TestBundle/Exception/NotFoundException.php index 5f3bb2eecd7..b81db1bd329 100644 --- a/tests/Fixtures/TestBundle/Exception/NotFoundException.php +++ b/tests/Fixtures/TestBundle/Exception/NotFoundException.php @@ -15,7 +15,7 @@ final class NotFoundException extends \Exception { - public function __construct(string $message = '', int $code = 0, \Throwable $previous = null) + public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/tests/Fixtures/TestBundle/Filter/ArrayItemsFilter.php b/tests/Fixtures/TestBundle/Filter/ArrayItemsFilter.php index 7404c1874eb..4c2b9433be3 100644 --- a/tests/Fixtures/TestBundle/Filter/ArrayItemsFilter.php +++ b/tests/Fixtures/TestBundle/Filter/ArrayItemsFilter.php @@ -23,7 +23,7 @@ class ArrayItemsFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/ArrayRequiredFilter.php b/tests/Fixtures/TestBundle/Filter/ArrayRequiredFilter.php index b5f9b3b727e..8492304641e 100644 --- a/tests/Fixtures/TestBundle/Filter/ArrayRequiredFilter.php +++ b/tests/Fixtures/TestBundle/Filter/ArrayRequiredFilter.php @@ -23,7 +23,7 @@ final class ArrayRequiredFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/BoundsFilter.php b/tests/Fixtures/TestBundle/Filter/BoundsFilter.php index ad7252f859c..8db3805095f 100644 --- a/tests/Fixtures/TestBundle/Filter/BoundsFilter.php +++ b/tests/Fixtures/TestBundle/Filter/BoundsFilter.php @@ -23,7 +23,7 @@ class BoundsFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/ComplexSubQueryFilter.php b/tests/Fixtures/TestBundle/Filter/ComplexSubQueryFilter.php index f7375e93da3..cf8529be055 100644 --- a/tests/Fixtures/TestBundle/Filter/ComplexSubQueryFilter.php +++ b/tests/Fixtures/TestBundle/Filter/ComplexSubQueryFilter.php @@ -29,7 +29,7 @@ protected function filterProperty( QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, - Operation $operation = null, + ?Operation $operation = null, array $context = [] ): void { if ('complex_sub_query_filter' !== $property) { diff --git a/tests/Fixtures/TestBundle/Filter/EnumFilter.php b/tests/Fixtures/TestBundle/Filter/EnumFilter.php index c52289adea4..25dbdb8413c 100644 --- a/tests/Fixtures/TestBundle/Filter/EnumFilter.php +++ b/tests/Fixtures/TestBundle/Filter/EnumFilter.php @@ -23,7 +23,7 @@ class EnumFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/LengthFilter.php b/tests/Fixtures/TestBundle/Filter/LengthFilter.php index a254216e34b..c45ac2f1cc0 100644 --- a/tests/Fixtures/TestBundle/Filter/LengthFilter.php +++ b/tests/Fixtures/TestBundle/Filter/LengthFilter.php @@ -23,7 +23,7 @@ class LengthFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/MultipleOfFilter.php b/tests/Fixtures/TestBundle/Filter/MultipleOfFilter.php index 94ac23436e1..ac850411009 100644 --- a/tests/Fixtures/TestBundle/Filter/MultipleOfFilter.php +++ b/tests/Fixtures/TestBundle/Filter/MultipleOfFilter.php @@ -23,7 +23,7 @@ class MultipleOfFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/PatternFilter.php b/tests/Fixtures/TestBundle/Filter/PatternFilter.php index fc0dc9f8b5a..49ac2e2e701 100644 --- a/tests/Fixtures/TestBundle/Filter/PatternFilter.php +++ b/tests/Fixtures/TestBundle/Filter/PatternFilter.php @@ -23,7 +23,7 @@ class PatternFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/RequiredAllowEmptyFilter.php b/tests/Fixtures/TestBundle/Filter/RequiredAllowEmptyFilter.php index ca2ab3f3e98..35de5c7be46 100644 --- a/tests/Fixtures/TestBundle/Filter/RequiredAllowEmptyFilter.php +++ b/tests/Fixtures/TestBundle/Filter/RequiredAllowEmptyFilter.php @@ -23,7 +23,7 @@ class RequiredAllowEmptyFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/Filter/RequiredFilter.php b/tests/Fixtures/TestBundle/Filter/RequiredFilter.php index c9595651e47..5e25760b880 100644 --- a/tests/Fixtures/TestBundle/Filter/RequiredFilter.php +++ b/tests/Fixtures/TestBundle/Filter/RequiredFilter.php @@ -23,7 +23,7 @@ final class RequiredFilter extends AbstractFilter { use PropertyHelperTrait; - protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, Operation $operation = null, array $context = []): void + protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void { } diff --git a/tests/Fixtures/TestBundle/GraphQl/Type/Definition/DateTimeType.php b/tests/Fixtures/TestBundle/GraphQl/Type/Definition/DateTimeType.php index a6b706f7dce..0ac31b05708 100644 --- a/tests/Fixtures/TestBundle/GraphQl/Type/Definition/DateTimeType.php +++ b/tests/Fixtures/TestBundle/GraphQl/Type/Definition/DateTimeType.php @@ -78,7 +78,7 @@ public function parseValue($value): string /** * {@inheritdoc} */ - public function parseLiteral(Node $valueNode, array $variables = null): string + public function parseLiteral(Node $valueNode, ?array $variables = null): string { if ($valueNode instanceof StringValueNode && false !== \DateTime::createFromFormat(\DateTime::ATOM, $valueNode->value)) { return $valueNode->value; diff --git a/tests/Fixtures/TestBundle/Security/AuthenticationEntryPoint.php b/tests/Fixtures/TestBundle/Security/AuthenticationEntryPoint.php index 7ce006e4e3e..fede8ac88d5 100644 --- a/tests/Fixtures/TestBundle/Security/AuthenticationEntryPoint.php +++ b/tests/Fixtures/TestBundle/Security/AuthenticationEntryPoint.php @@ -28,7 +28,7 @@ public function __construct(private readonly RouterInterface $router) { } - public function start(Request $request, AuthenticationException $authException = null): Response + public function start(Request $request, ?AuthenticationException $authException = null): Response { if ('html' === $request->getRequestFormat()) { return new RedirectResponse($this->router->generate('api_doc', [], UrlGeneratorInterface::ABSOLUTE_URL)); diff --git a/tests/Fixtures/TestBundle/Serializer/ErrorNormalizer.php b/tests/Fixtures/TestBundle/Serializer/ErrorNormalizer.php index 7448d363f0b..0ded5422d5f 100644 --- a/tests/Fixtures/TestBundle/Serializer/ErrorNormalizer.php +++ b/tests/Fixtures/TestBundle/Serializer/ErrorNormalizer.php @@ -22,7 +22,7 @@ public function __construct(private readonly NormalizerInterface $decorated) { } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject { $a = $this->decorated->normalize($object, $format, $context); $a['hello'] = 'world'; @@ -30,7 +30,7 @@ public function normalize(mixed $object, string $format = null, array $context = return $a; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { if (\is_object($data) && $data instanceof TestException) { return true; diff --git a/tests/Fixtures/TestBundle/State/DummyDtoNoOutputProcessor.php b/tests/Fixtures/TestBundle/State/DummyDtoNoOutputProcessor.php index 214a689b4cf..fc0d67e7889 100644 --- a/tests/Fixtures/TestBundle/State/DummyDtoNoOutputProcessor.php +++ b/tests/Fixtures/TestBundle/State/DummyDtoNoOutputProcessor.php @@ -30,7 +30,7 @@ public function __construct(private readonly ManagerRegistry $registry) /** * {@inheritDoc} */ - public function process(mixed $data, Operation $operation = null, array $uriVariables = [], array $context = []) + public function process(mixed $data, ?Operation $operation = null, array $uriVariables = [], array $context = []) { $isOrm = true; $em = $this->registry->getManagerForClass(DummyDtoNoOutput::class); @@ -52,7 +52,7 @@ public function process(mixed $data, Operation $operation = null, array $uriVari /** * {@inheritDoc} */ - public function supports($data, array $identifiers = [], string $operationName = null, array $context = []): bool + public function supports($data, array $identifiers = [], ?string $operationName = null, array $context = []): bool { return $data instanceof InputDto || $data instanceof InputDtoDocument; } diff --git a/tests/Hydra/Serializer/CollectionFiltersNormalizerTest.php b/tests/Hydra/Serializer/CollectionFiltersNormalizerTest.php index b82c8bb4d84..8efc4c978ae 100644 --- a/tests/Hydra/Serializer/CollectionFiltersNormalizerTest.php +++ b/tests/Hydra/Serializer/CollectionFiltersNormalizerTest.php @@ -335,12 +335,12 @@ public function testGetSupportedTypes(): void // TODO: use prophecy when getSupportedTypes() will be added to the interface $normalizer = new CollectionFiltersNormalizer( new class() implements NormalizerInterface { - public function normalize(mixed $object, string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null + public function normalize(mixed $object, ?string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null { return null; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return true; } diff --git a/tests/Hydra/Serializer/PartialCollectionViewNormalizerTest.php b/tests/Hydra/Serializer/PartialCollectionViewNormalizerTest.php index 8311de25783..55f23a4eb05 100644 --- a/tests/Hydra/Serializer/PartialCollectionViewNormalizerTest.php +++ b/tests/Hydra/Serializer/PartialCollectionViewNormalizerTest.php @@ -193,12 +193,12 @@ public function testGetSupportedTypes(): void // TODO: use prophecy when getSupportedTypes() will be added to the interface $normalizer = new PartialCollectionViewNormalizer(new class() implements NormalizerInterface { - public function normalize(mixed $object, string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null + public function normalize(mixed $object, ?string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null { return null; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return true; } diff --git a/tests/Symfony/Bundle/ArgumentResolver/PayloadArgumentResolverTest.php b/tests/Symfony/Bundle/ArgumentResolver/PayloadArgumentResolverTest.php index c521ee024d8..fcd9e21b610 100644 --- a/tests/Symfony/Bundle/ArgumentResolver/PayloadArgumentResolverTest.php +++ b/tests/Symfony/Bundle/ArgumentResolver/PayloadArgumentResolverTest.php @@ -273,7 +273,7 @@ private static function createRequest(string $method, array $attributes): Reques return $request; } - private static function createArgumentMetadata(string $type = null, bool $isVariadic = false): ArgumentMetadata + private static function createArgumentMetadata(?string $type = null, bool $isVariadic = false): ArgumentMetadata { return new ArgumentMetadata('foo', $type, $isVariadic, false, null); } diff --git a/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php b/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php index 42004b587d6..ad5425669f1 100644 --- a/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php +++ b/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php @@ -31,7 +31,7 @@ class DebugResourceCommandTest extends TestCase { use ProphecyTrait; - private function getCommandTester(DataDumperInterface $dumper = null): CommandTester + private function getCommandTester(?DataDumperInterface $dumper = null): CommandTester { $application = new Application(); $application->setCatchExceptions(false); diff --git a/tests/Symfony/Bundle/EventListener/SwaggerUiListenerTest.php b/tests/Symfony/Bundle/EventListener/SwaggerUiListenerTest.php index 054a8dd6d5c..6387bcb46a8 100644 --- a/tests/Symfony/Bundle/EventListener/SwaggerUiListenerTest.php +++ b/tests/Symfony/Bundle/EventListener/SwaggerUiListenerTest.php @@ -29,7 +29,7 @@ class SwaggerUiListenerTest extends TestCase /** * @dataProvider getParameters */ - public function testOnKernelRequest(Request $request, string $controller = null): void + public function testOnKernelRequest(Request $request, ?string $controller = null): void { $eventProphecy = $this->prophesize(RequestEvent::class); $eventProphecy->getRequest()->willReturn($request)->shouldBeCalled(); diff --git a/tests/Symfony/EventListener/DenyAccessListenerTest.php b/tests/Symfony/EventListener/DenyAccessListenerTest.php index 5e4bb049a8c..62a9f3f2ce8 100644 --- a/tests/Symfony/EventListener/DenyAccessListenerTest.php +++ b/tests/Symfony/EventListener/DenyAccessListenerTest.php @@ -155,7 +155,7 @@ public function testSecurityComponentNotAvailable(): void $listener->onSecurity($event); } - private function getListener(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, ResourceAccessCheckerInterface $resourceAccessChecker = null): DenyAccessListener + private function getListener(ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, ?ResourceAccessCheckerInterface $resourceAccessChecker = null): DenyAccessListener { if (null === $resourceAccessChecker) { $resourceAccessChecker = $this->prophesize(ResourceAccessCheckerInterface::class)->reveal(); diff --git a/tests/Symfony/Routing/IriConverterTest.php b/tests/Symfony/Routing/IriConverterTest.php index 25b4e8554d2..668bf0a42d7 100644 --- a/tests/Symfony/Routing/IriConverterTest.php +++ b/tests/Symfony/Routing/IriConverterTest.php @@ -323,7 +323,7 @@ private function getResourceClassResolver() return $resourceClassResolver->reveal(); } - private function getIriConverter(ObjectProphecy $stateProviderProphecy = null, ObjectProphecy $routerProphecy = null, ObjectProphecy $identifiersExtractorProphecy = null, $resourceMetadataCollectionFactoryProphecy = null, $uriVariablesConverter = null, $decorated = null, ObjectProphecy $operationMetadataFactory = null): IriConverter + private function getIriConverter(?ObjectProphecy $stateProviderProphecy = null, ?ObjectProphecy $routerProphecy = null, ?ObjectProphecy $identifiersExtractorProphecy = null, $resourceMetadataCollectionFactoryProphecy = null, $uriVariablesConverter = null, $decorated = null, ?ObjectProphecy $operationMetadataFactory = null): IriConverter { if (!$stateProviderProphecy) { $stateProviderProphecy = $this->prophesize(ProviderInterface::class); diff --git a/tests/Symfony/Validator/Metadata/ValidationExceptionListenerTest.php b/tests/Symfony/Validator/Metadata/ValidationExceptionListenerTest.php index 395b07e9491..029d6bb126a 100644 --- a/tests/Symfony/Validator/Metadata/ValidationExceptionListenerTest.php +++ b/tests/Symfony/Validator/Metadata/ValidationExceptionListenerTest.php @@ -86,7 +86,7 @@ public function testOnKernelValidationExceptionWithCustomStatus(): void $serializedConstraintViolationList = '{"foo": "bar"}'; $constraintViolationList = new ConstraintViolationList([]); $exception = new class($constraintViolationList) extends BaseValidationException implements ConstraintViolationListAwareExceptionInterface { - public function __construct(private readonly ConstraintViolationListInterface $constraintViolationList, $message = '', $code = 0, \Throwable $previous = null) + public function __construct(private readonly ConstraintViolationListInterface $constraintViolationList, $message = '', $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); }