Skip to content

Commit 922b218

Browse files
Ocramiuskersysgediminas
authored andcommitted
Add PHP 8.3 support
- Adds PHP 8.3 support - Drops PHP 8.0 support Signed-off-by: Gediminas Kersys <kersysgediminas@gmail.com>
2 parents cf8231e + ff79eb8 commit 922b218

23 files changed

+1225
-1158
lines changed

composer.json

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
"sort-packages": true,
2121
"allow-plugins": {
2222
"dealerdirect/phpcodesniffer-composer-installer": true
23+
},
24+
"platform": {
25+
"php": "8.1.99"
2326
}
2427
},
2528
"extra": {
@@ -28,25 +31,25 @@
2831
}
2932
},
3033
"require": {
31-
"php": "^7.3 || ~8.0.0 || ~8.1.0",
32-
"laminas-api-tools/api-tools-api-problem": "^1.4.0",
33-
"laminas-api-tools/api-tools-content-negotiation": "^1.5.0",
34-
"laminas-api-tools/api-tools-oauth2": "^1.7",
35-
"laminas/laminas-authentication": "^2.5.3",
36-
"laminas/laminas-eventmanager": "^3.2",
37-
"laminas/laminas-http": "^2.5.4",
38-
"laminas/laminas-mvc": "^2.7.9 || ^3.0.2",
39-
"laminas/laminas-permissions-acl": "^2.6",
40-
"laminas/laminas-permissions-rbac": "^2.6.0 || ^3.0",
41-
"laminas/laminas-servicemanager": "^2.7.6 || ^3.1",
42-
"laminas/laminas-stdlib": "^2.7.8 || ^3.0.1",
34+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
35+
"laminas-api-tools/api-tools-api-problem": "^1.5.0",
36+
"laminas-api-tools/api-tools-content-negotiation": "^1.8.0",
37+
"laminas-api-tools/api-tools-oauth2": "^1.9",
38+
"laminas/laminas-authentication": "^2.9.0",
39+
"laminas/laminas-eventmanager": "^3.4",
40+
"laminas/laminas-http": "^2.15.1",
41+
"laminas/laminas-mvc": "^2.7.9 || ^3.3.0",
42+
"laminas/laminas-permissions-acl": "^2.9",
43+
"laminas/laminas-permissions-rbac": "^2.6.0 || ^3.2",
44+
"laminas/laminas-servicemanager": "^3.11.1",
45+
"laminas/laminas-stdlib": "^2.7.8 || ^3.6.1",
4346
"laminas/laminas-zendframework-bridge": "^1.1"
4447
},
4548
"require-dev": {
4649
"laminas/laminas-coding-standard": "~2.3.0",
47-
"laminas/laminas-session": "^2.8.5",
48-
"phpspec/prophecy-phpunit": "^2.0",
49-
"phpunit/phpunit": "^9.3",
50+
"laminas/laminas-session": "^2.12.0",
51+
"phpspec/prophecy-phpunit": "^2.0.1",
52+
"phpunit/phpunit": "^9.5.10",
5053
"psalm/plugin-phpunit": "^0.16.0",
5154
"vimeo/psalm": "^4.7"
5255
},

composer.lock

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

phpunit.xml.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="./vendor/autoload.php"
5+
colors="true"
6+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd">
37
<coverage processUncoveredFiles="true">
48
<include>
59
<directory suffix=".php">src</directory>

psalm-baseline.xml

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.7.3@38c452ae584467e939d55377aaf83b5a26f19dd1">
2+
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69">
33
<file src="config/module.config.php">
4+
<MixedArrayOffset occurrences="1"/>
45
<UndefinedClass occurrences="1">
56
<code>Authentication\AuthHttpAdapter</code>
67
</UndefinedClass>
@@ -27,7 +28,10 @@
2728
<DeprecatedMethod occurrences="1">
2829
<code>attachHttpAdapter</code>
2930
</DeprecatedMethod>
30-
<DeprecatedProperty occurrences="2">
31+
<DeprecatedProperty occurrences="5">
32+
<code>$this-&gt;httpAdapter</code>
33+
<code>$this-&gt;httpAdapter</code>
34+
<code>$this-&gt;httpAdapter</code>
3135
<code>$this-&gt;httpAdapter</code>
3236
<code>$this-&gt;httpAdapter</code>
3337
</DeprecatedProperty>
@@ -53,15 +57,18 @@
5357
</PossiblyNullReference>
5458
</file>
5559
<file src="src/Authentication/HttpAdapter.php">
56-
<MixedArgument occurrences="2">
60+
<MixedArgument occurrences="1">
5761
<code>$name</code>
58-
<code>$resultIdentity</code>
5962
</MixedArgument>
6063
<MixedAssignment occurrences="3">
6164
<code>$name</code>
6265
<code>$name</code>
6366
<code>$resultIdentity</code>
6467
</MixedAssignment>
68+
<RedundantConditionGivenDocblockType occurrences="2">
69+
<code>null !== $this-&gt;httpAuth-&gt;getBasicResolver()</code>
70+
<code>null !== $this-&gt;httpAuth-&gt;getDigestResolver()</code>
71+
</RedundantConditionGivenDocblockType>
6572
<TooManyArguments occurrences="1">
6673
<code>authenticate</code>
6774
</TooManyArguments>
@@ -70,15 +77,14 @@
7077
<ImplementedReturnTypeMismatch occurrences="1">
7178
<code>Identity\AuthenticatedIdentity|Identity\GuestIdentity|Response</code>
7279
</ImplementedReturnTypeMismatch>
73-
<MixedArgument occurrences="11">
80+
<MixedArgument occurrences="10">
7481
<code>$oauth2Response</code>
7582
<code>$oauth2Response-&gt;getHttpHeaders()</code>
7683
<code>$request-&gt;getContent()</code>
7784
<code>$request-&gt;getFiles() ? $request-&gt;getFiles()-&gt;toArray() : []</code>
7885
<code>$request-&gt;getHeaders()-&gt;toArray()</code>
7986
<code>$request-&gt;getPost()-&gt;toArray()</code>
8087
<code>$request-&gt;getQuery()-&gt;toArray()</code>
81-
<code>$token</code>
8288
<code>$token['user_id']</code>
8389
<code>$value</code>
8490
<code>method_exists($request, 'getServer') ? $request-&gt;getServer()-&gt;toArray() : $_SERVER</code>
@@ -239,7 +245,6 @@
239245
<code>$data</code>
240246
<code>$listener</code>
241247
<code>$type</code>
242-
<code>$type</code>
243248
</MixedArgument>
244249
<MixedArrayAccess occurrences="2">
245250
<code>$config['api-tools-mvc-auth']['authentication']</code>
@@ -417,6 +422,9 @@
417422
<code>$container-&gt;get($config['digest_resolver_factory'])</code>
418423
<code>$key</code>
419424
</MixedArgument>
425+
<MixedArgumentTypeCoercion occurrences="1">
426+
<code>$config['accept_schemes']</code>
427+
</MixedArgumentTypeCoercion>
420428
<PossiblyNullReference occurrences="2">
421429
<code>get</code>
422430
<code>get</code>
@@ -434,18 +442,16 @@
434442
<code>$oauth2Config</code>
435443
<code>$oauth2Config</code>
436444
</MixedArgument>
437-
<MixedArrayAccess occurrences="5">
445+
<MixedArrayAccess occurrences="4">
438446
<code>$adapterConfig['storage']</code>
439447
<code>$adapterConfig['storage']</code>
440448
<code>$config['api-tools-mvc-auth']</code>
441449
<code>$config['api-tools-oauth2']</code>
442-
<code>$servers-&gt;api[$type]</code>
443450
</MixedArrayAccess>
444451
<MixedArrayAssignment occurrences="1">
445452
<code>$servers-&gt;api[$type]</code>
446453
</MixedArrayAssignment>
447-
<MixedArrayOffset occurrences="3">
448-
<code>$servers-&gt;api[$type]</code>
454+
<MixedArrayOffset occurrences="2">
449455
<code>$servers-&gt;api[$type]</code>
450456
<code>$servers-&gt;api[$type]</code>
451457
</MixedArrayOffset>
@@ -456,6 +462,10 @@
456462
<code>$name</code>
457463
<code>$oauth2Config</code>
458464
</MixedAssignment>
465+
<TypeDoesNotContainType occurrences="2">
466+
<code>null !== $servers-&gt;application</code>
467+
<code>null !== $servers-&gt;application</code>
468+
</TypeDoesNotContainType>
459469
<UnusedVariable occurrences="1">
460470
<code>$name</code>
461471
</UnusedVariable>
@@ -467,7 +477,8 @@
467477
<code>$server-&gt;getStorage('refresh_token')</code>
468478
<code>$server-&gt;getStorage('user_credentials')</code>
469479
</ArgumentTypeCoercion>
470-
<InvalidArgument occurrences="1">
480+
<InvalidArgument occurrences="2">
481+
<code>self::createMongoDatabase($config, $container)</code>
471482
<code>self::createPdoConfig($config)</code>
472483
</InvalidArgument>
473484
<InvalidCast occurrences="1">
@@ -586,10 +597,8 @@
586597
<code>getStorage</code>
587598
<code>write</code>
588599
</MixedMethodCall>
589-
<PropertyNotSetInConstructor occurrences="3">
600+
<PropertyNotSetInConstructor occurrences="1">
590601
<code>$authenticationResult</code>
591-
<code>MvcAuthEvent</code>
592-
<code>MvcAuthEvent</code>
593602
</PropertyNotSetInConstructor>
594603
<RedundantCastGivenDocblockType occurrences="1">
595604
<code>(bool) $flag</code>
@@ -605,14 +614,11 @@
605614
<code>$r</code>
606615
<code>$r</code>
607616
</MissingClosureParamType>
608-
<MixedArgument occurrences="7">
609-
<code>$identity</code>
610-
<code>$mvcAuthEvent-&gt;getAuthenticationResult()-&gt;getIdentity()</code>
617+
<MixedArgument occurrences="4">
611618
<code>$mvcAuthEvent::EVENT_AUTHENTICATION</code>
612619
<code>$mvcAuthEvent::EVENT_AUTHENTICATION_POST</code>
613620
<code>$mvcAuthEvent::EVENT_AUTHORIZATION</code>
614621
<code>$mvcAuthEvent::EVENT_AUTHORIZATION_POST</code>
615-
<code>$result-&gt;getIdentity()</code>
616622
</MixedArgument>
617623
<MixedAssignment occurrences="2">
618624
<code>$result</code>
@@ -792,12 +798,6 @@
792798
</UndefinedThisPropertyFetch>
793799
</file>
794800
<file src="test/Authentication/OAuth2AdapterTest.php">
795-
<MissingClosureParamType occurrences="4">
796-
<code>$subject</code>
797-
<code>$subject</code>
798-
<code>$subject</code>
799-
<code>$subject</code>
800-
</MissingClosureParamType>
801801
<MixedAssignment occurrences="1">
802802
<code>$instance</code>
803803
</MixedAssignment>
@@ -855,7 +855,7 @@
855855
</UndefinedThisPropertyFetch>
856856
</file>
857857
<file src="test/Authorization/DefaultAuthorizationListenerTest.php">
858-
<InvalidArgument occurrences="2">
858+
<InvalidArgument occurrences="3">
859859
<code>$container</code>
860860
<code>[]</code>
861861
</InvalidArgument>
@@ -1158,9 +1158,6 @@
11581158
<MixedAssignment occurrences="1">
11591159
<code>$storageConfig</code>
11601160
</MixedAssignment>
1161-
<PossiblyNullArgument occurrences="1">
1162-
<code>$storage</code>
1163-
</PossiblyNullArgument>
11641161
<PossiblyUndefinedVariable occurrences="1">
11651162
<code>$class</code>
11661163
</PossiblyUndefinedVariable>
@@ -1169,9 +1166,6 @@
11691166
</TooManyArguments>
11701167
</file>
11711168
<file src="test/Identity/AuthenticatedIdentityTest.php">
1172-
<InvalidArgument occurrences="1">
1173-
<code>$this-&gt;authIdentity</code>
1174-
</InvalidArgument>
11751169
<MixedMethodCall occurrences="4">
11761170
<code>getAuthenticationIdentity</code>
11771171
<code>getName</code>

psalm.xml.dist

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0"?>
22
<psalm
3-
totallyTyped="true"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xmlns="https://getpsalm.org/schema/config"
6-
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
3+
errorLevel="1"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns="https://getpsalm.org/schema/config"
6+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
77
errorBaseline="psalm-baseline.xml"
88
>
99
<projectFiles>

src/Authentication/DefaultAuthenticationListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use function array_merge;
1818
use function array_unique;
1919
use function count;
20-
use function get_class;
2120
use function gettype;
2221
use function is_object;
2322
use function rtrim;
@@ -231,7 +230,7 @@ private function getTypeFromMap($routeMatch = null)
231230
__METHOD__,
232231
RouteMatch::class,
233232
V2RouteMatch::class,
234-
is_object($routeMatch) ? get_class($routeMatch) : gettype($routeMatch)
233+
is_object($routeMatch) ? $routeMatch::class : gettype($routeMatch)
235234
));
236235
}
237236

src/Authentication/HttpAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ public function provides()
6969
$providesBase = $this->providesBase ? $this->providesBase . '-' : '';
7070
$provides = [];
7171

72-
if ($this->httpAuth->getBasicResolver()) {
72+
if (null !== $this->httpAuth->getBasicResolver()) {
7373
$provides[] = $providesBase . 'basic';
7474
}
7575

76-
if ($this->httpAuth->getDigestResolver()) {
76+
if (null !== $this->httpAuth->getDigestResolver()) {
7777
$provides[] = $providesBase . 'digest';
7878
}
7979

src/Authorization/DefaultResourceResolverListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Laminas\Stdlib\RequestInterface;
1313

1414
use function array_key_exists;
15-
use function get_class;
1615
use function gettype;
1716
use function is_object;
1817
use function sprintf;
@@ -84,7 +83,7 @@ public function buildResourceString($routeMatch, $request)
8483
__METHOD__,
8584
RouteMatch::class,
8685
V2RouteMatch::class,
87-
is_object($routeMatch) ? get_class($routeMatch) : gettype($routeMatch)
86+
is_object($routeMatch) ? $routeMatch::class : gettype($routeMatch)
8887
));
8988
}
9089

src/Factory/AclAuthorizationFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace Laminas\ApiTools\MvcAuth\Factory;
66

7-
use Interop\Container\ContainerInterface;
87
use Laminas\ApiTools\MvcAuth\Authorization\AclAuthorization;
98
use Laminas\ApiTools\MvcAuth\Authorization\AclAuthorizationFactory as AclFactory;
109
use Laminas\Http\Request;
1110
use Laminas\ServiceManager\FactoryInterface;
1211
use Laminas\ServiceManager\ServiceLocatorInterface;
12+
use Psr\Container\ContainerInterface;
1313

1414
use function array_key_exists;
1515
use function array_keys;

src/Factory/ApacheResolverFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Laminas\ApiTools\MvcAuth\Factory;
66

7-
use Interop\Container\ContainerInterface;
87
use Laminas\ServiceManager\FactoryInterface;
98
use Laminas\ServiceManager\ServiceLocatorInterface;
9+
use Psr\Container\ContainerInterface;
1010

1111
class ApacheResolverFactory implements FactoryInterface
1212
{

0 commit comments

Comments
 (0)