Skip to content

Commit 013f2d2

Browse files
committed
add ContaintsStmts interface to mark stmt classes with nested stmts inside
1 parent 0da2d66 commit 013f2d2

17 files changed

+28
-16
lines changed

lib/PhpParser/Internal/PrintableNewAnonClassNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @internal
1717
*/
18-
class PrintableNewAnonClassNode extends Expr {
18+
class PrintableNewAnonClassNode extends Expr implements Node\ContainsStmts {
1919
/** @var Node\AttributeGroup[] PHP attribute groups */
2020
public array $attrGroups;
2121
/** @var int Modifiers */
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpParser\Node;
6+
7+
/**
8+
* @property-read Stmt[] $stmts
9+
*/
10+
interface ContainsStmts {
11+
}

lib/PhpParser/Node/Expr/Closure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use PhpParser\Node\Expr;
88
use PhpParser\Node\FunctionLike;
99

10-
class Closure extends Expr implements FunctionLike {
10+
class Closure extends Expr implements FunctionLike, Node\ContainsStmts {
1111
/** @var bool Whether the closure is static */
1212
public bool $static;
1313
/** @var bool Whether to return by reference */

lib/PhpParser/Node/Stmt/Block.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
namespace PhpParser\Node\Stmt;
44

5+
use PhpParser\Node\ContainsStmts;
56
use PhpParser\Node\Stmt;
67

7-
class Block extends Stmt {
8+
class Block extends Stmt implements ContainsStmts {
89
/** @var Stmt[] Statements */
910
public array $stmts;
1011

lib/PhpParser/Node/Stmt/Case_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use PhpParser\Node;
66

7-
class Case_ extends Node\Stmt {
7+
class Case_ extends Node\Stmt implements Node\ContainsStmts {
88
/** @var null|Node\Expr Condition (null for default) */
99
public ?Node\Expr $cond;
1010
/** @var Node\Stmt[] Statements */

lib/PhpParser/Node/Stmt/Catch_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use PhpParser\Node;
66
use PhpParser\Node\Expr;
77

8-
class Catch_ extends Node\Stmt {
8+
class Catch_ extends Node\Stmt implements Node\ContainsStmts {
99
/** @var Node\Name[] Types of exceptions to catch */
1010
public array $types;
1111
/** @var Expr\Variable|null Variable for exception */

lib/PhpParser/Node/Stmt/ClassLike.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use PhpParser\Node;
66
use PhpParser\Node\PropertyItem;
77

8-
abstract class ClassLike extends Node\Stmt {
8+
abstract class ClassLike extends Node\Stmt implements Node\ContainsStmts {
99
/** @var Node\Identifier|null Name */
1010
public ?Node\Identifier $name;
1111
/** @var Node\Stmt[] Statements */

lib/PhpParser/Node/Stmt/Do_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use PhpParser\Node;
66

7-
class Do_ extends Node\Stmt {
7+
class Do_ extends Node\Stmt implements Node\ContainsStmts {
88
/** @var Node\Stmt[] Statements */
99
public array $stmts;
1010
/** @var Node\Expr Condition */

lib/PhpParser/Node/Stmt/ElseIf_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use PhpParser\Node;
66

7-
class ElseIf_ extends Node\Stmt {
7+
class ElseIf_ extends Node\Stmt implements Node\ContainsStmts {
88
/** @var Node\Expr Condition */
99
public Node\Expr $cond;
1010
/** @var Node\Stmt[] Statements */

lib/PhpParser/Node/Stmt/Else_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use PhpParser\Node;
66

7-
class Else_ extends Node\Stmt {
7+
class Else_ extends Node\Stmt implements Node\ContainsStmts {
88
/** @var Node\Stmt[] Statements */
99
public array $stmts;
1010

0 commit comments

Comments
 (0)