Skip to content
Open
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
17 changes: 17 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@ parameters:
# Level 6
-
identifier: missingType.iterableValue
paths:
- src/Doctrine/Common/Tests
- src/Doctrine/Odm/Tests
- src/Doctrine/Orm/Tests
- src/Elasticsearch/Tests
- src/GraphQl/Tests
- src/HttpCache/Tests
- src/Hydra/Tests
- src/JsonApi/Tests
- src/JsonSchema/Tests
- src/Metadata/Tests
- src/OpenApi/Tests
- src/Serializer/Tests
- src/State/Tests
- src/Symfony/Tests
- tests
- src # TODO
-
identifier: missingType.generics
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @author Antoine Bluchet <soyuka@gmail.com>
*
* @method ?array getProperties()
* @method array<string>|null getProperties()
*
* @experimental
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@
*/
interface AggregationCollectionExtensionInterface
{
/**
* @param array<string, mixed> $context
*
* @param-out array<string, mixed> $context
*/
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,10 @@
*/
interface AggregationItemExtensionInterface
{
/**
* @param array<string, mixed> $context
*
* @param-out array<string, mixed> $context
*/
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,13 @@
*/
interface AggregationResultCollectionExtensionInterface extends AggregationCollectionExtensionInterface
{
/**
* @param array<string, mixed> $context
*/
public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool;

/**
* @param array<string, mixed> $context
*/
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,13 @@
*/
interface AggregationResultItemExtensionInterface extends AggregationItemExtensionInterface
{
/**
* @param array<string, mixed> $context
*/
public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool;

/**
* @param array<string, mixed> $context
*/
public function getResult(Builder $aggregationBuilder, string $resourceClass, ?Operation $operation = null, array $context = []): ?object;
}
5 changes: 5 additions & 0 deletions src/Doctrine/Odm/Extension/PaginationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ public function getResult(Builder $aggregationBuilder, string $resourceClass, ?O
return new Paginator($iterator, $manager->getUnitOfWork(), $resourceClass);
}

/**
* @param array<string, mixed> $context
*
* @return array<string, mixed>
*/
private function addCountToContext(Builder $aggregationBuilder, array $context): array
{
if (!($context['graphql_operation_name'] ?? false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
*/
interface QueryResultCollectionExtensionInterface extends QueryCollectionExtensionInterface
{
/**
* @param array<string, mixed> $context
*/
public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool;

/**
* @param array<string, mixed> $context
*/
public function getResult(QueryBuilder $queryBuilder, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): iterable;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@
*/
interface QueryResultItemExtensionInterface extends QueryItemExtensionInterface
{
/**
* @param array<string, mixed> $context
*/
public function supportsResult(string $resourceClass, ?Operation $operation = null, array $context = []): bool;

/**
* @param array<string, mixed> $context
*/
public function getResult(QueryBuilder $queryBuilder, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): ?object;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
*/
interface RequestBodySearchCollectionExtensionInterface
{
/**
* @param array<string, mixed> $context
*/
public function applyToCollection(array $requestBody, string $resourceClass, ?Operation $operation = null, array $context = []): array;
}
3 changes: 3 additions & 0 deletions src/Elasticsearch/Filter/FilterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
*/
interface FilterInterface extends BaseFilterInterface
{
/**
* @param array<string, mixed> $context
*/
public function apply(array $clauseBody, string $resourceClass, ?Operation $operation = null, array $context = []): array;
}
3 changes: 3 additions & 0 deletions src/GraphQl/Resolver/MutationResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
*/
interface MutationResolverInterface
{
/**
* @param array<string, mixed> $context
*/
public function __invoke(?object $item, array $context): ?object;
}
3 changes: 2 additions & 1 deletion src/GraphQl/Resolver/QueryCollectionResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
interface QueryCollectionResolverInterface
{
/**
* @param iterable<object> $collection
* @param iterable<object> $collection
* @param array<string, mixed> $context
*
* @return iterable<object>
*/
Expand Down
3 changes: 3 additions & 0 deletions src/GraphQl/Resolver/QueryItemResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
*/
interface QueryItemResolverInterface
{
/**
* @param array<string, mixed> $context
*/
public function __invoke(?object $item, array $context): object;
}
5 changes: 5 additions & 0 deletions src/GraphQl/Serializer/SerializerContextBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@
*/
interface SerializerContextBuilderInterface
{
/**
* @param array<string, mixed> $resolverContext
*
* @return array<string, mixed>
*/
public function create(string $resourceClass, Operation $operation, array $resolverContext, bool $normalization): array;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
*/
interface OperationAwareSubscriptionManagerInterface extends SubscriptionManagerInterface
{
/**
* @param array<string, mixed> $context
*/
public function retrieveSubscriptionId(array $context, ?array $result, ?Operation $operation = null): ?string;
}
3 changes: 3 additions & 0 deletions src/GraphQl/Subscription/SubscriptionManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
*/
interface SubscriptionManagerInterface
{
/**
* @param array<string, mixed> $context
*/
public function retrieveSubscriptionId(array $context, ?array $result): ?string;

public function getPushPayloads(object $object): array;
Expand Down
2 changes: 2 additions & 0 deletions src/HttpCache/PurgerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public function purge(array $iris): void;
* Get the response header containing purged tags.
*
* @param string[] $iris
*
* @return array<string, string>
*/
public function getResponseHeaders(array $iris): array;
}
2 changes: 2 additions & 0 deletions src/JsonLd/AnonymousContextBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ interface AnonymousContextBuilderInterface extends ContextBuilderInterface
/**
* Creates a JSON-LD context based on the given object.
* Usually this is used with an Input or Output DTO object.
*
* @param array<string, mixed> $context
*/
public function getAnonymousResourceContext(object $object, array $context = [], int $referenceType = UrlGeneratorInterface::ABS_PATH): array;
}
3 changes: 2 additions & 1 deletion src/JsonSchema/DefinitionNameFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ interface DefinitionNameFactoryInterface
/**
* Creates a resource definition name.
*
* @param class-string $className
* @param class-string $className
* @param array<string, mixed> $serializerContext
*
* @return string the definition name
*/
Expand Down
2 changes: 2 additions & 0 deletions src/JsonSchema/SchemaFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface SchemaFactoryInterface

/**
* Builds the JSON Schema document corresponding to the given PHP class.
*
* @param array<string, mixed>|null $serializerContext
*/
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;
}
2 changes: 2 additions & 0 deletions src/Metadata/Exception/HttpExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function getStatusCode(): int;

/**
* Returns response headers.
*
* @return array<string, string>
*/
public function getHeaders(): array;
}
2 changes: 2 additions & 0 deletions src/Metadata/Extractor/PropertyExtractorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface PropertyExtractorInterface
* Parses all metadata files and convert them in an array.
*
* @throws InvalidArgumentException
*
* @return array<string, array<string, array<string, mixed>>>
*/
public function getProperties(): array;
}
12 changes: 6 additions & 6 deletions src/Metadata/UriVariableTransformerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ interface UriVariableTransformerInterface
/**
* Transforms the value of a URI variable (identifier) to its type.
*
* @param mixed $value The URI variable value to transform
* @param array $types The guessed type behind the URI variable
* @param array $context Options available to the transformer
* @param mixed $value The URI variable value to transform
* @param array<string> $types The guessed type behind the URI variable
* @param array<string, mixed> $context Options available to the transformer
*
* @throws InvalidUriVariableException Occurs when the URI variable could not be transformed
*
Expand All @@ -33,9 +33,9 @@ public function transform(mixed $value, array $types, array $context = []);
/**
* Checks whether the value of a URI variable can be transformed to its type by this transformer.
*
* @param mixed $value The URI variable value to transform
* @param array $types The types to which the URI variable value should be transformed
* @param array $context Options available to the transformer
* @param mixed $value The URI variable value to transform
* @param array<string> $types The types to which the URI variable value should be transformed
* @param array<string, mixed> $context Options available to the transformer
*/
public function supportsTransformation(mixed $value, array $types, array $context = []): bool;
}
7 changes: 4 additions & 3 deletions src/Metadata/UriVariablesConverterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ interface UriVariablesConverterInterface
/**
* Takes an array of strings representing URI variables (identifiers) and transform their values to the expected type.
*
* @param array $data URI variables to convert to PHP values
* @param string $class The class to which the URI variables belong to
* @param array<string, mixed> $data URI variables to convert to PHP values
* @param string $class The class to which the URI variables belong to
* @param array<string, mixed> $context
*
* @throws InvalidIdentifierException
* @throws InvalidUriVariableException
*
* @return array Array indexed by identifiers properties with their values denormalized
* @return array<string, mixed> Array indexed by identifiers properties with their values denormalized
*/
public function convert(array $data, string $class, array $context = []): array;
}
5 changes: 5 additions & 0 deletions src/Serializer/Filter/FilterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ interface FilterInterface extends BaseFilterInterface
{
/**
* Apply a filter to the serializer context.
*
* @param array<string, mixed> $attributes
* @param array<string, mixed> $context
*
* @param-out array<string, mixed> $context
*/
public function apply(Request $request, bool $normalization, array $attributes, array &$context): void;
}
2 changes: 2 additions & 0 deletions src/State/SerializerContextBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ interface SerializerContextBuilderInterface
/**
* Creates a serialization context from a Request.
*
* @param array<string, mixed>|null $extractedAttributes
*
* @throws RuntimeException
*
* @return array<string, mixed>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface PropertySchemaRestrictionMetadataInterface
* @param Constraint $constraint The validation constraint
* @param ApiProperty $propertyMetadata The property metadata
*
* @return array The array of restrictions
* @return array<string, mixed> The array of restrictions
*/
public function create(Constraint $constraint, ApiProperty $propertyMetadata): array;

Expand Down
2 changes: 2 additions & 0 deletions src/Validator/ValidatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ interface ValidatorInterface
/**
* Validates an item.
*
* @param array<string, mixed> $context
*
* @throws ValidationException
*/
public function validate(object $data, array $context = []): void;
Expand Down
Loading