Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "8.0.99"
}
},
"extra": {
Expand All @@ -28,25 +31,25 @@
}
},
"require": {
"php": "^7.3 || ~8.0.0 || ~8.1.0",
"laminas-api-tools/api-tools-api-problem": "^1.4.0",
"laminas-api-tools/api-tools-content-negotiation": "^1.5.0",
"laminas-api-tools/api-tools-oauth2": "^1.7",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"laminas-api-tools/api-tools-api-problem": "^1.5.0",
"laminas-api-tools/api-tools-content-negotiation": "^1.8.0",
"laminas-api-tools/api-tools-oauth2": "^1.9",
"laminas/laminas-authentication": "^2.5.3",
"laminas/laminas-eventmanager": "^3.2",
"laminas/laminas-http": "^2.5.4",
"laminas/laminas-mvc": "^2.7.9 || ^3.0.2",
"laminas/laminas-permissions-acl": "^2.6",
"laminas/laminas-permissions-rbac": "^2.6.0 || ^3.0",
"laminas/laminas-servicemanager": "^2.7.6 || ^3.1",
"laminas/laminas-servicemanager": "^3.11",
"laminas/laminas-stdlib": "^2.7.8 || ^3.0.1",
"laminas/laminas-zendframework-bridge": "^1.1"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.3.0",
"laminas/laminas-session": "^2.8.5",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.3",
"phpunit/phpunit": "^9.5.10",
"psalm/plugin-phpunit": "^0.16.0",
"vimeo/psalm": "^4.7"
},
Expand Down
2,235 changes: 1,152 additions & 1,083 deletions composer.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0"?>
<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">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="./vendor/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
Expand Down
54 changes: 22 additions & 32 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.7.3@38c452ae584467e939d55377aaf83b5a26f19dd1">
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69">
<file src="config/module.config.php">
<MixedArrayOffset occurrences="1"/>
<UndefinedClass occurrences="1">
<code>Authentication\AuthHttpAdapter</code>
</UndefinedClass>
Expand All @@ -27,7 +28,10 @@
<DeprecatedMethod occurrences="1">
<code>attachHttpAdapter</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="2">
<DeprecatedProperty occurrences="5">
<code>$this-&gt;httpAdapter</code>
<code>$this-&gt;httpAdapter</code>
<code>$this-&gt;httpAdapter</code>
<code>$this-&gt;httpAdapter</code>
<code>$this-&gt;httpAdapter</code>
</DeprecatedProperty>
Expand All @@ -53,9 +57,8 @@
</PossiblyNullReference>
</file>
<file src="src/Authentication/HttpAdapter.php">
<MixedArgument occurrences="2">
<MixedArgument occurrences="1">
<code>$name</code>
<code>$resultIdentity</code>
</MixedArgument>
<MixedAssignment occurrences="3">
<code>$name</code>
Expand All @@ -70,15 +73,14 @@
<ImplementedReturnTypeMismatch occurrences="1">
<code>Identity\AuthenticatedIdentity|Identity\GuestIdentity|Response</code>
</ImplementedReturnTypeMismatch>
<MixedArgument occurrences="11">
<MixedArgument occurrences="10">
<code>$oauth2Response</code>
<code>$oauth2Response-&gt;getHttpHeaders()</code>
<code>$request-&gt;getContent()</code>
<code>$request-&gt;getFiles() ? $request-&gt;getFiles()-&gt;toArray() : []</code>
<code>$request-&gt;getHeaders()-&gt;toArray()</code>
<code>$request-&gt;getPost()-&gt;toArray()</code>
<code>$request-&gt;getQuery()-&gt;toArray()</code>
<code>$token</code>
<code>$token['user_id']</code>
<code>$value</code>
<code>method_exists($request, 'getServer') ? $request-&gt;getServer()-&gt;toArray() : $_SERVER</code>
Expand Down Expand Up @@ -239,7 +241,6 @@
<code>$data</code>
<code>$listener</code>
<code>$type</code>
<code>$type</code>
</MixedArgument>
<MixedArrayAccess occurrences="2">
<code>$config['api-tools-mvc-auth']['authentication']</code>
Expand Down Expand Up @@ -417,6 +418,9 @@
<code>$container-&gt;get($config['digest_resolver_factory'])</code>
<code>$key</code>
</MixedArgument>
<MixedArgumentTypeCoercion occurrences="1">
<code>$config['accept_schemes']</code>
</MixedArgumentTypeCoercion>
<PossiblyNullReference occurrences="2">
<code>get</code>
<code>get</code>
Expand All @@ -434,18 +438,16 @@
<code>$oauth2Config</code>
<code>$oauth2Config</code>
</MixedArgument>
<MixedArrayAccess occurrences="5">
<MixedArrayAccess occurrences="4">
<code>$adapterConfig['storage']</code>
<code>$adapterConfig['storage']</code>
<code>$config['api-tools-mvc-auth']</code>
<code>$config['api-tools-oauth2']</code>
<code>$servers-&gt;api[$type]</code>
</MixedArrayAccess>
<MixedArrayAssignment occurrences="1">
<code>$servers-&gt;api[$type]</code>
</MixedArrayAssignment>
<MixedArrayOffset occurrences="3">
<code>$servers-&gt;api[$type]</code>
<MixedArrayOffset occurrences="2">
<code>$servers-&gt;api[$type]</code>
<code>$servers-&gt;api[$type]</code>
</MixedArrayOffset>
Expand All @@ -456,6 +458,10 @@
<code>$name</code>
<code>$oauth2Config</code>
</MixedAssignment>
<TypeDoesNotContainType occurrences="2">
<code>null !== $servers-&gt;application</code>
<code>null !== $servers-&gt;application</code>
</TypeDoesNotContainType>
<UnusedVariable occurrences="1">
<code>$name</code>
</UnusedVariable>
Expand All @@ -467,7 +473,8 @@
<code>$server-&gt;getStorage('refresh_token')</code>
<code>$server-&gt;getStorage('user_credentials')</code>
</ArgumentTypeCoercion>
<InvalidArgument occurrences="1">
<InvalidArgument occurrences="2">
<code>self::createMongoDatabase($config, $container)</code>
<code>self::createPdoConfig($config)</code>
</InvalidArgument>
<InvalidCast occurrences="1">
Expand Down Expand Up @@ -586,10 +593,8 @@
<code>getStorage</code>
<code>write</code>
</MixedMethodCall>
<PropertyNotSetInConstructor occurrences="3">
<PropertyNotSetInConstructor occurrences="1">
<code>$authenticationResult</code>
<code>MvcAuthEvent</code>
<code>MvcAuthEvent</code>
</PropertyNotSetInConstructor>
<RedundantCastGivenDocblockType occurrences="1">
<code>(bool) $flag</code>
Expand All @@ -605,14 +610,11 @@
<code>$r</code>
<code>$r</code>
</MissingClosureParamType>
<MixedArgument occurrences="7">
<code>$identity</code>
<code>$mvcAuthEvent-&gt;getAuthenticationResult()-&gt;getIdentity()</code>
<MixedArgument occurrences="4">
<code>$mvcAuthEvent::EVENT_AUTHENTICATION</code>
<code>$mvcAuthEvent::EVENT_AUTHENTICATION_POST</code>
<code>$mvcAuthEvent::EVENT_AUTHORIZATION</code>
<code>$mvcAuthEvent::EVENT_AUTHORIZATION_POST</code>
<code>$result-&gt;getIdentity()</code>
</MixedArgument>
<MixedAssignment occurrences="2">
<code>$result</code>
Expand Down Expand Up @@ -792,12 +794,6 @@
</UndefinedThisPropertyFetch>
</file>
<file src="test/Authentication/OAuth2AdapterTest.php">
<MissingClosureParamType occurrences="4">
<code>$subject</code>
<code>$subject</code>
<code>$subject</code>
<code>$subject</code>
</MissingClosureParamType>
<MixedAssignment occurrences="1">
<code>$instance</code>
</MixedAssignment>
Expand Down Expand Up @@ -855,7 +851,7 @@
</UndefinedThisPropertyFetch>
</file>
<file src="test/Authorization/DefaultAuthorizationListenerTest.php">
<InvalidArgument occurrences="2">
<InvalidArgument occurrences="3">
<code>$container</code>
<code>[]</code>
</InvalidArgument>
Expand Down Expand Up @@ -1158,9 +1154,6 @@
<MixedAssignment occurrences="1">
<code>$storageConfig</code>
</MixedAssignment>
<PossiblyNullArgument occurrences="1">
<code>$storage</code>
</PossiblyNullArgument>
<PossiblyUndefinedVariable occurrences="1">
<code>$class</code>
</PossiblyUndefinedVariable>
Expand All @@ -1169,9 +1162,6 @@
</TooManyArguments>
</file>
<file src="test/Identity/AuthenticatedIdentityTest.php">
<InvalidArgument occurrences="1">
<code>$this-&gt;authIdentity</code>
</InvalidArgument>
<MixedMethodCall occurrences="4">
<code>getAuthenticationIdentity</code>
<code>getName</code>
Expand Down
8 changes: 4 additions & 4 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorLevel="1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
Expand Down
3 changes: 1 addition & 2 deletions src/Authentication/DefaultAuthenticationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use function array_merge;
use function array_unique;
use function count;
use function get_class;
use function gettype;
use function is_object;
use function rtrim;
Expand Down Expand Up @@ -231,7 +230,7 @@ private function getTypeFromMap($routeMatch = null)
__METHOD__,
RouteMatch::class,
V2RouteMatch::class,
is_object($routeMatch) ? get_class($routeMatch) : gettype($routeMatch)
is_object($routeMatch) ? $routeMatch::class : gettype($routeMatch)
));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Authentication/HttpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public function provides()
$providesBase = $this->providesBase ? $this->providesBase . '-' : '';
$provides = [];

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

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

Expand Down
3 changes: 1 addition & 2 deletions src/Authorization/DefaultResourceResolverListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Laminas\Stdlib\RequestInterface;

use function array_key_exists;
use function get_class;
use function gettype;
use function is_object;
use function sprintf;
Expand Down Expand Up @@ -84,7 +83,7 @@ public function buildResourceString($routeMatch, $request)
__METHOD__,
RouteMatch::class,
V2RouteMatch::class,
is_object($routeMatch) ? get_class($routeMatch) : gettype($routeMatch)
is_object($routeMatch) ? $routeMatch::class : gettype($routeMatch)
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Factory/AclAuthorizationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\MvcAuth\Authorization\AclAuthorization;
use Laminas\ApiTools\MvcAuth\Authorization\AclAuthorizationFactory as AclFactory;
use Laminas\Http\Request;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

use function array_key_exists;
use function array_keys;
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/ApacheResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

class ApacheResolverFactory implements FactoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/AuthenticationAdapterDelegatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\MvcAuth\Authentication\DefaultAuthenticationListener;
use Laminas\ApiTools\MvcAuth\Authentication\HttpAdapter;
use Laminas\ApiTools\MvcAuth\Authentication\OAuth2Adapter;
use Laminas\ServiceManager\DelegatorFactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

use function is_array;
use function is_string;
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/AuthenticationHttpAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\MvcAuth\Authentication\HttpAdapter;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Psr\Container\ContainerInterface;

use function is_array;

Expand Down
2 changes: 1 addition & 1 deletion src/Factory/AuthenticationOAuth2AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\MvcAuth\Authentication\OAuth2Adapter;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Psr\Container\ContainerInterface;

use function is_array;

Expand Down
2 changes: 1 addition & 1 deletion src/Factory/AuthenticationServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\Authentication\AuthenticationService;
use Laminas\Authentication\Storage\NonPersistent;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

class AuthenticationServiceFactory implements FactoryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/DefaultAuthHttpAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\Authentication\Adapter\Http as HttpAuth;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

/**
* Factory for creating the DefaultAuthHttpAdapterFactory from configuration.
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/DefaultAuthenticationListenerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace Laminas\ApiTools\MvcAuth\Factory;

use Interop\Container\ContainerInterface;
use Laminas\ApiTools\MvcAuth\Authentication\DefaultAuthenticationListener;
use Laminas\ApiTools\MvcAuth\Authentication\HttpAdapter;
use Laminas\ApiTools\MvcAuth\Authentication\OAuth2Adapter;
use Laminas\ApiTools\OAuth2\Factory\OAuth2ServerFactory as LaminasOAuth2ServerFactory;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;
use RuntimeException;

use function is_array;
Expand Down
Loading