Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ extensions:
autowiredAttributeServices: PHPStan\DependencyInjection\AutowiredAttributeServicesExtension
validateServiceTags: PHPStan\DependencyInjection\ValidateServiceTagsExtension
gnsr: PHPStan\DependencyInjection\GnsrExtension
fnsr: PHPStan\DependencyInjection\FnsrExtension

autowiredAttributeServices:
level: null
Expand Down
1 change: 1 addition & 0 deletions issue-bot/src/Console/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private function analyseHash(OutputInterface $output, int $phpVersion, Playgroun
$output->writeln(sprintf('Starting analysis of %s', $hash));

$startTime = microtime(true);
putenv("PHPSTAN_FNSR=1");
exec(implode(' ', $commandArray), $outputLines, $exitCode);
$elapsedTime = microtime(true) - $startTime;
$output->writeln(sprintf('Analysis of %s took %.2f s', $hash, $elapsedTime));
Expand Down
53 changes: 52 additions & 1 deletion src/Analyser/DirectInternalScopeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace PHPStan\Analyser;

use PhpParser\Node;
use PHPStan\Analyser\Fiber\FiberScope;
use PHPStan\DependencyInjection\Type\DynamicReturnTypeExtensionRegistryProvider;
use PHPStan\DependencyInjection\Type\ExpressionTypeResolverExtensionRegistryProvider;
use PHPStan\Node\Printer\ExprPrinter;
Expand Down Expand Up @@ -38,6 +39,7 @@ public function __construct(
private int|array|null $configPhpVersion,
private $nodeCallback,
private ConstantResolver $constantResolver,
private bool $fiber = false,
)
{
}
Expand All @@ -61,7 +63,12 @@ public function create(
bool $nativeTypesPromoted = false,
): MutatingScope
{
return new MutatingScope(
$className = MutatingScope::class;
if ($this->fiber) {
$className = FiberScope::class;
}

return new $className(
$this,
$this->reflectionProvider,
$this->initializerExprTypeResolver,
Expand Down Expand Up @@ -97,4 +104,48 @@ public function create(
);
}

public function toFiberFactory(): InternalScopeFactory
{
return new self(
$this->reflectionProvider,
$this->initializerExprTypeResolver,
$this->dynamicReturnTypeExtensionRegistryProvider,
$this->expressionTypeResolverExtensionRegistryProvider,
$this->exprPrinter,
$this->typeSpecifier,
$this->propertyReflectionFinder,
$this->parser,
$this->nodeScopeResolver,
$this->richerScopeGetTypeHelper,
$this->phpVersion,
$this->attributeReflectionFactory,
$this->configPhpVersion,
$this->nodeCallback,
$this->constantResolver,
true,
);
}

public function toMutatingFactory(): InternalScopeFactory
{
return new self(
$this->reflectionProvider,
$this->initializerExprTypeResolver,
$this->dynamicReturnTypeExtensionRegistryProvider,
$this->expressionTypeResolverExtensionRegistryProvider,
$this->exprPrinter,
$this->typeSpecifier,
$this->propertyReflectionFinder,
$this->parser,
$this->nodeScopeResolver,
$this->richerScopeGetTypeHelper,
$this->phpVersion,
$this->attributeReflectionFactory,
$this->configPhpVersion,
$this->nodeCallback,
$this->constantResolver,
false,
);
}

}
6 changes: 6 additions & 0 deletions src/Analyser/ExpressionResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ final class ExpressionResult
*/
public function __construct(
private MutatingScope $scope,
private MutatingScope $beforeScope,
private bool $hasYield,
private bool $isAlwaysTerminating,
private array $throwPoints,
Expand All @@ -40,6 +41,11 @@ public function getScope(): MutatingScope
return $this->scope;
}

public function getBeforeScope(): MutatingScope
{
return $this->beforeScope;
}

public function hasYield(): bool
{
return $this->hasYield;
Expand Down
40 changes: 40 additions & 0 deletions src/Analyser/ExpressionResultStorage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php declare(strict_types = 1);

namespace PHPStan\Analyser;

use PhpParser\Node\Expr;
use PHPStan\Analyser\Fiber\ExpressionAnalysisRequest;
use SplObjectStorage;

final class ExpressionResultStorage
{

/** @var SplObjectStorage<Expr, ExpressionResult> */
private SplObjectStorage $results;

/** @var array<array{fiber: Fiber<mixed, ExpressionResult|null, null, ExpressionAnalysisRequest|NodeCallbackRequest>, request: ExpressionAnalysisRequest}> */
public array $pendingFibers = [];

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\NodeCallbackRequest as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers has unknown class PHPStan\Analyser\Fiber as its type.

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Proper

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Proper

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Proper

Check failure on line 16 in src/Analyser/ExpressionResultStorage.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Proper

public function __construct()
{
$this->results = new SplObjectStorage();
}

public function duplicate(): self
{
$new = new self();
$new->results->addAll($this->results);
return $new;
}

public function storeResult(Expr $expr, ExpressionResult $result): void
{
$this->results[$expr] = $result;
}

public function findResult(Expr $expr): ?ExpressionResult
{
return $this->results[$expr] ?? null;
}

}
15 changes: 15 additions & 0 deletions src/Analyser/Fiber/ExpressionAnalysisRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php declare(strict_types = 1);

namespace PHPStan\Analyser\Fiber;

use PhpParser\Node\Expr;
use PHPStan\Analyser\MutatingScope;

final class ExpressionAnalysisRequest
{

public function __construct(public readonly Expr $expr, public readonly MutatingScope $scope)
{
}

}
125 changes: 125 additions & 0 deletions src/Analyser/Fiber/FiberNodeScopeResolver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?php declare(strict_types = 1);

namespace PHPStan\Analyser\Fiber;

use Fiber;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PHPStan\Analyser\ExpressionContext;
use PHPStan\Analyser\ExpressionResult;
use PHPStan\Analyser\ExpressionResultStorage;
use PHPStan\Analyser\MutatingScope;
use PHPStan\Analyser\NodeScopeResolver;
use PHPStan\Analyser\NoopNodeCallback;
use PHPStan\DependencyInjection\AutowiredService;
use PHPStan\ShouldNotHappenException;
use function get_class;
use function get_debug_type;
use function sprintf;

#[AutowiredService(as: FiberNodeScopeResolver::class)]
final class FiberNodeScopeResolver extends NodeScopeResolver
{

protected function callNodeCallback(

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::callNodeCallback() has parameter $nodeCallback with no signature specified for callable.

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

M

Check failure on line 24 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

M
callable $nodeCallback,
Node $node,

Check failure on line 26 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Instantiated class Fiber not found.

Check failure on line 26 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Instantiated class Fiber not found.
MutatingScope $scope,
ExpressionResultStorage $storage,
): void

Check failure on line 29 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Call to method start() on an unknown class Fiber.

Check failure on line 29 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Call to method start() on an unknown class Fiber.
{
$fiber = new Fiber(static function () use ($node, $scope, $nodeCallback) {

Check failure on line 31 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Instantiated class Fiber not found.

Check failure on line 31 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Instantiated class Fiber not found.
$nodeCallback($node, $scope->toFiberScope());
});

Check failure on line 33 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Parameter $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has invalid type Fiber.

Check failure on line 33 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Parameter $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has invalid type Fiber.
$request = $fiber->start();

Check failure on line 34 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Call to method start() on an unknown class Fiber.

Check failure on line 34 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Call to method start() on an unknown class Fiber.
$this->runFiberForNodeCallback($storage, $fiber, $request);

Check failure on line 35 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Call to method isTerminated() on an unknown class Fiber.

Check failure on line 35 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Call to method isTerminated() on an unknown class Fiber.
}

private function runFiberForNodeCallback(

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has parameter $fiber with generic class Fiber but does not specify its types: TStart, TResume, TReturn, TSuspend

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

M

Check failure on line 38 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

M
ExpressionResultStorage $storage,

Check failure on line 39 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Call to method resume() on an unknown class Fiber.

Check failure on line 39 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Call to method resume() on an unknown class Fiber.
Fiber $fiber,

Check failure on line 40 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Parameter $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has invalid type Fiber.

Check failure on line 40 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Parameter $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() has invalid type Fiber.
?ExpressionAnalysisRequest $request,
): void
{

Check failure on line 43 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 43 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.
while (!$fiber->isTerminated()) {

Check failure on line 44 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Call to method isTerminated() on an unknown class Fiber.

Check failure on line 44 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Call to method isTerminated() on an unknown class Fiber.
if ($request instanceof ExpressionAnalysisRequest) {
$result = $storage->findResult($request->expr);
if ($result !== null) {
$request = $fiber->resume($result);

Check failure on line 48 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Call to method resume() on an unknown class Fiber.

Check failure on line 48 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Call to method resume() on an unknown class Fiber.
continue;
}

$storage->pendingFibers[] = [

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Property PHPStan\Analyser\ExpressionResultStorage::$pendingFibers (array<array{fiber: PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>) does not accept non-empty-array<array{fiber: Fiber|PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest>, request: PHPStan\Analyser\Fiber\ExpressionAnalysisRequest}>.

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

P

Check failure on line 52 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

P
'fiber' => $fiber,
'request' => $request,
];
return;
}

throw new ShouldNotHappenException(
'Unknown fiber suspension: ' . get_debug_type($request),
);
}

if ($request !== null) {
throw new ShouldNotHappenException(
'Fiber terminated but we did not handle its request ' . get_debug_type($request),
);
}
}

protected function processPendingFibers(ExpressionResultStorage $storage): void
{
foreach ($storage->pendingFibers as $pending) {
$request = $pending['request'];
$result = $storage->findResult($request->expr);

if ($result !== null) {
throw new ShouldNotHappenException('Pending fibers at the end should be about synthetic nodes');
}

$this->processExprNode(
new Node\Stmt\Expression($request->expr),
$request->expr,
$request->scope->toMutatingScope(),
$storage,
new NoopNodeCallback(),
ExpressionContext::createTopLevel(),
);
if ($storage->findResult($request->expr) === null) {
throw new ShouldNotHappenException(sprintf('processExprNode should have stored the result of %s on line %s', get_class($request->expr), $request->expr->getStartLine()));
}
$this->processPendingFibers($storage);

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

protected function processPendingFibersForRequestedExpr(ExpressionResultStorage $storage, Expr $expr, ExpressionResult $result): void
{
$restartLoop = true;

while ($restartLoop) {
$restartLoop = false;

foreach ($storage->pendingFibers as $key => $pending) {

Check failure on line 106 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 106 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.
$request = $pending['request'];
if ($request->expr !== $expr) {
continue;
}

unset($storage->pendingFibers[$key]);
$restartLoop = true;

$fiber = $pending['fiber'];
$request = $fiber->resume($result);

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.

Check failure on line 116 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Call to method resume() on an unknown class PHPStan\Analyser\Fiber.
$this->runFiberForNodeCallback($storage, $fiber, $request);

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

Check failure on line 117 in src/Analyser/Fiber/FiberNodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Parameter #2 $fiber of method PHPStan\Analyser\Fiber\FiberNodeScopeResolver::runFiberForNodeCallback() expects Fiber, PHPStan\Analyser\Fiber<mixed, PHPStan\Analyser\ExpressionResult|null, null, PHPStan\Analyser\Fiber\ExpressionAnalysisRequest|PHPStan\Analyser\NodeCallbackRequest> given.

// Break and restart the loop since the array may have been modified
break;
}
}
}

}
46 changes: 46 additions & 0 deletions src/Analyser/Fiber/FiberScope.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php declare(strict_types = 1);

namespace PHPStan\Analyser\Fiber;

use Fiber;
use PhpParser\Node\Expr;
use PHPStan\Analyser\ExpressionResult;
use PHPStan\Analyser\MutatingScope;
use PHPStan\Type\Type;

final class FiberScope extends MutatingScope
{

/** @api */
public function getType(Expr $node): Type
{
/** @var ExpressionResult $exprResult */
$exprResult = Fiber::suspend(
new ExpressionAnalysisRequest($node, $this),
);

return $exprResult->getBeforeScope()->toMutatingScope()->getType($node);
}

/** @api */
public function getNativeType(Expr $expr): Type
{
/** @var ExpressionResult $exprResult */
$exprResult = Fiber::suspend(
new ExpressionAnalysisRequest($expr, $this),
);

return $exprResult->getBeforeScope()->toMutatingScope()->getNativeType($expr);
}

public function getKeepVoidType(Expr $node): Type
{
/** @var ExpressionResult $exprResult */
$exprResult = Fiber::suspend(
new ExpressionAnalysisRequest($node, $this),
);

return $exprResult->getBeforeScope()->toMutatingScope()->getKeepVoidType($node);
}

}
4 changes: 4 additions & 0 deletions src/Analyser/InternalScopeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ public function create(
bool $nativeTypesPromoted = false,
): MutatingScope;

public function toFiberFactory(): self;

public function toMutatingFactory(): self;

}
19 changes: 18 additions & 1 deletion src/Analyser/LazyInternalScopeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace PHPStan\Analyser;

use PhpParser\Node;
use PHPStan\Analyser\Fiber\FiberScope;
use PHPStan\DependencyInjection\Container;
use PHPStan\DependencyInjection\GenerateFactory;
use PHPStan\DependencyInjection\Type\DynamicReturnTypeExtensionRegistryProvider;
Expand All @@ -29,6 +30,7 @@ final class LazyInternalScopeFactory implements InternalScopeFactory
public function __construct(
private Container $container,
private $nodeCallback,
private bool $fiber = false,
)
{
$this->phpVersion = $this->container->getParameter('phpVersion');
Expand All @@ -53,7 +55,12 @@ public function create(
bool $nativeTypesPromoted = false,
): MutatingScope
{
return new MutatingScope(
$className = MutatingScope::class;
if ($this->fiber) {
$className = FiberScope::class;
}

return new $className(
$this,
$this->container->getByType(ReflectionProvider::class),
$this->container->getByType(InitializerExprTypeResolver::class),
Expand Down Expand Up @@ -89,4 +96,14 @@ public function create(
);
}

public function toFiberFactory(): InternalScopeFactory
{
return new self($this->container, $this->nodeCallback, true);
}

public function toMutatingFactory(): InternalScopeFactory
{
return new self($this->container, $this->nodeCallback, false);
}

}
Loading
Loading