Skip to content

Commit

Permalink
Merge pull request #28 from tomloprod/fix/reworks-phpstan-1-11-3
Browse files Browse the repository at this point in the history
Reworks for PHPStan 1.11.3
  • Loading branch information
nunomaduro authored Jun 3, 2024
2 parents 7ba7d70 + 9008e47 commit 622532e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"phpstan/phpstan": "^1.11.0",
"phpstan/phpstan": "^1.11.3",
"tomasvotruba/type-coverage": "^0.2.8",
"pestphp/pest-plugin": "^2.1.1"
},
Expand Down
2 changes: 2 additions & 0 deletions src/PHPStanAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PHPStan\DependencyInjection\Container;
use PHPStan\DependencyInjection\Reflection\ClassReflectionExtensionRegistryProvider;
use PHPStan\DependencyInjection\Type\DynamicThrowTypeExtensionProvider;
use PHPStan\DependencyInjection\Type\ParameterClosureTypeExtensionProvider;
use PHPStan\File\FileHelper;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDoc\PhpDocInheritanceResolver;
Expand Down Expand Up @@ -64,6 +65,7 @@ public static function make(Container $container, array $rules, array $collector
$typeSpecifier, // @phpstan-ignore-line
$container->getByType(DynamicThrowTypeExtensionProvider::class),
$container->getByType(ReadWritePropertiesExtensionProvider::class),
$container->getByType(ParameterClosureTypeExtensionProvider::class),
$scopeFactory,
false,
true,
Expand Down
35 changes: 18 additions & 17 deletions tests/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,31 @@ public function exit(int $code): never
expect(fn () => $plugin->handleArguments(['--type-coverage', '--type-coverage-json=test.json']))->toThrow(Exception::class, 0);

expect(__DIR__.'/../test.json')->toBeReadableFile();

expect(file_get_contents(__DIR__.'/../test.json'))->json()->toMatchArray([
'format' => 'pest',
'coverage-min' => 0,
'result' => [
[
'file' => 'src/PHPStanAnalyser.php',
'file' => 'src/TestCaseForTypeCoverage.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'src/TestCaseForTypeCoverage.php',
'file' => 'src/Analyser.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'src/Contracts/Logger.php',
'file' => 'src/PHPStanAnalyser.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'src/Plugin.php',
'file' => 'src/Support/ConfigurationSourceDetector.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
Expand All @@ -71,46 +72,46 @@ public function exit(int $code): never
'percentage' => 100,
],
[
'file' => 'src/Error.php',
'file' => 'src/Logging/JsonLogger.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'src/Support/ConfigurationSourceDetector.php',
'file' => 'src/Logging/NullLogger.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'src/Analyser.php',
'file' => 'src/Contracts/Logger.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'src/Logging/NullLogger.php',
'file' => 'src/Error.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'src/Logging/JsonLogger.php',
'file' => 'src/Plugin.php',
'uncoveredLines' => [],
'uncoveredLinesIgnored' => [],
'percentage' => 100,
],
[
'file' => 'tests/Fixtures/Properties.php',
'uncoveredLines' => ['pr12'],
'file' => 'tests/Fixtures/Parameters.php',
'uncoveredLines' => ['pa12'],
'uncoveredLinesIgnored' => [],
'percentage' => 83,
],
[
'file' => 'tests/Fixtures/All.php',
'uncoveredLines' => ['pr12', 'pa14', 'pa14', 'rt14'],
'file' => 'tests/Fixtures/Properties.php',
'uncoveredLines' => ['pr12'],
'uncoveredLinesIgnored' => [],
'percentage' => 0,
'percentage' => 83,
],
[
'file' => 'tests/Fixtures/ReturnType.php',
Expand All @@ -119,10 +120,10 @@ public function exit(int $code): never
'percentage' => 67,
],
[
'file' => 'tests/Fixtures/Parameters.php',
'uncoveredLines' => ['pa12'],
'file' => 'tests/Fixtures/All.php',
'uncoveredLines' => ['pr12', 'pa14', 'pa14', 'rt14'],
'uncoveredLinesIgnored' => [],
'percentage' => 83,
'percentage' => 0,
],
],
'total' => 88.07,
Expand Down

0 comments on commit 622532e

Please sign in to comment.