Skip to content

Commit 3578a23

Browse files
authored
Update phpstan-phpunit to 2.0.8
1 parent 20f2f27 commit 3578a23

File tree

11 files changed

+39
-26
lines changed

11 files changed

+39
-26
lines changed

build/phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ parameters:
7575
- '#^Dynamic call to static method PHPUnit\\Framework\\\S+\(\)\.$#'
7676
- '#should be contravariant with parameter \$node \(PhpParser\\Node\) of method PHPStan\\Rules\\Rule<PhpParser\\Node>::processNode\(\)$#'
7777
- '#Variable property access on PhpParser\\Node#'
78-
- '#Test::data[a-zA-Z0-9_]+\(\) return type has no value type specified in iterable type#'
7978
-
8079
identifier: shipmonk.deadMethod
8180
message: '#^Unused .*?Factory::create#' # likely used in DIC

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"php-parallel-lint/php-parallel-lint": "^1.2.0",
6161
"phpstan/phpstan-deprecation-rules": "^2.0.2",
6262
"phpstan/phpstan-nette": "^2.0",
63-
"phpstan/phpstan-phpunit": "^2.0.7",
63+
"phpstan/phpstan-phpunit": "^2.0.8",
6464
"phpstan/phpstan-strict-rules": "^2.0",
6565
"phpunit/phpunit": "^11.5.23",
6666
"shipmonk/composer-dependency-analyser": "^1.5",

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Type/ClosureTypeFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(
4646
}
4747

4848
/**
49-
* @param Closure(): mixed $closure
49+
* @param Closure(mixed): mixed $closure
5050
*/
5151
public function fromClosureObject(Closure $closure): ClosureType
5252
{

tests/PHPStan/Command/CommandHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public static function dataParameters(): array
285285
}
286286

287287
/**
288-
* @param array<string, string> $expectedParameters
288+
* @param array<string, mixed> $expectedParameters
289289
* @throws InceptionNotSuccessfulException
290290
*/
291291
#[DataProvider('dataParameters')]

tests/PHPStan/Command/ErrorFormatter/TeamcityErrorFormatterTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public static function dataFormatterOutputProvider(): iterable
1919
0,
2020
0,
2121
'',
22-
'',
2322
];
2423

2524
yield [

tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function testConstUnknown(string $constantName): void
235235
}
236236

237237
/**
238-
* @param class-string[] $expectedIdentifiers
238+
* @param array<string> $expectedIdentifiers
239239
*/
240240
#[DataProvider('dataForIdenifiersByType')]
241241
public function testLocateIdentifiersByType(

tests/PHPStan/Reflection/ClassReflectionPropertyHooksTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\Reflection;
44

5+
use PHPStan\ShouldNotHappenException;
56
use PHPStan\Testing\PHPStanTestCase;
67
use PHPStan\Type\Generic\GenericObjectType;
78
use PHPStan\Type\IntegerType;
@@ -226,6 +227,9 @@ public static function dataPropertyHooks(): iterable
226227
];
227228

228229
$specificFooGenerics = (new GenericObjectType('PropertyHooksTypes\\FooGenerics', [new IntegerType()]))->getClassReflection();
230+
if ($specificFooGenerics === null) {
231+
throw new ShouldNotHappenException();
232+
}
229233

230234
yield [
231235
$specificFooGenerics,
@@ -291,6 +295,9 @@ public static function dataPropertyHooks(): iterable
291295
];
292296

293297
$specificFooGenericsConstructor = (new GenericObjectType('PropertyHooksTypes\\FooGenericsConstructor', [new IntegerType()]))->getClassReflection();
298+
if ($specificFooGenericsConstructor === null) {
299+
throw new ShouldNotHappenException();
300+
}
294301

295302
yield [
296303
$specificFooGenericsConstructor,

tests/PHPStan/Type/ClosureTypeFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static function dataFromClosureObjectParameter(): array
6363
}
6464

6565
/**
66-
* @param Closure(): mixed $closure
66+
* @param Closure(mixed): mixed $closure
6767
*/
6868
#[DataProvider('dataFromClosureObjectParameter')]
6969
public function testFromClosureObjectParameter(Closure $closure, int $index, string $type): void
@@ -75,7 +75,7 @@ public function testFromClosureObjectParameter(Closure $closure, int $index, str
7575
}
7676

7777
/**
78-
* @param Closure(): mixed $closure
78+
* @param Closure(mixed): mixed $closure
7979
*/
8080
private function getClosureType(Closure $closure): ClosureType
8181
{

tests/PHPStan/Type/StringTypeTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ public static function dataIsSuperTypeOf(): array
9696
}
9797

9898
#[DataProvider('dataIsSuperTypeOf')]
99-
public function testIsSuperTypeOf(StringType $type, Type $otherType, TrinaryLogic $expectedResult): void
99+
public function testIsSuperTypeOf(Type $stringType, Type $otherType, TrinaryLogic $expectedResult): void
100100
{
101-
$actualResult = $type->isSuperTypeOf($otherType);
101+
$this->assertInstanceOf(StringType::class, $stringType);
102+
103+
$actualResult = $stringType->isSuperTypeOf($otherType);
102104
$this->assertSame(
103105
$expectedResult->describe(),
104106
$actualResult->describe(),
105-
sprintf('%s -> isSuperTypeOf(%s)', $type->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
107+
sprintf('%s -> isSuperTypeOf(%s)', $stringType->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
106108
);
107109
}
108110

@@ -174,13 +176,15 @@ public static function dataAccepts(): iterable
174176
}
175177

176178
#[DataProvider('dataAccepts')]
177-
public function testAccepts(StringType $type, Type $otherType, TrinaryLogic $expectedResult): void
179+
public function testAccepts(Type $stringType, Type $otherType, TrinaryLogic $expectedResult): void
178180
{
179-
$actualResult = $type->accepts($otherType, true)->result;
181+
$this->assertInstanceOf(StringType::class, $stringType);
182+
183+
$actualResult = $stringType->accepts($otherType, true)->result;
180184
$this->assertSame(
181185
$expectedResult->describe(),
182186
$actualResult->describe(),
183-
sprintf('%s -> accepts(%s)', $type->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
187+
sprintf('%s -> accepts(%s)', $stringType->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
184188
);
185189
}
186190

0 commit comments

Comments
 (0)