Skip to content

fix: 7119 parameter array shape uses invalid syntax #7151

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 11 additions & 11 deletions src/Metadata/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
abstract class Parameter
{
/**
* @param (array<string, mixed>&array{type?: string, default?: string})|null $schema
* @param array<string, mixed> $extraProperties
* @param ParameterProviderInterface|callable|string|null $provider
* @param list<string> $properties a list of properties this parameter applies to (works with the :property placeholder)
* @param FilterInterface|string|null $filter
* @param mixed $constraints an array of Symfony constraints, or an array of Laravel rules
* @param Type $nativeType the PHP native type, we cast values to an array if its a CollectionType, if not and it's an array with a single value we use it (eg: HTTP Header)
* @param ?bool $castToNativeType whether API Platform should cast your parameter to the nativeType declared
* @param ?callable(mixed): mixed $castFn the closure used to cast your parameter, this gets called only when $castToNativeType is set
* @param array{type?: string, default?: string, ...<string, mixed>}|null $schema
* @param array<string, mixed> $extraProperties
* @param ParameterProviderInterface|callable|string|null $provider
* @param list<string> $properties a list of properties this parameter applies to (works with the :property placeholder)
* @param FilterInterface|string|null $filter
* @param mixed $constraints an array of Symfony constraints, or an array of Laravel rules
* @param Type $nativeType the PHP native type, we cast values to an array if its a CollectionType, if not and it's an array with a single value we use it (eg: HTTP Header)
* @param ?bool $castToNativeType whether API Platform should cast your parameter to the nativeType declared
* @param ?callable(mixed): mixed $castFn the closure used to cast your parameter, this gets called only when $castToNativeType is set
*/
public function __construct(
protected ?string $key = null,
Expand Down Expand Up @@ -64,7 +64,7 @@
}

/**
* @return (array<string, mixed>&array{type?: string, default?: string})|null $schema
* @return array{type?: string, default?: string, ...<string, mixed>}|null $schema
*/
public function getSchema(): ?array
{
Expand Down Expand Up @@ -180,9 +180,9 @@
}

/**
* @param array{type?: string} $schema
* @param array{type?: string, default?: string, ...<string, mixed>}|null $schema
*/
public function withSchema(array $schema): static

Check failure on line 185 in src/Metadata/Parameter.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.4)

PHPDoc tag @param for parameter $schema with type array<string, string>|null is not subtype of native type array.
{
$self = clone $this;
$self->schema = $schema;
Expand Down
Loading