From 065087bf2cccaa77bb0420459c738688e3206add Mon Sep 17 00:00:00 2001 From: Rodolfo Berrios <20590102+rodber@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:15:05 -0300 Subject: [PATCH] bump phpstan --- composer.json | 2 +- src/Arguments.php | 4 +--- src/BoolParameter.php | 2 +- src/ReflectionParameterTyped.php | 1 - src/Type.php | 2 +- src/functions.php | 2 +- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index cace486..c1ced87 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "chevere/regex": "^1.0.1" }, "require-dev": { - "phpstan/phpstan": "^1.9", + "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^9.5", "symplify/easy-coding-standard": "^11.1" }, diff --git a/src/Arguments.php b/src/Arguments.php index 57b0a52..d5ee165 100644 --- a/src/Arguments.php +++ b/src/Arguments.php @@ -99,9 +99,7 @@ public function toArray(): array public function toArrayFill(mixed $fill): array { $filler = array_fill_keys($this->null, $fill); - /** - * @infection-ignore-all (false positive) - */ + return array_merge($filler, $this->arguments); } diff --git a/src/BoolParameter.php b/src/BoolParameter.php index e1c99d0..3e4dc0e 100644 --- a/src/BoolParameter.php +++ b/src/BoolParameter.php @@ -23,7 +23,7 @@ final class BoolParameter implements BoolParameterInterface use ParameterTrait; use SchemaTrait; - private ?bool $default; + private bool $default; public function __invoke(bool $value): bool { diff --git a/src/ReflectionParameterTyped.php b/src/ReflectionParameterTyped.php index 6b116ac..881b42f 100644 --- a/src/ReflectionParameterTyped.php +++ b/src/ReflectionParameterTyped.php @@ -57,7 +57,6 @@ public function __construct( $parameter = $attribute->parameter(); } if ($this->reflection->isDefaultValueAvailable() - && method_exists($parameter, 'withDefault') && $this->reflection->getDefaultValue() !== null ) { /** @var ParameterInterface $parameter */ diff --git a/src/Type.php b/src/Type.php index 63a8115..3cf81d6 100644 --- a/src/Type.php +++ b/src/Type.php @@ -48,7 +48,7 @@ public function __construct( public function validator(): callable { /** @var callable */ - return $this->validator; + return $this->validator; // @phpstan-ignore-line } public function primitive(): string diff --git a/src/functions.php b/src/functions.php index 59ff4db..2f82228 100644 --- a/src/functions.php +++ b/src/functions.php @@ -373,7 +373,7 @@ function validated(callable $callable, mixed ...$args): mixed try { /** @var callable $return */ - $return($result); + $return($result); // @phpstan-ignore-line } catch (Throwable $e) { // @infection-ignore-all throw new ReturnException(