Skip to content

Merge 3.2 #6145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
3 changes: 0 additions & 3 deletions features/openapi/docs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down Expand Up @@ -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": [
{
Expand Down Expand Up @@ -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"
}
"""
Expand Down
2 changes: 1 addition & 1 deletion src/Action/EntrypointAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/Action/ExceptionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/FilterLocatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/Api/IdentifiersExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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')];
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/Api/IdentifiersExtractorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions src/Api/IriConverterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion src/Api/ResourceClassResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ResourceClassResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Common/Filter/NumericFilterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Common/Filter/SearchFilterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class PublishMercureUpdatesListener
/**
* @param array<string, string[]|string> $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.');
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/EventListener/PurgeHttpCacheListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Extension/FilterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Extension/OrderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions src/Doctrine/Odm/Extension/PaginationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/Doctrine/Odm/Filter/AbstractFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ 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();
}

/**
* {@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);
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Filter/BooleanFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading