Skip to content
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
5 changes: 0 additions & 5 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ parameters:
identifier: function.alreadyNarrowedType
-
identifier: property.unusedType
-
identifier: return.unusedType
-
path: tests/
identifier: void.pure
-
identifier: varTag.nativeType
-
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Filter/DateFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function getSchema(Parameter $parameter): array
return ['type' => 'string', 'format' => 'date'];
}

public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
public function getOpenApiParameters(Parameter $parameter): array
{
$in = $parameter instanceof QueryParameter ? 'query' : 'header';
$key = $parameter->getKey();
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Filter/RangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
}
}

public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
public function getOpenApiParameters(Parameter $parameter): array

Check warning on line 212 in src/Doctrine/Odm/Filter/RangeFilter.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Odm/Filter/RangeFilter.php#L212

Added line #L212 was not covered by tests
{
$in = $parameter instanceof QueryParameter ? 'query' : 'header';
$key = $parameter->getKey();
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/Filter/DateFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function getSchema(Parameter $parameter): array
return ['type' => 'string', 'format' => 'date'];
}

public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
public function getOpenApiParameters(Parameter $parameter): array
{
$in = $parameter instanceof QueryParameter ? 'query' : 'header';
$key = $parameter->getKey();
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/Filter/RangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
}
}

public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
public function getOpenApiParameters(Parameter $parameter): array

Check warning on line 230 in src/Doctrine/Orm/Filter/RangeFilter.php

View check run for this annotation

Codecov / codecov/patch

src/Doctrine/Orm/Filter/RangeFilter.php#L230

Added line #L230 was not covered by tests
{
$in = $parameter instanceof QueryParameter ? 'query' : 'header';
$key = $parameter->getKey();
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQl/Metadata/RuntimeOperationMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn
{
}

public function create(string $uriTemplate, array $context = []): ?Operation
public function create(string $uriTemplate, array $context = []): Operation
{
try {
$parameters = $this->router->match($uriTemplate);
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQl/Serializer/ObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
*
* @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

Check warning on line 56 in src/GraphQl/Serializer/ObjectNormalizer.php

View check run for this annotation

Codecov / codecov/patch

src/GraphQl/Serializer/ObjectNormalizer.php#L56

Added line #L56 was not covered by tests
{
if (isset($context['api_resource'])) {
$originalResource = $context['api_resource'];
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQl/Type/TypeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
/**
* {@inheritdoc}
*/
public function resolveType(string $type): ?GraphQLType
public function resolveType(string $type): GraphQLType

Check warning on line 122 in src/GraphQl/Type/TypeConverter.php

View check run for this annotation

Codecov / codecov/patch

src/GraphQl/Type/TypeConverter.php#L122

Added line #L122 was not covered by tests
{
try {
$astTypeNode = Parser::parseType($type);
Expand Down
2 changes: 1 addition & 1 deletion src/Hydra/Serializer/DocumentationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct(
/**
* {@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
{
$classes = [];
$entrypointProperties = [];
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApi/Filter/SparseFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
];
}

public function getOpenApiParameters(MetadataParameter $parameter): Parameter|array|null
public function getOpenApiParameters(MetadataParameter $parameter): Parameter

Check warning on line 36 in src/JsonApi/Filter/SparseFieldset.php

View check run for this annotation

Codecov / codecov/patch

src/JsonApi/Filter/SparseFieldset.php#L36

Added line #L36 was not covered by tests
{
return new Parameter(
name: ($k = $parameter->getKey()).'[]',
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApi/Serializer/EntrypointNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/**
* {@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

Check warning on line 42 in src/JsonApi/Serializer/EntrypointNormalizer.php

View check run for this annotation

Codecov / codecov/patch

src/JsonApi/Serializer/EntrypointNormalizer.php#L42

Added line #L42 was not covered by tests
{
$entrypoint = ['links' => ['self' => $this->urlGenerator->generate('api_entrypoint', [], UrlGeneratorInterface::ABS_URL)]];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function create(string $resourceClass, string $property, array $options =
}
}

$extraProperties = $propertyMetadata->getExtraProperties() ?? [];
$extraProperties = $propertyMetadata->getExtraProperties();
// see AttributePropertyMetadataFactory
if (true === ($extraProperties[self::JSON_SCHEMA_USER_DEFINED] ?? false)) {
// schema seems to have been declared by the user: do not override nor complete user value
Expand Down
4 changes: 2 additions & 2 deletions src/JsonSchema/SchemaFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
unset($propertySchema['type']);
}

$extraProperties = $propertyMetadata->getExtraProperties() ?? [];
$extraProperties = $propertyMetadata->getExtraProperties();

Check warning on line 179 in src/JsonSchema/SchemaFactory.php

View check run for this annotation

Codecov / codecov/patch

src/JsonSchema/SchemaFactory.php#L179

Added line #L179 was not covered by tests
// see AttributePropertyMetadataFactory
if (true === ($extraProperties[SchemaPropertyMetadataFactory::JSON_SCHEMA_USER_DEFINED] ?? false)) {
// schema seems to have been declared by the user: do not override nor complete user value
Expand Down Expand Up @@ -295,7 +295,7 @@
$additionalPropertySchema ?? []
);

$extraProperties = $propertyMetadata->getExtraProperties() ?? [];
$extraProperties = $propertyMetadata->getExtraProperties();
// see AttributePropertyMetadataFactory
if (true === ($extraProperties[SchemaPropertyMetadataFactory::JSON_SCHEMA_USER_DEFINED] ?? false)) {
// schema seems to have been declared by the user: do not override nor complete user value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
// can't know later if the schema has been defined by the user or by API Platform
// store extra key to make this difference
if (null !== $propertyMetadata->getSchema()) {
$extraProperties = $propertyMetadata->getExtraProperties() ?? [];
$extraProperties = $propertyMetadata->getExtraProperties();

Check warning on line 82 in src/Laravel/Eloquent/Metadata/Factory/Property/EloquentAttributePropertyMetadataFactory.php

View check run for this annotation

Codecov / codecov/patch

src/Laravel/Eloquent/Metadata/Factory/Property/EloquentAttributePropertyMetadataFactory.php#L82

Added line #L82 was not covered by tests
$propertyMetadata = $propertyMetadata->withExtraProperties([SchemaPropertyMetadataFactory::JSON_SCHEMA_USER_DEFINED => true] + $extraProperties);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/ApiProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public function isInitializable(): ?bool
return $this->initializable;
}

public function getExtraProperties(): ?array
public function getExtraProperties(): array
{
return $this->extraProperties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function handleUserDefinedSchema(ApiProperty $propertyMetadata): ApiProp
// can't know later if the schema has been defined by the user or by API Platform
// store extra key to make this difference
if (null !== $propertyMetadata->getSchema()) {
$extraProperties = $propertyMetadata->getExtraProperties() ?? [];
$extraProperties = $propertyMetadata->getExtraProperties();
$propertyMetadata = $propertyMetadata->withExtraProperties([SchemaPropertyMetadataFactory::JSON_SCHEMA_USER_DEFINED => true] + $extraProperties);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
// can't know later if the schema has been defined by the user or by API Platform
// store extra key to make this difference
if (null !== $propertyMetadata->getSchema()) {
$extraProperties = $propertyMetadata->getExtraProperties() ?? [];
$extraProperties = $propertyMetadata->getExtraProperties();

Check warning on line 136 in src/Metadata/Property/Factory/ExtractorPropertyMetadataFactory.php

View check run for this annotation

Codecov / codecov/patch

src/Metadata/Property/Factory/ExtractorPropertyMetadataFactory.php#L136

Added line #L136 was not covered by tests
$propertyMetadata = $propertyMetadata->withExtraProperties([SchemaPropertyMetadataFactory::JSON_SCHEMA_USER_DEFINED => true] + $extraProperties);
}

Expand Down
2 changes: 1 addition & 1 deletion src/OpenApi/Serializer/ApiGatewayNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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
{
$data = $this->documentationNormalizer->normalize($object, $format, $context);
if (!\is_array($data)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Serializer/AbstractItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function denormalize(mixed $data, string $class, ?string $format = null,
foreach (array_keys($data) as $attribute) {
$attribute = $this->nameConverter ? $this->nameConverter->denormalize((string) $attribute) : $attribute;
$propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $attribute, $options);
$attributeExtraProperties = $propertyMetadata->getExtraProperties() ?? [];
$attributeExtraProperties = $propertyMetadata->getExtraProperties();
$throwOnPropertyAccessDenied = $attributeExtraProperties['throw_on_access_denied'] ?? $throwOnAccessDenied;
if (!\in_array($attribute, $propertyNames, true)) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/Serializer/Filter/PropertyFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function getSchema(MetadataParameter $parameter): array
];
}

public function getOpenApiParameters(MetadataParameter $parameter): Parameter|array|null
public function getOpenApiParameters(MetadataParameter $parameter): Parameter
{
$example = \sprintf(
'%1$s[]={propertyName}&%1$s[]={anotherPropertyName}',
Expand Down
6 changes: 3 additions & 3 deletions src/State/Exception/ParameterNotSupportedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
return $this->message;
}

public function getStatus(): ?int
public function getStatus(): int
{
return 400;
}

public function getDetail(): ?string
public function getDetail(): string

Check warning on line 41 in src/State/Exception/ParameterNotSupportedException.php

View check run for this annotation

Codecov / codecov/patch

src/State/Exception/ParameterNotSupportedException.php#L41

Added line #L41 was not covered by tests
{
return \sprintf('Parameter "%s" not supported', $this->parameter);
}

public function getInstance(): ?string
public function getInstance(): string

Check warning on line 46 in src/State/Exception/ParameterNotSupportedException.php

View check run for this annotation

Codecov / codecov/patch

src/State/Exception/ParameterNotSupportedException.php#L46

Added line #L46 was not covered by tests
{
return $this->parameter;
}
Expand Down
2 changes: 1 addition & 1 deletion src/State/Provider/BackedEnumProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

final class BackedEnumProvider implements ProviderInterface
{
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array
{
$resourceClass = $operation->getClass();
if (!$resourceClass || !is_a($resourceClass, \BackedEnum::class, true)) {
Expand Down
2 changes: 1 addition & 1 deletion src/State/Tests/ParameterProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function get(string $id)
{
if ('test' === $id) {
return new class implements ParameterProviderInterface {
public function provide(Parameter $parameter, array $parameters = [], array $context = []): ?Operation
public function provide(Parameter $parameter, array $parameters = [], array $context = []): Operation
{
return new Get(name: 'ok');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Routing/IriConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,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));

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Routing/SkolemIriConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

foreach ($nestedConstraints as $nestedConstraint) {
foreach ($this->restrictionsMetadata as $restrictionMetadata) {
if ($restrictionMetadata->supports($nestedConstraint, $propertyMetadata->withExtraProperties(($propertyMetadata->getExtraProperties() ?? []) + ['nested_schema' => true])) && !empty($nestedConstraintRestriction = $restrictionMetadata->create($nestedConstraint, $propertyMetadata))) {
if ($restrictionMetadata->supports($nestedConstraint, $propertyMetadata->withExtraProperties($propertyMetadata->getExtraProperties() + ['nested_schema' => true])) && !empty($nestedConstraintRestriction = $restrictionMetadata->create($nestedConstraint, $propertyMetadata))) {

Check warning on line 79 in src/Symfony/Validator/Metadata/Property/Restriction/PropertySchemaCollectionRestriction.php

View check run for this annotation

Codecov / codecov/patch

src/Symfony/Validator/Metadata/Property/Restriction/PropertySchemaCollectionRestriction.php#L79

Added line #L79 was not covered by tests
$propertyRestrictions[] = $nestedConstraintRestriction;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function create(string $resourceClass, string $property, array $options =
{
$propertyMetadata = $this->decorated->create($resourceClass, $property, $options);

$extraProperties = $propertyMetadata->getExtraProperties() ?? [];
$extraProperties = $propertyMetadata->getExtraProperties();
// see AttributePropertyMetadataFactory
if (true === ($extraProperties[SchemaPropertyMetadataFactory::JSON_SCHEMA_USER_DEFINED] ?? false)) {
// schema seems to have been declared by the user: do not override nor complete user value
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/TestBundle/HttpCache/TagCollectorCustom.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function collect(array $context = []): void
$this->addCacheTagForResource($context, $iri);
}

private function addCacheTagForResource(array $context, string $iri): void
private function addCacheTagForResource(array &$context, string $iri): void
{
$context['resources'][$iri] = $iri;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function collect(array $context = []): void
}
}

private function addResourceToContext(array $context): void
private function addResourceToContext(array &$context): void
{
$iri = $context['iri'];

Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/TestBundle/Serializer/ErrorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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|\ArrayObject
{
$a = $this->decorated->normalize($object, $format, $context);
$a['hello'] = 'world';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(private readonly NormalizerInterface $documentationN
*
* @throws ExceptionInterface
*/
public function normalize($object, $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null
public function normalize($object, $format = null, array $context = []): array
{
$data = $this->documentationNormalizer->normalize($object, $format, $context);
if (!\is_array($data)) {
Expand Down
Loading