diff --git a/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php b/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php index fe2214042b0..4566f3e6b95 100644 --- a/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php +++ b/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php @@ -52,16 +52,21 @@ CODE_SAMPLE if ($newStmts === []) { return null; } - $rootStmt = \current($newStmts); + // use 0 index to avoid infinite loop + $rootStmt = $newStmts[0] ?? null; $stmt = $rootStmt; if ($rootStmt instanceof FileWithoutNamespace) { - $currentStmt = \current($rootStmt->stmts); + // use 0 index to avoid infinite loop + $currentStmt = $rootStmt->stmts[0] ?? null; if (!$currentStmt instanceof Stmt) { return null; } $nodes = $rootStmt->stmts; $stmt = $currentStmt; } + if (!$stmt instanceof Stmt) { + return null; + } if ($this->shouldSkip($stmt)) { return null; } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index b89b6550c7e..f5a47aa4144 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '62254600d1d3f036ae3e9c502613c4ac96a8b71b'; + public const PACKAGE_VERSION = '13bafcba1524782c349fe6523ce9c18d0f765452'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-03-07 23:31:56'; + public const RELEASE_DATE = '2024-03-08 04:07:33'; /** * @var int */