Skip to content

Commit

Permalink
Merge pull request #35 from MrPunyapal/3.x
Browse files Browse the repository at this point in the history
Fix: Argument #20 ($polluteScopeWithBlock) must be of type bool error
  • Loading branch information
owenvoke authored Dec 27, 2024
2 parents e6ec9cc + 9906d9d commit 254aa8c
Showing 1 changed file with 62 additions and 30 deletions.
92 changes: 62 additions & 30 deletions src/PHPStanAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Pest\TypeCoverage;

use Composer\InstalledVersions;
use PhpParser\Node;
use PHPStan\Analyser\Analyser;
use PHPStan\Analyser\FileAnalyser;
Expand Down Expand Up @@ -51,36 +52,67 @@ public static function make(Container $container, array $rules, array $collector

$scopeFactory = TestCaseForTypeCoverage::createScopeFactory($reflectionProvider, $typeSpecifier); // @phpstan-ignore-line

$nodeScopeResolver = new NodeScopeResolver(
$reflectionProvider,
$container->getByType(InitializerExprTypeResolver::class),
$container->getService('betterReflectionReflector'), // @phpstan-ignore-line
$container->getByType(ClassReflectionExtensionRegistryProvider::class),
$container->getByType(ParameterOutTypeExtensionProvider::class),
$container->getService('defaultAnalysisParser'), // @phpstan-ignore-line
$container->getByType(FileTypeMapper::class),
$container->getByType(StubPhpDocProvider::class),
$container->getByType(PhpVersion::class),
$container->getByType(SignatureMapProvider::class),
$container->getByType(PhpDocInheritanceResolver::class),
$container->getByType(FileHelper::class),
$typeSpecifier, // @phpstan-ignore-line
$container->getByType(DynamicThrowTypeExtensionProvider::class),
$container->getByType(ReadWritePropertiesExtensionProvider::class),
$container->getByType(ParameterClosureTypeExtensionProvider::class),
$scopeFactory,
false,
true,
[],
[],
[],
true,
true,
false,
true,
false,
false,
);
$version = InstalledVersions::getPrettyVersion('phpstan/phpstan');
if (mb_strpos($version, '2.') === 0) {

Check failure on line 56 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Parameter #1 $haystack of function mb_strpos expects string, string|null given.

Check failure on line 56 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-stable)

Parameter #1 $haystack of function mb_strpos expects string, string|null given.
$nodeScopeResolver = new NodeScopeResolver(

Check failure on line 57 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Class PHPStan\Analyser\NodeScopeResolver constructor invoked with 25 parameters, 28 required.

Check failure on line 57 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-stable)

Class PHPStan\Analyser\NodeScopeResolver constructor invoked with 25 parameters, 28 required.
$reflectionProvider,
$container->getByType(InitializerExprTypeResolver::class),
$container->getService('betterReflectionReflector'), // @phpstan-ignore-line
$container->getByType(ClassReflectionExtensionRegistryProvider::class),
$container->getByType(ParameterOutTypeExtensionProvider::class),
$container->getService('defaultAnalysisParser'), // @phpstan-ignore-line
$container->getByType(FileTypeMapper::class),
$container->getByType(StubPhpDocProvider::class),
$container->getByType(PhpVersion::class),
$container->getByType(SignatureMapProvider::class),
$container->getByType(PhpDocInheritanceResolver::class),
$container->getByType(FileHelper::class),
$typeSpecifier, // @phpstan-ignore-line
$container->getByType(DynamicThrowTypeExtensionProvider::class),
$container->getByType(ReadWritePropertiesExtensionProvider::class),
$container->getByType(ParameterClosureTypeExtensionProvider::class),
$scopeFactory,
false,
true,
true,

Check failure on line 77 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Parameter #20 $earlyTerminatingMethodCalls of class PHPStan\Analyser\NodeScopeResolver constructor expects array<array<string>>, true given.

Check failure on line 77 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-stable)

Parameter #20 $earlyTerminatingMethodCalls of class PHPStan\Analyser\NodeScopeResolver constructor expects array<array<string>>, true given.
[],
[],
[],

Check failure on line 80 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-lowest)

Parameter #23 $implicitThrows of class PHPStan\Analyser\NodeScopeResolver constructor expects bool, array given.

Check failure on line 80 in src/PHPStanAnalyser.php

View workflow job for this annotation

GitHub Actions / Static Tests (prefer-stable)

Parameter #23 $implicitThrows of class PHPStan\Analyser\NodeScopeResolver constructor expects bool, array given.
true,
true,
);
} else {
$nodeScopeResolver = new NodeScopeResolver(
$reflectionProvider,
$container->getByType(InitializerExprTypeResolver::class),
$container->getService('betterReflectionReflector'), // @phpstan-ignore-line
$container->getByType(ClassReflectionExtensionRegistryProvider::class),
$container->getByType(ParameterOutTypeExtensionProvider::class),
$container->getService('defaultAnalysisParser'), // @phpstan-ignore-line
$container->getByType(FileTypeMapper::class),
$container->getByType(StubPhpDocProvider::class),
$container->getByType(PhpVersion::class),
$container->getByType(SignatureMapProvider::class),
$container->getByType(PhpDocInheritanceResolver::class),
$container->getByType(FileHelper::class),
$typeSpecifier, // @phpstan-ignore-line
$container->getByType(DynamicThrowTypeExtensionProvider::class),
$container->getByType(ReadWritePropertiesExtensionProvider::class),
$container->getByType(ParameterClosureTypeExtensionProvider::class),
$scopeFactory,
false,
true,
[],
[],
[],
true,
true,
false,
true,
false,
false,
);
}

$fileAnalyser = new FileAnalyser(
$scopeFactory,
Expand Down

0 comments on commit 254aa8c

Please sign in to comment.