Skip to content

Commit 66e2672

Browse files
Merge 3.2 (#6145)
* fix(hydra): move owl:maxCardinality from JsonSchema to Hydra (#6136) * docs: changelog v3.2.13 * cs: missing strict type * docs: guide sf/apip version * test: security configuration * 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 --------- Co-authored-by: Vincent <[email protected]>
1 parent 7e05f45 commit 66e2672

File tree

269 files changed

+1129
-1119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+1129
-1119
lines changed

docs/src/Kernel.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Kernel extends BaseKernel
4545
private $declaredClasses = [];
4646
private string $guide;
4747

48-
public function __construct(string $environment, bool $debug, string $guide = null)
48+
public function __construct(string $environment, bool $debug, ?string $guide = null)
4949
{
5050
parent::__construct($environment, $debug);
5151

@@ -118,7 +118,7 @@ private function configureContainer(ContainerConfigurator $container, LoaderInte
118118
}
119119
}
120120

121-
public function request(Request $request = null): Response
121+
public function request(?Request $request = null): Response
122122
{
123123
if (null === $request && \function_exists('App\Playground\request')) {
124124
$request = request();

features/openapi/docs.feature

-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ Feature: Documentation support
9898
And the "playMode" property for the OpenAPI class "VideoGame" should be equal to:
9999
"""
100100
{
101-
"owl:maxCardinality": 1,
102101
"type": "string",
103102
"format": "iri-reference",
104103
"example": "https://example.com/"
@@ -310,7 +309,6 @@ Feature: Documentation support
310309
And the "resourceRelated" property for the OpenAPI class "Resource" should be equal to:
311310
"""
312311
{
313-
"owl:maxCardinality": 1,
314312
"readOnly": true,
315313
"anyOf": [
316314
{
@@ -389,7 +387,6 @@ Feature: Documentation support
389387
And the "data" property for the OpenAPI class "WrappedResponseEntity.CustomOutputEntityWrapperDto-read" should be equal to:
390388
"""
391389
{
392-
"owl:maxCardinality": 1,
393390
"$ref": "#\/components\/schemas\/WrappedResponseEntity-read"
394391
}
395392
"""

src/Action/EntrypointAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
/**
4242
* @return Entrypoint|Response
4343
*/
44-
public function __invoke(Request $request = null)
44+
public function __invoke(?Request $request = null)
4545
{
4646
if ($this->provider && $this->processor) {
4747
$context = ['request' => $request];

src/Action/ExceptionAction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class ExceptionAction
4343
* @param array $errorFormats A list of enabled error formats
4444
* @param array $exceptionToStatus A list of exceptions mapped to their HTTP status code
4545
*/
46-
public function __construct(private readonly SerializerInterface $serializer, private readonly array $errorFormats, private readonly array $exceptionToStatus = [], ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null)
46+
public function __construct(private readonly SerializerInterface $serializer, private readonly array $errorFormats, private readonly array $exceptionToStatus = [], ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null)
4747
{
4848
$this->resourceMetadataCollectionFactory = $resourceMetadataCollectionFactory;
4949
}

src/Api/FilterLocatorTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private function setFilterLocator(?ContainerInterface $filterLocator, bool $allo
4545
/**
4646
* Gets a filter with a backward compatibility.
4747
*/
48-
private function getFilter(string $filterId): null|FilterInterface|MetadataFilterInterface
48+
private function getFilter(string $filterId): FilterInterface|MetadataFilterInterface|null
4949
{
5050
if ($this->filterLocator && $this->filterLocator->has($filterId)) {
5151
return $this->filterLocator->get($filterId);

src/Api/IdentifiersExtractor.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class IdentifiersExtractor implements IdentifiersExtractorInterface
3737
use ResourceClassInfoTrait;
3838
private readonly PropertyAccessorInterface $propertyAccessor;
3939

40-
public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, PropertyAccessorInterface $propertyAccessor = null)
40+
public function __construct(ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, ResourceClassResolverInterface $resourceClassResolver, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, ?PropertyAccessorInterface $propertyAccessor = null)
4141
{
4242
$this->resourceMetadataFactory = $resourceMetadataFactory;
4343
$this->resourceClassResolver = $resourceClassResolver;
@@ -49,7 +49,7 @@ public function __construct(ResourceMetadataCollectionFactoryInterface $resource
4949
*
5050
* TODO: 3.0 identifiers should be stringable?
5151
*/
52-
public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array
52+
public function getIdentifiersFromItem(object $item, ?Operation $operation = null, array $context = []): array
5353
{
5454
if (!$this->isResourceClass($this->getObjectClass($item))) {
5555
return ['id' => $this->propertyAccessor->getValue($item, 'id')];
@@ -96,7 +96,7 @@ private function getIdentifiersFromOperation(object $item, Operation $operation,
9696
/**
9797
* Gets the value of the given class property.
9898
*/
99-
private function getIdentifierValue(object $item, string $class, string $property, string $parameterName, string $toProperty = null): float|bool|int|string
99+
private function getIdentifierValue(object $item, string $class, string $property, string $parameterName, ?string $toProperty = null): float|bool|int|string
100100
{
101101
if ($item instanceof $class) {
102102
try {

src/Api/IdentifiersExtractorInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ interface IdentifiersExtractorInterface
2828
*
2929
* @throws RuntimeException
3030
*/
31-
public function getIdentifiersFromItem(object $item, Operation $operation = null, array $context = []): array;
31+
public function getIdentifiersFromItem(object $item, ?Operation $operation = null, array $context = []): array;
3232
}

src/Api/IriConverterInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface IriConverterInterface
3131
* @throws InvalidArgumentException
3232
* @throws ItemNotFoundException
3333
*/
34-
public function getResourceFromIri(string $iri, array $context = [], Operation $operation = null): object;
34+
public function getResourceFromIri(string $iri, array $context = [], ?Operation $operation = null): object;
3535

3636
/**
3737
* Gets the IRI associated with the given item.
@@ -41,5 +41,5 @@ public function getResourceFromIri(string $iri, array $context = [], Operation $
4141
* @throws InvalidArgumentException
4242
* @throws RuntimeException
4343
*/
44-
public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = []): ?string;
44+
public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): ?string;
4545
}

src/Api/ResourceClassResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(private readonly ResourceNameCollectionFactoryInterf
3838
/**
3939
* {@inheritdoc}
4040
*/
41-
public function getResourceClass(mixed $value, string $resourceClass = null, bool $strict = false): string
41+
public function getResourceClass(mixed $value, ?string $resourceClass = null, bool $strict = false): string
4242
{
4343
if ($strict && null === $resourceClass) {
4444
throw new InvalidArgumentException('Strict checking is only possible when resource class is specified.');

src/Api/ResourceClassResolverInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface ResourceClassResolverInterface
3030
*
3131
* @throws InvalidArgumentException
3232
*/
33-
public function getResourceClass(mixed $value, string $resourceClass = null, bool $strict = false): string;
33+
public function getResourceClass(mixed $value, ?string $resourceClass = null, bool $strict = false): string;
3434

3535
/**
3636
* Is the given class a resource class?

src/Doctrine/Common/Filter/NumericFilterTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getDescription(string $resourceClass): array
6363
/**
6464
* Gets the PHP type corresponding to this Doctrine type.
6565
*/
66-
abstract protected function getType(string $doctrineType = null): string;
66+
abstract protected function getType(?string $doctrineType = null): string;
6767

6868
abstract protected function getProperties(): ?array;
6969

src/Doctrine/Common/Filter/SearchFilterTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ trait SearchFilterTrait
3434

3535
protected IriConverterInterface|LegacyIriConverterInterface $iriConverter;
3636
protected PropertyAccessorInterface $propertyAccessor;
37-
protected null|IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface $identifiersExtractor = null;
37+
protected IdentifiersExtractorInterface|LegacyIdentifiersExtractorInterface|null $identifiersExtractor = null;
3838

3939
/**
4040
* {@inheritdoc}
@@ -165,7 +165,7 @@ protected function normalizeValues(array $values, string $property): ?array
165165
/**
166166
* When the field should be an integer, check that the given value is a valid one.
167167
*/
168-
protected function hasValidValues(array $values, string $type = null): bool
168+
protected function hasValidValues(array $values, ?string $type = null): bool
169169
{
170170
foreach ($values as $value) {
171171
if (null !== $value && \in_array($type, (array) self::DOCTRINE_INTEGER_TYPE, true) && false === filter_var($value, \FILTER_VALIDATE_INT)) {

src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/Dummy.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ public function getFoo(): ?array
194194
return $this->foo;
195195
}
196196

197-
public function setFoo(array $foo = null): void
197+
public function setFoo(?array $foo = null): void
198198
{
199199
$this->foo = $foo;
200200
}
201201

202-
public function setDummyDate(\DateTime $dummyDate = null): void
202+
public function setDummyDate(?\DateTime $dummyDate = null): void
203203
{
204204
$this->dummyDate = $dummyDate;
205205
}

src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function getThirdLevel(): ?ThirdLevel
161161
return $this->thirdLevel;
162162
}
163163

164-
public function setThirdLevel(ThirdLevel $thirdLevel = null): void
164+
public function setThirdLevel(?ThirdLevel $thirdLevel = null): void
165165
{
166166
$this->thirdLevel = $thirdLevel;
167167
}

src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getFourthLevel(): ?FourthLevel
8787
return $this->fourthLevel;
8888
}
8989

90-
public function setFourthLevel(FourthLevel $fourthLevel = null): void
90+
public function setFourthLevel(?FourthLevel $fourthLevel = null): void
9191
{
9292
$this->fourthLevel = $fourthLevel;
9393
}

src/Doctrine/EventListener/PublishMercureUpdatesListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ final class PublishMercureUpdatesListener
6666
/**
6767
* @param array<string, string[]|string> $formats
6868
*/
69-
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)
69+
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)
7070
{
7171
if (null === $messageBus && null === $hubRegistry) {
7272
throw new InvalidArgumentException('A message bus or a hub registry must be provided.');

src/Doctrine/EventListener/PurgeHttpCacheListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class PurgeHttpCacheListener
4343
private readonly PropertyAccessorInterface $propertyAccessor;
4444
private array $tags = [];
4545

46-
public function __construct(private readonly PurgerInterface $purger, private readonly IriConverterInterface|LegacyIriConverterInterface $iriConverter, private readonly ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null)
46+
public function __construct(private readonly PurgerInterface $purger, private readonly IriConverterInterface|LegacyIriConverterInterface $iriConverter, private readonly ResourceClassResolverInterface|LegacyResourceClassResolverInterface $resourceClassResolver, ?PropertyAccessorInterface $propertyAccessor = null)
4747
{
4848
$this->propertyAccessor = $propertyAccessor ?? PropertyAccess::createPropertyAccessor();
4949
}

src/Doctrine/Odm/Extension/AggregationCollectionExtensionInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
*/
2424
interface AggregationCollectionExtensionInterface
2525
{
26-
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void;
26+
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void;
2727
}

src/Doctrine/Odm/Extension/AggregationItemExtensionInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
*/
2424
interface AggregationItemExtensionInterface
2525
{
26-
public function applyToItem(Builder $aggregationBuilder, string $resourceClass, array $identifiers, Operation $operation = null, array &$context = []): void;
26+
public function applyToItem(Builder $aggregationBuilder, string $resourceClass, array $identifiers, ?Operation $operation = null, array &$context = []): void;
2727
}

src/Doctrine/Odm/Extension/AggregationResultCollectionExtensionInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
interface AggregationResultCollectionExtensionInterface extends AggregationCollectionExtensionInterface
2626
{
27-
public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool;
27+
public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool;
2828

29-
public function getResult(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array $context = []): iterable;
29+
public function getResult(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array $context = []): iterable;
3030
}

src/Doctrine/Odm/Extension/AggregationResultItemExtensionInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
interface AggregationResultItemExtensionInterface extends AggregationItemExtensionInterface
2626
{
27-
public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool;
27+
public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool;
2828

29-
public function getResult(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array $context = []): ?object;
29+
public function getResult(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array $context = []): ?object;
3030
}

src/Doctrine/Odm/Extension/FilterExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(private readonly ContainerInterface $filterLocator)
3333
/**
3434
* {@inheritdoc}
3535
*/
36-
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void
36+
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void
3737
{
3838
$resourceFilters = $operation?->getFilters();
3939

src/Doctrine/Odm/Extension/OrderExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(private readonly ?string $order = null, private read
4040
/**
4141
* {@inheritdoc}
4242
*/
43-
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void
43+
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void
4444
{
4545
// Do not apply order if already defined on $aggregationBuilder
4646
if ($this->hasSortStage($aggregationBuilder)) {

src/Doctrine/Odm/Extension/PaginationExtension.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(private readonly ManagerRegistry $managerRegistry, p
4040
*
4141
* @throws RuntimeException
4242
*/
43-
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void
43+
public function applyToCollection(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void
4444
{
4545
if (!$this->pagination->isEnabled($operation, $context)) {
4646
return;
@@ -85,7 +85,7 @@ public function applyToCollection(Builder $aggregationBuilder, string $resourceC
8585
/**
8686
* {@inheritdoc}
8787
*/
88-
public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool
88+
public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool
8989
{
9090
if ($context['graphql_operation_name'] ?? false) {
9191
return $this->pagination->isGraphQlEnabled($operation, $context);
@@ -99,7 +99,7 @@ public function supportsResult(string $resourceClass, Operation $operation = nul
9999
*
100100
* @throws RuntimeException
101101
*/
102-
public function getResult(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array $context = []): iterable
102+
public function getResult(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array $context = []): iterable
103103
{
104104
$manager = $this->managerRegistry->getManagerForClass($resourceClass);
105105
if (!$manager instanceof DocumentManager) {

src/Doctrine/Odm/Filter/AbstractFilter.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ abstract class AbstractFilter implements FilterInterface
3535
use PropertyHelperTrait;
3636
protected LoggerInterface $logger;
3737

38-
public function __construct(protected ManagerRegistry $managerRegistry, LoggerInterface $logger = null, protected ?array $properties = null, protected ?NameConverterInterface $nameConverter = null)
38+
public function __construct(protected ManagerRegistry $managerRegistry, ?LoggerInterface $logger = null, protected ?array $properties = null, protected ?NameConverterInterface $nameConverter = null)
3939
{
4040
$this->logger = $logger ?? new NullLogger();
4141
}
4242

4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function apply(Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void
46+
public function apply(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void
4747
{
4848
foreach ($context['filters'] as $property => $value) {
4949
$this->filterProperty($this->denormalizePropertyName($property), $value, $aggregationBuilder, $resourceClass, $operation, $context);
@@ -53,7 +53,7 @@ public function apply(Builder $aggregationBuilder, string $resourceClass, Operat
5353
/**
5454
* Passes a property through the filter.
5555
*/
56-
abstract protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void;
56+
abstract protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void;
5757

5858
protected function getManagerRegistry(): ManagerRegistry
5959
{

src/Doctrine/Odm/Filter/BooleanFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ final class BooleanFilter extends AbstractFilter
116116
/**
117117
* {@inheritdoc}
118118
*/
119-
protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, Operation $operation = null, array &$context = []): void
119+
protected function filterProperty(string $property, $value, Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array &$context = []): void
120120
{
121121
if (
122122
!$this->isPropertyEnabled($property, $resourceClass)

0 commit comments

Comments
 (0)