File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -394,10 +394,14 @@ public function processStmtNodes(
394
394
if ($ stmtCount === 0 && $ shouldCheckLastStatement ) {
395
395
/** @var Node\Stmt\Function_|Node\Stmt\ClassMethod|Expr\Closure $parentNode */
396
396
$ parentNode = $ parentNode ;
397
+ $ returnTypeNode = $ parentNode ->returnType ;
398
+ if ($ parentNode instanceof Expr \Closure) {
399
+ $ parentNode = new Node \Stmt \Expression ($ parentNode , $ parentNode ->getAttributes ());
400
+ }
397
401
$ nodeCallback (new ExecutionEndNode (
398
402
$ parentNode ,
399
403
$ statementResult ,
400
- $ parentNode -> returnType !== null ,
404
+ $ returnTypeNode !== null ,
401
405
), $ scope );
402
406
}
403
407
Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ class ExecutionEndNode extends NodeAbstract implements VirtualNode
11
11
{
12
12
13
13
public function __construct (
14
- private Node $ node ,
14
+ private Node \ Stmt $ node ,
15
15
private StatementResult $ statementResult ,
16
16
private bool $ hasNativeReturnTypehint ,
17
17
)
18
18
{
19
19
parent ::__construct ($ node ->getAttributes ());
20
20
}
21
21
22
- public function getNode (): Node
22
+ public function getNode (): Node \ Stmt
23
23
{
24
24
return $ this ->node ;
25
25
}
You can’t perform that action at this time.
0 commit comments