1
0
mirror of https://github.com/php/pie.git synced 2026-03-23 23:12:17 +01:00

435: add phpstan-phpunit extension

This commit is contained in:
James Titcumb
2026-03-05 08:38:31 +00:00
parent 62bc6521f9
commit 076fddf53e
7 changed files with 68 additions and 27 deletions

View File

@@ -46,6 +46,7 @@
"bnf/phpstan-psr-container": "^1.1",
"doctrine/coding-standard": "^14.0.0",
"phpstan/phpstan": "^2.1.38",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^10.5.63"
},

58
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6392877b0b53e6d18d3d156173dcbba3",
"content-hash": "1138a5a4004fa55c3068062f3a2adc43",
"packages": [
{
"name": "composer/ca-bundle",
@@ -3362,6 +3362,62 @@
],
"time": "2026-01-30T17:12:46+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
"version": "2.0.16",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/6ab598e1bc106e6827fd346ae4a12b4a5d634c32",
"reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
"phpstan/phpstan": "^2.1.32"
},
"conflict": {
"phpunit/phpunit": "<7.0"
},
"require-dev": {
"nikic/php-parser": "^5",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^9.6"
},
"type": "phpstan-extension",
"extra": {
"phpstan": {
"includes": [
"extension.neon",
"rules.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPUnit extensions and rules for PHPStan",
"keywords": [
"static analysis"
],
"support": {
"issues": "https://github.com/phpstan/phpstan-phpunit/issues",
"source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.16"
},
"time": "2026-02-14T09:05:21+00:00"
},
{
"name": "phpstan/phpstan-webmozart-assert",
"version": "2.0.0",

View File

@@ -360,18 +360,6 @@ parameters:
count: 1
path: test/integration/Command/InstallCommandTest.php
-
message: '#^Parameter \#1 \$originalClassName of method PHPUnit\\Framework\\TestCase\:\:createMock\(\) expects class\-string\<object\>, string given\.$#'
identifier: argument.type
count: 1
path: test/integration/Command/InstallExtensionsForProjectCommandTest.php
-
message: '#^Unable to resolve the template type RealInstanceType in call to method PHPUnit\\Framework\\TestCase\:\:createMock\(\)$#'
identifier: argument.templateType
count: 1
path: test/integration/Command/InstallExtensionsForProjectCommandTest.php
-
message: '#^Call to function assert\(\) with true will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType

View File

@@ -2,6 +2,7 @@ includes:
- phpstan-baseline.neon
- vendor/bnf/phpstan-psr-container/extension.neon
- vendor/phpstan/phpstan-webmozart-assert/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
level: 10

View File

@@ -58,17 +58,15 @@ final class InstallExtensionsForProjectCommandTest extends TestCase
$container->method('get')->willReturnCallback(
/** @param class-string $service */
function (string $service): mixed {
switch ($service) {
case QuieterConsoleIO::class:
return new QuieterConsoleIO(
new ArrayInput([]),
new BufferedOutput(),
new MinimalHelperSet(['question' => new QuestionHelper()]),
);
default:
return $this->createMock($service);
}
/** @var class-string $service */
return match ($service) {
QuieterConsoleIO::class => new QuieterConsoleIO(
new ArrayInput([]),
new BufferedOutput(),
new MinimalHelperSet(['question' => new QuestionHelper()]),
),
default => $this->createMock($service),
};
},
);

View File

@@ -43,7 +43,6 @@ final class FetchDependencyStatusesTest extends TestCase
$package,
);
self::assertIsList($deps);
self::assertCount(3, $deps);
self::assertSame('ext-core: == 8.4.17.0 ✅', $deps[0]->asPrettyString());

View File

@@ -400,10 +400,8 @@ final class PhpBinaryPathTest extends TestCase
$php = PhpBinaryPath::fromPhpBinaryPath($phpPath);
self::assertArrayHasKey('Core', $php->extensions());
self::assertNotEmpty($php->extensionPath());
self::assertInstanceOf(OperatingSystem::class, $php->operatingSystem());
self::assertNotEmpty($php->version());
self::assertNotEmpty($php->majorMinorVersion());
self::assertInstanceOf(Architecture::class, $php->machineType());
self::assertGreaterThan(0, $php->phpIntSize());
self::assertNotEmpty($php->phpinfo());
}