Skip to content

Commit

Permalink
phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Jun 24, 2024
1 parent 740a4c7 commit 8c735cc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ parameters:
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize\(\) invoked with (2|3|4) parameters, 1 required\.#'
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::normalize\(\) invoked with (2|3|4) parameters, 1 required\.#'

- '#Service "behat\.driver\.service_container" is not registered in the container\.#'
# Expected, due to backward compatibility
-
message: "#Call to function method_exists\\(\\) with ApiPlatform\\\\JsonApi\\\\Serializer\\\\ItemNormalizer and 'setCircularReferenc…' will always evaluate to false\\.#"
path: tests/JsonApi/Serializer/ItemNormalizerTest.php
path: src/JsonApi/Tests/Serializer/ItemNormalizerTest.php
- '#Method GraphQL\\Type\\Definition\\WrappingType::getWrappedType\(\) invoked with 1 parameter, 0 required\.#'
- '#Access to an undefined property GraphQL\\Type\\Definition\\NamedType&GraphQL\\Type\\Definition\\Type::\$name\.#'
# See https://github.com/phpstan/phpstan-symfony/issues/27
Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/ApiResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ public function __construct(
$processor = null,
protected ?OptionsInterface $stateOptions = null,
protected array|Parameters|null $parameters = null,
protected array|string|null $rules = null,
protected mixed $rules = null,
protected array $extraProperties = [],
) {
parent::__construct(
Expand Down
8 changes: 4 additions & 4 deletions src/Metadata/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class Metadata
* @param mixed|null $provider
* @param mixed|null $processor
* @param Parameters|array<string, Parameter> $parameters
* @param string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules
* @param callable|string|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules Laravel rules can be a FormRequest class, a callable or an array of rules
*/
public function __construct(
protected ?string $shortName = null,
Expand Down Expand Up @@ -75,7 +75,7 @@ public function __construct(
* @experimental
*/
protected array|Parameters|null $parameters = [],
protected array|string|null $rules = null,
protected mixed $rules = null,
protected array $extraProperties = [],
) {
}
Expand Down Expand Up @@ -576,15 +576,15 @@ public function withStateOptions(?OptionsInterface $stateOptions): static
/**
* @return string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function getRules(): array|string|null
public function getRules(): mixed
{
return $this->rules;
}

/**
* @param string|callable|array<string, \Illuminate\Contracts\Validation\Rule|array|string> $rules
*/
public function withRules(array|string $rules): static
public function withRules(mixed $rules): static
{
$self = clone $this;
$self->rules = $rules;
Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ public function __construct(
protected $processor = null,
protected ?OptionsInterface $stateOptions = null,
protected array|Parameters|null $parameters = [],
protected string|array|null $rules = null,
protected mixed $rules = null,
protected array $extraProperties = [],
) {
parent::__construct(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use ApiPlatform\JsonSchema\SchemaFactoryInterface;
use ApiPlatform\JsonSchema\TypeFactoryInterface;
use ApiPlatform\Metadata\Exception\ExceptionInterface;
use ApiPlatform\Metadata\Exception\FilterValidationException;
use ApiPlatform\Metadata\Exception\InvalidArgumentException;
use ApiPlatform\Metadata\FilterInterface;
use ApiPlatform\Metadata\IdentifiersExtractorInterface;
Expand All @@ -49,6 +48,7 @@
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
use ApiPlatform\OpenApi\Options;
use ApiPlatform\OpenApi\Serializer\OpenApiNormalizer;
use ApiPlatform\ParameterValidator\Exception\ValidationException;
use ApiPlatform\Serializer\Filter\GroupFilter;
use ApiPlatform\Serializer\Filter\PropertyFilter;
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
Expand Down Expand Up @@ -145,7 +145,7 @@ class ApiPlatformExtensionTest extends TestCase
'exception_to_status' => [
ExceptionInterface::class => Response::HTTP_BAD_REQUEST,
InvalidArgumentException::class => Response::HTTP_BAD_REQUEST,
FilterValidationException::class => Response::HTTP_BAD_REQUEST,
ValidationException::class => Response::HTTP_BAD_REQUEST,
OptimisticLockException::class => Response::HTTP_CONFLICT,
],
'show_webby' => true,
Expand Down

0 comments on commit 8c735cc

Please sign in to comment.