From 16dbc71d99af815c73d7df81c722b01dc15e7da2 Mon Sep 17 00:00:00 2001 From: Sammyjo20 <29132017+Sammyjo20@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:13:11 +0100 Subject: [PATCH 1/3] Fix | PHPStan v1.11 --- phpstan.baseline.neon | 54 ++---------------------------------- src/Traits/Conditionable.php | 16 ++++------- 2 files changed, 8 insertions(+), 62 deletions(-) diff --git a/phpstan.baseline.neon b/phpstan.baseline.neon index 106d14e2..4f83a4ca 100644 --- a/phpstan.baseline.neon +++ b/phpstan.baseline.neon @@ -20,51 +20,6 @@ parameters: count: 1 path: src/Http/Faking/MockClient.php - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Http/Connector.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Http/PendingRequest.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Http/Request.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Repositories/ArrayStore.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Repositories/IntegerStore.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Repositories/Body/ArrayBodyRepository.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Repositories/Body/MultipartBodyRepository.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Repositories/Body/StringBodyRepository.php - - - - message: "#^Parameter \\#2 \\$ of callable callable\\(\\$this, TValue\\)\\: void expects TValue\\, array\\|float\\|int\\|string\\|false\\|null given.$#" - count: 2 - path: src/Repositories/Body/StreamBodyRepository.php - - message: "#^Result of \\&\\& is always false.$#" count: 1 @@ -85,17 +40,12 @@ parameters: count: 1 path: src/Http/Faking/MockClient.php - - - message: "#^Match arm is unreachable because previous comparison is always true.$#" - count: 1 - path: src/Http/Pool.php - - message: "#^Parameter \\#1 \\$object of method ReflectionMethod\\:\\:invoke\\(\\) expects object\\|null, class-string\\|object given.$#" - count: 2 + count: 1 path: src/Traits/Macroable.php - message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, \\(callable\\(\\)\\: mixed\\)\\|object given.$#" - count: 4 + count: 2 path: src/Traits/Macroable.php diff --git a/src/Traits/Conditionable.php b/src/Traits/Conditionable.php index c8172ed9..aa85a81b 100644 --- a/src/Traits/Conditionable.php +++ b/src/Traits/Conditionable.php @@ -11,11 +11,9 @@ trait Conditionable /** * Invoke a callable where a given value returns a truthy value. * - * @template TValue - * - * @param \Closure(): (TValue)|TValue $value - * @param callable($this, TValue): (void) $callback - * @param callable($this, TValue): (void)|null $default + * @param \Closure(): (mixed)|mixed $value + * @param callable($this, mixed): (void) $callback + * @param callable($this, mixed): (void)|null $default * @return $this */ public function when(mixed $value, callable $callback, callable|null $default = null): static @@ -38,11 +36,9 @@ public function when(mixed $value, callable $callback, callable|null $default = /** * Invoke a callable when a given value returns a falsy value. * - * @template TValue - * - * @param \Closure(): (TValue)|TValue $value - * @param callable($this, TValue): (void) $callback - * @param callable($this, TValue): (void)|null $default + * @param \Closure(): (mixed)|mixed $value + * @param callable($this, mixed): (void) $callback + * @param callable($this, mixed): (void)|null $default * @return $this */ public function unless(mixed $value, callable $callback, callable|null $default = null): static From 08e2540de339bc7f709d8b5b9199413496a43f95 Mon Sep 17 00:00:00 2001 From: Sammyjo20 <29132017+Sammyjo20@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:14:56 +0100 Subject: [PATCH 2/3] Force PHPStan version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index dff07bc8..78cc91f2 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "illuminate/collections": "^9.39 || ^10.0", "league/flysystem": "^3.0", "pestphp/pest": "^2.6", - "phpstan/phpstan": "^1.9", + "phpstan/phpstan": "^1.11.4", "saloonphp/xml-wrangler": "^1.1", "spatie/ray": "^1.33", "symfony/dom-crawler": "^6.0 || ^7.0", From d31acdf204e85b8a4adae6aacdc5423bf7106c18 Mon Sep 17 00:00:00 2001 From: Sammyjo20 <29132017+Sammyjo20@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:17:28 +0100 Subject: [PATCH 3/3] Weird issues --- phpstan.baseline.neon | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpstan.baseline.neon b/phpstan.baseline.neon index 4f83a4ca..23ea18cc 100644 --- a/phpstan.baseline.neon +++ b/phpstan.baseline.neon @@ -42,10 +42,15 @@ parameters: - message: "#^Parameter \\#1 \\$object of method ReflectionMethod\\:\\:invoke\\(\\) expects object\\|null, class-string\\|object given.$#" - count: 1 + count: 2 path: src/Traits/Macroable.php - message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, \\(callable\\(\\)\\: mixed\\)\\|object given.$#" - count: 2 + count: 4 path: src/Traits/Macroable.php + + - + message: "#^Match arm is unreachable because previous comparison is always true.$#" + count: 1 + path: src/Http/Pool.php