Skip to content

Commit 1d141d5

Browse files
[PhpParser] Add Stmt\Block to NodeGroup::STMTS_AWARE (#7689)
* [PhpParser] Add Stmt\Block to NodeGroup::STMTS_AWARE * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com>
1 parent d8e4eee commit 1d141d5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ parameters:
1010

1111
# see https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases
1212
typeAliases:
13-
StmtsAware: \PhpParser\Node\Expr\Closure | \PhpParser\Node\Stmt\Case_ | \PhpParser\Node\Stmt\Catch_ | \PhpParser\Node\Stmt\ClassMethod | \PhpParser\Node\Stmt\Do_ | \PhpParser\Node\Stmt\Else_ | \PhpParser\Node\Stmt\ElseIf_ | \PhpParser\Node\Stmt\Finally_ | \PhpParser\Node\Stmt\For_ | \PhpParser\Node\Stmt\Foreach_ | \PhpParser\Node\Stmt\Function_ | \PhpParser\Node\Stmt\If_ | \PhpParser\Node\Stmt\Namespace_ | \PhpParser\Node\Stmt\TryCatch | \PhpParser\Node\Stmt\While_
13+
StmtsAware: \PhpParser\Node\Stmt\Block | \PhpParser\Node\Expr\Closure | \PhpParser\Node\Stmt\Case_ | \PhpParser\Node\Stmt\Catch_ | \PhpParser\Node\Stmt\ClassMethod | \PhpParser\Node\Stmt\Do_ | \PhpParser\Node\Stmt\Else_ | \PhpParser\Node\Stmt\ElseIf_ | \PhpParser\Node\Stmt\Finally_ | \PhpParser\Node\Stmt\For_ | \PhpParser\Node\Stmt\Foreach_ | \PhpParser\Node\Stmt\Function_ | \PhpParser\Node\Stmt\If_ | \PhpParser\Node\Stmt\Namespace_ | \PhpParser\Node\Stmt\TryCatch | \PhpParser\Node\Stmt\While_ | \Rector\PhpParser\Node\CustomNode\FileWithoutNamespace
1414

1515
# requires exact closure types
1616
checkMissingCallableSignature: true

src/Application/NodeAttributeReIndexer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use PhpParser\Node\Expr\NullsafeMethodCall;
1414
use PhpParser\Node\Expr\StaticCall;
1515
use PhpParser\Node\FunctionLike;
16-
use PhpParser\Node\Stmt\Block;
1716
use PhpParser\Node\Stmt\ClassLike;
1817
use PhpParser\Node\Stmt\ClassMethod;
1918
use PhpParser\Node\Stmt\Declare_;
@@ -69,7 +68,7 @@ private static function reIndexStmtsKeys(Node $node): ?Node
6968
{
7069
if (! NodeGroup::isStmtAwareNode(
7170
$node
72-
) && ! $node instanceof ClassLike && ! $node instanceof Declare_ && ! $node instanceof Block) {
71+
) && ! $node instanceof ClassLike && ! $node instanceof Declare_) {
7372
return null;
7473
}
7574

src/PhpParser/Enum/NodeGroup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PhpParser\Node;
88
use PhpParser\Node\Expr\Closure;
9+
use PhpParser\Node\Stmt\Block;
910
use PhpParser\Node\Stmt\Case_;
1011
use PhpParser\Node\Stmt\Catch_;
1112
use PhpParser\Node\Stmt\Class_;
@@ -38,6 +39,7 @@ final class NodeGroup
3839
* @var array<class-string<Node>>
3940
*/
4041
public const STMTS_AWARE = [
42+
Block::class,
4143
Closure::class,
4244
Case_::class,
4345
Catch_::class,

0 commit comments

Comments
 (0)