mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-20 23:41:57 +02:00
Merge pull request #2618 from Jaapze/master
More reliable way getting first stmt item
This commit is contained in:
commit
8eafe7a6ab
@ -86,11 +86,12 @@ PHP
|
||||
return null;
|
||||
}
|
||||
|
||||
if (count((array) $node->stmts) !== 1) {
|
||||
if ($node->stmts === null || count((array) $node->stmts) !== 1) {
|
||||
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