From ef1b3b230a0b8bfaefbd0e0c0f3ac1d9c59c106d Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 4 Jul 2023 08:35:19 +0900 Subject: [PATCH] docs: add @phpstan-var to stop rector to skip RemoveAlwaysTrueIfConditionRector Without this doc type, Rector will refactor the following: 1) system/Router/AutoRouterImproved.php:294 ---------- begin diff ---------- @@ @@ // Update the positions. $this->methodPos = $this->paramPos; - if ($params === []) { - $this->paramPos = null; - } + $this->paramPos = null; if ($this->paramPos !== null) { $this->paramPos++; } ----------- end diff ----------- Applied rules: * RemoveAlwaysTrueIfConditionRector --- system/Router/AutoRouterImproved.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/Router/AutoRouterImproved.php b/system/Router/AutoRouterImproved.php index b8c1e9d35099..a186fd33ef55 100644 --- a/system/Router/AutoRouterImproved.php +++ b/system/Router/AutoRouterImproved.php @@ -46,6 +46,8 @@ final class AutoRouterImproved implements AutoRouterInterface /** * An array of params to the controller method. + * + * @phpstan-var list */ private array $params = []; @@ -72,6 +74,8 @@ final class AutoRouterImproved implements AutoRouterInterface /** * The URI segments. + * + * @phpstan-var list */ private array $segments = []; @@ -279,6 +283,7 @@ public function getRoute(string $uri, string $httpVerb): array } // The first item may be a method name. + /** @phpstan-var list $params */ $params = $this->params; $methodParam = array_shift($params);