Skip to content

Commit e972aff

Browse files
committed
change getStmts() method in ClassMethod to return Stmt[]
1 parent 496780a commit e972aff

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/PhpParser/Node/Stmt/ClassMethod.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use PhpParser\Node;
77
use PhpParser\Node\FunctionLike;
88

9-
class ClassMethod extends Node\Stmt implements FunctionLike {
9+
class ClassMethod extends Node\Stmt implements FunctionLike, Node\ContainsStmts {
1010
/** @var int Flags */
1111
public int $flags;
1212
/** @var bool Whether to return by reference */
@@ -90,7 +90,14 @@ public function getReturnType() {
9090
return $this->returnType;
9191
}
9292

93-
public function getStmts(): ?array {
93+
/**
94+
* @return Node\Stmt[]
95+
*/
96+
public function getStmts(): array {
97+
if ($this->stmts === null) {
98+
return [];
99+
}
100+
94101
return $this->stmts;
95102
}
96103

0 commit comments

Comments
 (0)