Skip to content

Commit 2eb1159

Browse files
committed
FNSR
1 parent 080d492 commit 2eb1159

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/Analyser/Fiber/FiberNodeScopeResolver.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PHPStan\Analyser\ExpressionResultStorage;
1111
use PHPStan\Analyser\MutatingScope;
1212
use PHPStan\Analyser\NodeScopeResolver;
13+
use PHPStan\Analyser\NoopNodeCallback;
1314
use PHPStan\DependencyInjection\AutowiredService;
1415
use PHPStan\ShouldNotHappenException;
1516
use function get_debug_type;
@@ -65,7 +66,7 @@ private function runFiberForNodeCallback(
6566
}
6667
}
6768

68-
protected function processPendingFibers(ExpressionResultStorage $storage, callable $nodeCallback): void
69+
protected function processPendingFibers(ExpressionResultStorage $storage): void
6970
{
7071
foreach ($storage->pendingFibers as $pending) {
7172
$request = $pending['request'];
@@ -78,12 +79,12 @@ protected function processPendingFibers(ExpressionResultStorage $storage, callab
7879
$this->processExprNode(
7980
new Node\Stmt\Expression($request->expr),
8081
$request->expr,
81-
$request->scope,
82+
$request->scope->toMutatingScope(),
8283
$storage,
83-
$nodeCallback,
84+
new NoopNodeCallback(),
8485
ExpressionContext::createTopLevel(),
8586
);
86-
$this->processPendingFibers($storage, $nodeCallback);
87+
$this->processPendingFibers($storage);
8788

8889
// Break and restart the loop since the array may have been modified
8990
return;

src/Analyser/MutatingScope.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use PhpParser\Node\Stmt\ClassMethod;
2828
use PhpParser\Node\Stmt\Function_;
2929
use PhpParser\NodeFinder;
30+
use PHPStan\Analyser\Fiber\FiberScope;
3031
use PHPStan\Node\ExecutionEndNode;
3132
use PHPStan\Node\Expr\AlwaysRememberedExpr;
3233
use PHPStan\Node\Expr\ExistingArrayDimFetch;
@@ -247,6 +248,10 @@ public function __construct(
247248

248249
public function toFiberScope(): self
249250
{
251+
if (static::class === FiberScope::class) {
252+
return $this;
253+
}
254+
250255
return $this->scopeFactory->toFiberFactory()->create(
251256
$this->context,
252257
$this->isDeclareStrictTypes(),
@@ -267,7 +272,7 @@ public function toFiberScope(): self
267272
);
268273
}
269274

270-
protected function toMutatingScope(): self
275+
public function toMutatingScope(): self
271276
{
272277
if (static::class === self::class) {
273278
return $this;

0 commit comments

Comments
 (0)