Skip to content

Commit ec3d483

Browse files
committed
drop support for old phpunit & fix github actions
1 parent 200b886 commit ec3d483

10 files changed

+17
-53
lines changed

.github/workflows/phpstan.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- "8.1"
2222
- "8.2"
2323
- "8.3"
24+
- "8.4"
2425

2526
steps:
2627
- name: "Checkout"

.github/workflows/tests-code-coverage.yml

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ jobs:
1818
php-version:
1919
- "7.4"
2020
- "8.0"
21-
- "8.1"
22-
- "8.2"
23-
- "8.3"
2421

2522
steps:
2623
- name: "Checkout"

.github/workflows/tests.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
php-version:
19-
- "7.4"
20-
- "8.0"
2119
- "8.1"
2220
- "8.2"
2321
- "8.3"
22+
- "8.4"
2423

2524
steps:
2625
- name: "Checkout"

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"phpstan/phpstan": "^2.0"
1111
},
1212
"require-dev": {
13-
"phpunit/phpunit": "^7.5 | ^8.5 | 9.4"
13+
"phpunit/phpunit": "^9.0"
1414
},
1515
"autoload": {
1616
"psr-4": {

src/EnumDynamicReturnTypeExtension.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ class EnumDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExt
2323
*
2424
* @var array<string, callable>
2525
*/
26-
private $objectMethods = [];
26+
private array $objectMethods = [];
2727

2828
/**
2929
* Map supported static method to a callable function detecting return type
3030
*
3131
* @var array<string, callable>
3232
*/
33-
private $staticMethods = [];
33+
private array $staticMethods = [];
3434

3535
/**
3636
* Buffer of all types of enumeration values
3737
* @phpstan-var array<class-string<Enum>, Type[]>
3838
*/
39-
private $enumValueTypesBuffer = [];
39+
private array $enumValueTypesBuffer = [];
4040

4141
/**
4242
* Buffer of all types of enumeration ordinals
4343
* @phpstan-var array<class-string<Enum>, Type[]>
4444
*/
45-
private $enumOrdinalTypesBuffer = [];
45+
private array $enumOrdinalTypesBuffer = [];
4646

4747
public function __construct()
4848
{

src/EnumMethodReflection.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,9 @@
1313

1414
class EnumMethodReflection implements MethodReflection
1515
{
16-
/**
17-
* @var ClassReflection
18-
*/
19-
private $classReflection;
20-
21-
/**
22-
* @var string
23-
*/
24-
private $name;
16+
private ClassReflection $classReflection;
17+
18+
private string $name;
2519

2620
public function __construct(ClassReflection $classReflection, string $name)
2721
{

tests/integration/IntegrationTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
namespace MabeEnum\PHPStan\tests\integration;
44

5-
use MabeEnum\Enum;
65
use PHPStan\Testing\LevelsTestCase;
76

87
final class IntegrationTest extends LevelsTestCase
98
{
10-
119
/**
1210
* @return string[][]
1311
*/

tests/unit/EnumDynamicReturnTypeExtensionTest.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99

1010
class EnumDynamicReturnTypeExtensionTest extends PHPStanTestCase
1111
{
12-
/**
13-
* @var EnumDynamicReturnTypeExtension
14-
*/
15-
protected $extension;
12+
protected EnumDynamicReturnTypeExtension $extension;
1613

1714
public function setUp(): void
1815
{

tests/unit/EnumMethodReflectionTest.php

+3-19
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@
77
use MabeEnum\PHPStan\tests\assets\DocCommentEnum;
88
use MabeEnum\PHPStan\tests\assets\VisibilityEnum;
99
use PHPStan\Reflection\ParametersAcceptorSelector;
10+
use PHPStan\Reflection\ReflectionProvider;
1011
use PHPStan\Testing\PHPStanTestCase;
1112
use PHPStan\Type\VerbosityLevel;
1213
use PHPStan\Analyser\Scope;
1314

1415
class EnumMethodReflectionTest extends PHPStanTestCase
1516
{
16-
/**
17-
* @var \PHPStan\Reflection\ReflectionProvider
18-
*/
19-
protected $reflectionProvider;
20-
21-
/**
22-
* @var EnumMethodsClassReflectionExtension
23-
*/
24-
protected $reflectionExtension;
17+
protected ReflectionProvider $reflectionProvider;
18+
protected EnumMethodsClassReflectionExtension $reflectionExtension;
2519

2620
public function setUp(): void
2721
{
@@ -162,14 +156,4 @@ public function testHasSideEffects(): void
162156

163157
$this->assertTrue($methodReflection->hasSideEffects()->no());
164158
}
165-
166-
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void
167-
{
168-
parent::assertMatchesRegularExpression($pattern, $string, $message);
169-
}
170-
171-
public static function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void
172-
{
173-
parent::assertDoesNotMatchRegularExpression($pattern, $string, $message);
174-
}
175159
}

tests/unit/EnumMethodsClassReflectionExtensionTest.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66
use MabeEnumPHPStan\EnumMethodsClassReflectionExtension;
77
use MabeEnum\PHPStan\tests\assets\NotAnEnum;
88
use MabeEnum\PHPStan\tests\assets\VisibilityEnum;
9+
use PHPStan\Reflection\ReflectionProvider;
910
use PHPStan\Testing\PHPStanTestCase;
1011

1112
class EnumMethodsClassReflectionExtensionTest extends PHPStanTestCase
1213
{
13-
/**
14-
* @var \PHPStan\Reflection\ReflectionProvider
15-
*/
16-
protected $reflectionProvider;
17-
18-
/**
19-
* @var EnumMethodsClassReflectionExtension
20-
*/
21-
protected $extension;
14+
protected ReflectionProvider $reflectionProvider;
15+
protected EnumMethodsClassReflectionExtension $extension;
2216

2317
public function setUp(): void
2418
{

0 commit comments

Comments
 (0)