Skip to content

Commit 54a9291

Browse files
committed
chore(platform): PHPMNT-177 Upgrade PHPUnit to v11
1 parent 15d5b07 commit 54a9291

10 files changed

Lines changed: 97 additions & 113 deletions

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ default_matrix: &default_matrix
1010
php-version: <<matrix.php-version>>
1111
matrix:
1212
parameters:
13-
php-version: [ "8.1", "8.2", "8.3", "8.4" ]
13+
php-version: [ "8.2", "8.3", "8.4" ]
1414

1515
workflows:
1616
version: 2

.phpstan/baseline.neon

Lines changed: 76 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,169 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Method Bigcommerce\\\\Injector\\\\Adapter\\\\ArrayContainerAdapter\\:\\:__construct\\(\\) has parameter \\$arrayContainer with generic interface ArrayAccess but does not specify its types\\: TKey, TValue$#"
4+
message: '#^Method Bigcommerce\\Injector\\Adapter\\ArrayContainerAdapter\:\:__construct\(\) has parameter \$arrayContainer with generic interface ArrayAccess but does not specify its types\: TKey, TValue$#'
5+
identifier: missingType.generics
56
count: 1
67
path: ../src/Adapter/ArrayContainerAdapter.php
78

89
-
9-
message: "#^Method Bigcommerce\\\\Injector\\\\Adapter\\\\ArrayContainerAdapter\\:\\:__construct\\(\\) has parameter \\$arrayContainer with no value type specified in iterable type array\\.$#"
10+
message: '#^Method Bigcommerce\\Injector\\Adapter\\ArrayContainerAdapter\:\:__construct\(\) has parameter \$arrayContainer with no value type specified in iterable type array\.$#'
11+
identifier: missingType.iterableValue
1012
count: 1
1113
path: ../src/Adapter/ArrayContainerAdapter.php
1214

1315
-
14-
message: "#^Property Bigcommerce\\\\Injector\\\\Adapter\\\\ArrayContainerAdapter\\:\\:\\$arrayContainer type has no value type specified in iterable type array\\.$#"
16+
message: '#^Property Bigcommerce\\Injector\\Adapter\\ArrayContainerAdapter\:\:\$arrayContainer type has no value type specified in iterable type array\.$#'
17+
identifier: missingType.iterableValue
1518
count: 1
1619
path: ../src/Adapter/ArrayContainerAdapter.php
1720

1821
-
19-
message: "#^Property Bigcommerce\\\\Injector\\\\Adapter\\\\ArrayContainerAdapter\\:\\:\\$arrayContainer with generic interface ArrayAccess does not specify its types\\: TKey, TValue$#"
22+
message: '#^Property Bigcommerce\\Injector\\Adapter\\ArrayContainerAdapter\:\:\$arrayContainer with generic interface ArrayAccess does not specify its types\: TKey, TValue$#'
23+
identifier: missingType.generics
2024
count: 1
2125
path: ../src/Adapter/ArrayContainerAdapter.php
2226

2327
-
24-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:buildParameterArray\\(\\) has parameter \\$methodSignature with no value type specified in iterable type array\\.$#"
28+
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
29+
identifier: function.alreadyNarrowedType
2530
count: 1
2631
path: ../src/Injector.php
2732

2833
-
29-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:buildParameterArray\\(\\) has parameter \\$providedParameters with no value type specified in iterable type array\\.$#"
34+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:buildParameterArray\(\) has Bigcommerce\\Injector\\Exception\\InjectorInvocationException in PHPDoc @throws tag but it''s not thrown\.$#'
35+
identifier: throws.unusedType
3036
count: 1
3137
path: ../src/Injector.php
3238

3339
-
34-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:buildParameterArray\\(\\) return type has no value type specified in iterable type array\\.$#"
40+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:buildParameterArray\(\) has InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
41+
identifier: throws.unusedType
3542
count: 1
3643
path: ../src/Injector.php
3744

3845
-
39-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:create\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
46+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:buildParameterArray\(\) has ReflectionException in PHPDoc @throws tag but it''s not thrown\.$#'
47+
identifier: throws.unusedType
4048
count: 1
4149
path: ../src/Injector.php
4250

4351
-
44-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:getAutoCreateWhiteList\\(\\) has invalid return type string\\.$#"
52+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:buildParameterArray\(\) has parameter \$methodSignature with no value type specified in iterable type array\.$#'
53+
identifier: missingType.iterableValue
4554
count: 1
4655
path: ../src/Injector.php
4756

4857
-
49-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:getAutoCreateWhiteList\\(\\) should return array\\<string\\> but returns array\\<string\\>\\.$#"
58+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:buildParameterArray\(\) has parameter \$providedParameters with no value type specified in iterable type array\.$#'
59+
identifier: missingType.iterableValue
5060
count: 1
5161
path: ../src/Injector.php
5262

5363
-
54-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:invoke\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
64+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:buildParameterArray\(\) return type has no value type specified in iterable type array\.$#'
65+
identifier: missingType.iterableValue
5566
count: 1
5667
path: ../src/Injector.php
5768

5869
-
59-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:resolveParameter\\(\\) has parameter \\$parameterData with no value type specified in iterable type array\\.$#"
70+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:create\(\) has parameter \$parameters with no value type specified in iterable type array\.$#'
71+
identifier: missingType.iterableValue
6072
count: 1
6173
path: ../src/Injector.php
6274

6375
-
64-
message: "#^Method Bigcommerce\\\\Injector\\\\Injector\\:\\:resolveParameter\\(\\) has parameter \\$providedParameters with no value type specified in iterable type array\\.$#"
76+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:getAutoCreateWhiteList\(\) has invalid return type string\.$#'
77+
identifier: class.notFound
6578
count: 1
6679
path: ../src/Injector.php
6780

6881
-
69-
message: "#^Method Bigcommerce\\\\Injector\\\\InjectorInterface\\:\\:create\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
82+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:getAutoCreateWhiteList\(\) should return array\<string\> but returns array\<string\>\.$#'
83+
identifier: return.type
84+
count: 1
85+
path: ../src/Injector.php
86+
87+
-
88+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:invoke\(\) has parameter \$parameters with no value type specified in iterable type array\.$#'
89+
identifier: missingType.iterableValue
90+
count: 1
91+
path: ../src/Injector.php
92+
93+
-
94+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:resolveParameter\(\) has parameter \$parameterData with no value type specified in iterable type array\.$#'
95+
identifier: missingType.iterableValue
96+
count: 1
97+
path: ../src/Injector.php
98+
99+
-
100+
message: '#^Method Bigcommerce\\Injector\\Injector\:\:resolveParameter\(\) has parameter \$providedParameters with no value type specified in iterable type array\.$#'
101+
identifier: missingType.iterableValue
102+
count: 1
103+
path: ../src/Injector.php
104+
105+
-
106+
message: '#^Method Bigcommerce\\Injector\\InjectorInterface\:\:create\(\) has parameter \$parameters with no value type specified in iterable type array\.$#'
107+
identifier: missingType.iterableValue
70108
count: 1
71109
path: ../src/InjectorInterface.php
72110

73111
-
74-
message: "#^Method Bigcommerce\\\\Injector\\\\InjectorInterface\\:\\:invoke\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
112+
message: '#^Method Bigcommerce\\Injector\\InjectorInterface\:\:invoke\(\) has parameter \$parameters with no value type specified in iterable type array\.$#'
113+
identifier: missingType.iterableValue
75114
count: 1
76115
path: ../src/InjectorInterface.php
77116

78117
-
79-
message: "#^Method Bigcommerce\\\\Injector\\\\InjectorServiceProvider\\:\\:create\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
118+
message: '#^Method Bigcommerce\\Injector\\InjectorServiceProvider\:\:create\(\) has parameter \$parameters with no value type specified in iterable type array\.$#'
119+
identifier: missingType.iterableValue
120+
count: 1
121+
path: ../src/InjectorServiceProvider.php
122+
123+
-
124+
message: '#^Method Bigcommerce\\Injector\\InjectorServiceProvider\:\:get\(\) has InvalidArgumentException in PHPDoc @throws tag but it''s not thrown\.$#'
125+
identifier: throws.unusedType
80126
count: 1
81127
path: ../src/InjectorServiceProvider.php
82128

83129
-
84-
message: "#^Call to an undefined method ReflectionType\\:\\:getName\\(\\)\\.$#"
130+
message: '#^Call to an undefined method ReflectionType\:\:getName\(\)\.$#'
131+
identifier: method.notFound
85132
count: 1
86133
path: ../src/Reflection/ParameterInspector.php
87134

88135
-
89-
message: "#^Call to an undefined method ReflectionType\\:\\:isBuiltin\\(\\)\\.$#"
136+
message: '#^Call to an undefined method ReflectionType\:\:isBuiltin\(\)\.$#'
137+
identifier: method.notFound
90138
count: 1
91139
path: ../src/Reflection/ParameterInspector.php
92140

93141
-
94-
message: "#^Method Bigcommerce\\\\Injector\\\\Reflection\\\\ParameterInspector\\:\\:getMethodSignature\\(\\) has parameter \\$refClass with generic class ReflectionClass but does not specify its types\\: T$#"
142+
message: '#^Method Bigcommerce\\Injector\\Reflection\\ParameterInspector\:\:getMethodSignature\(\) has parameter \$refClass with generic class ReflectionClass but does not specify its types\: T$#'
143+
identifier: missingType.generics
95144
count: 1
96145
path: ../src/Reflection/ParameterInspector.php
97146

98147
-
99-
message: "#^Method Bigcommerce\\\\Injector\\\\Reflection\\\\ParameterInspector\\:\\:getSignatureByReflectionClass\\(\\) has parameter \\$reflectionClass with generic class ReflectionClass but does not specify its types\\: T$#"
148+
message: '#^Method Bigcommerce\\Injector\\Reflection\\ParameterInspector\:\:getSignatureByReflectionClass\(\) has parameter \$reflectionClass with generic class ReflectionClass but does not specify its types\: T$#'
149+
identifier: missingType.generics
100150
count: 1
101151
path: ../src/Reflection/ParameterInspector.php
102152

103153
-
104-
message: "#^Anonymous function has an unused use \\$className\\.$#"
154+
message: '#^Anonymous function has an unused use \$className\.$#'
155+
identifier: closure.unusedUse
105156
count: 1
106157
path: ../src/ServiceProvider/BindingClosureFactory.php
107158

108159
-
109-
message: "#^Parameter \\#2 \\$initializer of method ProxyManager\\\\Factory\\\\LazyLoadingValueHolderFactory\\:\\:createProxy\\(\\) expects Closure\\(object\\|null\\=, ProxyManager\\\\Proxy\\\\VirtualProxyInterface\\=, string\\=, array\\<string, mixed\\>\\=, Closure\\|null\\=\\)\\: bool, Closure\\(mixed, mixed, mixed, mixed, mixed\\)\\: true given\\.$#"
160+
message: '#^Parameter \#2 \$initializer of method ProxyManager\\Factory\\LazyLoadingValueHolderFactory\:\:createProxy\(\) expects Closure\(object\|null\=, ProxyManager\\Proxy\\VirtualProxyInterface\=, string\=, array\<string, mixed\>\=, Closure\|null\=\)\: bool, Closure\(mixed, mixed, mixed, mixed, mixed\)\: true given\.$#'
161+
identifier: argument.type
110162
count: 1
111163
path: ../src/ServiceProvider/BindingClosureFactory.php
112164

113165
-
114-
message: "#^Unable to resolve the template type RealObjectType in call to method ProxyManager\\\\Factory\\\\LazyLoadingValueHolderFactory\\:\\:createProxy\\(\\)$#"
166+
message: '#^Unable to resolve the template type RealObjectType in call to method ProxyManager\\Factory\\LazyLoadingValueHolderFactory\:\:createProxy\(\)$#'
167+
identifier: argument.templateType
115168
count: 1
116169
path: ../src/ServiceProvider/BindingClosureFactory.php

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"minimum-stability": "dev",
2222
"prefer-stable": true,
2323
"require": {
24-
"php": "^8.1",
24+
"php": "^8.2",
2525
"pimple/pimple": "*",
2626
"friendsofphp/proxy-manager-lts": "^1.0",
2727
"psr/container": "^1.0"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "^10.5",
31-
"phpspec/prophecy-phpunit": "^2.0",
32-
"phpstan/phpstan": "^1.10"
30+
"phpunit/phpunit": "^11.5",
31+
"phpspec/prophecy-phpunit": "^v2.3",
32+
"phpstan/phpstan": "^2.1"
3333
},
3434
"autoload": {
3535
"psr-4": {
@@ -43,7 +43,7 @@
4343
},
4444
"config": {
4545
"platform": {
46-
"php": "8.1"
46+
"php": "8.2"
4747
}
4848
}
4949
}

tests/Adapter/ArrayContainerAdapterTest.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
use Bigcommerce\Injector\Adapter\ArrayContainerAdapter;
55
use Bigcommerce\Injector\Adapter\Exception\ServiceNotFoundException;
6+
use PHPUnit\Framework\Attributes\CoversClass;
67
use PHPUnit\Framework\TestCase;
78

89
/**
910
* Class ArrayContainerAdapterTest
1011
* @package tests\Adapter
11-
* @coversDefaultClass Bigcommerce\Injector\Adapter\ArrayContainerAdapter
1212
*/
13+
#[CoversClass(ArrayContainerAdapter::class)]
1314
class ArrayContainerAdapterTest extends TestCase
1415
{
1516
public function testHappy()
@@ -19,37 +20,25 @@ public function testHappy()
1920
$this->assertEquals(123, $adapter->get("fish"));
2021
}
2122

22-
/**
23-
* @covers ::get
24-
*/
2523
public function testGetMissing()
2624
{
2725
$this->expectException(ServiceNotFoundException::class);
2826
$adapter = new ArrayContainerAdapter([]);
2927
$adapter->get("Missing");
3028
}
3129

32-
/**
33-
* @covers ::get
34-
*/
3530
public function testGetFound()
3631
{
3732
$adapter = new ArrayContainerAdapter(["found" => 123]);
3833
$this->assertEquals(123, $adapter->get("found"));
3934
}
4035

41-
/**
42-
* @covers ::has
43-
*/
4436
public function testHasMissing()
4537
{
4638
$adapter = new ArrayContainerAdapter([]);
4739
$this->assertFalse($adapter->has("Missing"));
4840
}
4941

50-
/**
51-
* @covers ::has
52-
*/
5342
public function testHasFound()
5443
{
5544
$adapter = new ArrayContainerAdapter(["found" => 123]);

tests/Cache/ArrayServiceCacheTest.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,25 @@
22
namespace Tests\Cache;
33

44
use Bigcommerce\Injector\Cache\ArrayServiceCache;
5+
use PHPUnit\Framework\Attributes\CoversClass;
56
use PHPUnit\Framework\TestCase;
67

7-
/**
8-
*
9-
* @coversDefaultClass \Bigcommerce\Injector\Cache\ArrayServiceCache
10-
*/
8+
#[CoversClass(ArrayServiceCache::class)]
119
class ArrayServiceCacheTest extends TestCase
1210
{
13-
/**
14-
* @covers ::get
15-
*/
1611
public function testGet()
1712
{
1813
$cache = new ArrayServiceCache();
1914
$cache->set("test", 123);
2015
$this->assertEquals(123, $cache->get("test"));
2116
}
2217

23-
/**
24-
* @covers ::get
25-
*/
2618
public function testGetMiss()
2719
{
2820
$cache = new ArrayServiceCache();
2921
$this->assertFalse($cache->get("test"));
3022
}
3123

32-
/**
33-
* @covers ::remove
34-
*/
3524
public function testRemoveMiss()
3625
{
3726
$cache = new ArrayServiceCache();

tests/Cache/NoOpServiceCacheTest.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,25 @@
22
namespace Tests\Cache;
33

44
use Bigcommerce\Injector\Cache\NoOpServiceCache;
5+
use PHPUnit\Framework\Attributes\CoversClass;
56
use PHPUnit\Framework\TestCase;
67

7-
/**
8-
*
9-
* @coversDefaultClass Bigcommerce\Injector\Cache\NoOpServiceCache
10-
*/
8+
#[CoversClass(NoOpServiceCache::class)]
119
class NoOpServiceCacheTest extends TestCase
1210
{
13-
/**
14-
* @covers ::get
15-
*/
1611
public function testGet()
1712
{
1813
$cache = new NoOpServiceCache();
1914
$cache->set("test", 123);
2015
$this->assertFalse($cache->get("test"));
2116
}
2217

23-
/**
24-
* @covers ::get
25-
*/
2618
public function testGetMiss()
2719
{
2820
$cache = new NoOpServiceCache();
2921
$this->assertFalse($cache->get("test"));
3022
}
3123

32-
/**
33-
* @covers ::remove
34-
*/
3524
public function testRemoveMiss()
3625
{
3726
$cache = new NoOpServiceCache();

tests/InjectorServiceProviderTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
namespace Tests;
33

44
use Bigcommerce\Injector\Injector;
5+
use Bigcommerce\Injector\InjectorServiceProvider;
56
use Bigcommerce\Injector\ServiceProvider\BindingClosureFactory;
7+
use PHPUnit\Framework\Attributes\CoversClass;
68
use PHPUnit\Framework\TestCase;
79
use Pimple\Container;
810
use Prophecy\Argument;
911
use Prophecy\PhpUnit\ProphecyTrait;
1012
use Prophecy\Prophecy\ObjectProphecy;
1113

12-
/**
13-
*
14-
* @coversDefaultClass Bigcommerce\Injector\InjectorServiceProvider
15-
*/
14+
#[CoversClass(InjectorServiceProvider::class)]
1615
class InjectorServiceProviderTest extends TestCase
1716
{
1817
use ProphecyTrait;

0 commit comments

Comments
 (0)