Skip to content

Commit

Permalink
Merge pull request #24 from mezzio/renovate/vimeo-psalm-5.x
Browse files Browse the repository at this point in the history
Update dependency vimeo/psalm to v5
  • Loading branch information
Ocramius authored Dec 1, 2022
2 parents c4f0ee6 + 11f46a1 commit c50567a
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 132 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"laminas/laminas-servicemanager": "^3.19.0",
"phpunit/phpunit": "^9.5.26",
"psalm/plugin-phpunit": "^0.18.0",
"vimeo/psalm": "^4.29"
"vimeo/psalm": "^5.0"
},
"conflict": {
"container-interop/container-interop": "<1.2.0",
Expand Down
176 changes: 92 additions & 84 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 10 additions & 38 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,57 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.29.0@7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3">
<file src="src/ConfigProvider.php">
<MixedArrayOffset occurrences="1"/>
<UndefinedClass occurrences="1">
<code>ZendAcl</code>
</UndefinedClass>
</file>
<files psalm-version="5.0.0@4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8">
<file src="src/LaminasAcl.php">
<MixedArgument occurrences="1">
<code>$routeName</code>
</MixedArgument>
<MixedAssignment occurrences="2">
<PossiblyFalseArgument occurrences="1">
<code>$routeName</code>
<code>$routeResult</code>
</MixedAssignment>
<MixedMethodCall occurrences="2">
<code>getMatchedRouteName</code>
<code>isFailure</code>
</MixedMethodCall>
</PossiblyFalseArgument>
</file>
<file src="src/LaminasAclFactory.php">
<InvalidCatch occurrences="4"/>
<InvalidScalarArgument occurrences="4">
<code>$e-&gt;getCode()</code>
<code>$e-&gt;getCode()</code>
<code>$e-&gt;getCode()</code>
<code>$e-&gt;getCode()</code>
</InvalidScalarArgument>
<MixedArgument occurrences="8">
<MixedArgument occurrences="4">
<code>$config['allow'] ?? []</code>
<code>$config['deny'] ?? []</code>
<code>$config['resources']</code>
<code>$config['roles']</code>
<code>$parent</code>
<code>$parent</code>
<code>$parents</code>
<code>$resource</code>
</MixedArgument>
<MixedArgumentTypeCoercion occurrences="1">
<code>$role</code>
</MixedArgumentTypeCoercion>
<MixedArrayAccess occurrences="4">
<code>$config['allow']</code>
<code>$config['deny']</code>
<code>$config['resources']</code>
<code>$config['roles']</code>
</MixedArrayAccess>
<MixedAssignment occurrences="5">
<MixedAssignment occurrences="1">
<code>$config</code>
<code>$parent</code>
<code>$parents</code>
<code>$resource</code>
<code>$resources</code>
</MixedAssignment>
</file>
<file src="test/ConfigProviderTest.php">
Expand All @@ -65,12 +34,15 @@
<MixedArgumentTypeCoercion occurrences="1">
<code>$dependencies</code>
</MixedArgumentTypeCoercion>
<MixedArrayAccess occurrences="2">
<MixedArrayAccess occurrences="4">
<code>$json['packages']</code>
<code>$package['extra']</code>
<code>$package['extra']['laminas']</code>
<code>$package['extra']['laminas']['config-provider']</code>
</MixedArrayAccess>
<MixedArrayAssignment occurrences="1">
<MixedArrayAssignment occurrences="2">
<code>$config['dependencies']['services']</code>
<code>$config['dependencies']['services']['config']</code>
</MixedArrayAssignment>
<MixedAssignment occurrences="2">
<code>$json</code>
Expand Down
4 changes: 1 addition & 3 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Mezzio\Authorization\Acl;

use Zend\Expressive\Authorization\Acl\ZendAcl;

class ConfigProvider
{
public function __invoke(): array
Expand All @@ -20,7 +18,7 @@ public function getDependencies(): array
return [
// Legacy Zend Framework aliases
'aliases' => [
ZendAcl::class => LaminasAcl::class,
'Zend\Expressive\Authorization\Acl\ZendAcl' => LaminasAcl::class,
],
'factories' => [
LaminasAcl::class => LaminasAclFactory::class,
Expand Down
2 changes: 1 addition & 1 deletion src/LaminasAcl.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(Acl $acl)
public function isGranted(string $role, ServerRequestInterface $request): bool
{
$routeResult = $request->getAttribute(RouteResult::class, false);
if (false === $routeResult) {
if (! $routeResult instanceof RouteResult) {
throw new Exception\RuntimeException(sprintf(
'The %s attribute is missing in the request; cannot perform ACL authorization checks',
RouteResult::class
Expand Down
Loading

0 comments on commit c50567a

Please sign in to comment.