Skip to content

Commit

Permalink
docs: add @phpstan-var to stop rector to skip RemoveAlwaysTrueIfCondi…
Browse files Browse the repository at this point in the history
…tionRector

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
  • Loading branch information
kenjis committed Jul 6, 2023
1 parent 49c4772 commit ef1b3b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions system/Router/AutoRouterImproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ final class AutoRouterImproved implements AutoRouterInterface

/**
* An array of params to the controller method.
*
* @phpstan-var list<string>
*/
private array $params = [];

Expand All @@ -72,6 +74,8 @@ final class AutoRouterImproved implements AutoRouterInterface

/**
* The URI segments.
*
* @phpstan-var list<string>
*/
private array $segments = [];

Expand Down Expand Up @@ -279,6 +283,7 @@ public function getRoute(string $uri, string $httpVerb): array
}

// The first item may be a method name.
/** @phpstan-var list<string> $params */
$params = $this->params;

$methodParam = array_shift($params);
Expand Down

0 comments on commit ef1b3b2

Please sign in to comment.