mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-20 23:41:57 +02:00
More reliable way getting first stmt item
The key values are not reliable, this problem is caused by unsetting the values in the stmts array of a node without resetting them. It's not only in this rector file and might need a bigger fix, but this one was bugging me whole day.
This commit is contained in:
parent
6071b994e7
commit
a1754b38ce
@ -90,7 +90,8 @@ PHP
|
||||
return null;
|
||||
}
|
||||
|
||||
$onlyStmt = $this->unwrapExpression($node->stmts[0]);
|
||||
$stmtsValues = array_values($node->stmts);
|
||||
$onlyStmt = $this->unwrapExpression($stmtsValues[0]);
|
||||
|
||||
// are both return?
|
||||
if ($this->isMethodReturnType($node, 'void') && ! $onlyStmt instanceof Return_) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user