Skip to content

Commit

Permalink
Fix minor phpstan findings (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Feb 9, 2021
1 parent 09d8e0d commit d6391dd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
15 changes: 15 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ parameters:
count: 1
path: src/Form/Transformer/RestoreRolesTransformer.php

-
message: "#^Strict comparison using \\=\\=\\= between false and array\\<\\(int\\|string\\)\\> will always evaluate to false\\.$#"
count: 1
path: src/Form/Type/RolesMatrixType.php

-
message: "#^Method Nucleos\\\\UserAdminBundle\\\\Security\\\\Authorization\\\\Voter\\\\UserAclVoter\\:\\:vote\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -75,11 +80,21 @@ parameters:
count: 1
path: src/Security/EditableRolesBuilder.php

-
message: "#^Strict comparison using \\=\\=\\= between null and Sonata\\\\AdminBundle\\\\Security\\\\Handler\\\\SecurityHandlerInterface will always evaluate to false\\.$#"
count: 1
path: src/Security/EditableRolesBuilder.php

-
message: "#^Method Nucleos\\\\UserAdminBundle\\\\Security\\\\RolesBuilder\\\\AdminRolesBuilder\\:\\:getRoles\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Security/RolesBuilder/AdminRolesBuilder.php

-
message: "#^Strict comparison using \\=\\=\\= between null and Sonata\\\\AdminBundle\\\\Security\\\\Handler\\\\SecurityHandlerInterface will always evaluate to false\\.$#"
count: 1
path: src/Security/RolesBuilder/AdminRolesBuilder.php

-
message: "#^Method Nucleos\\\\UserAdminBundle\\\\Security\\\\RolesBuilder\\\\ExpandableRolesBuilderInterface\\:\\:getExpandedRoles\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
11 changes: 5 additions & 6 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.3.1@2feba22a005a18bf31d4c7b9bdb9252c73897476">
<files psalm-version="4.4.1@9fd7a7d885b3a216cff8dec9d8c21a132f275224">
<file src="src/Action/LoginAction.php">
<TooManyArguments occurrences="1">
<code>dispatch</code>
</TooManyArguments>
</file>
<file src="src/Admin/Model/UserAdmin.php">
<ArgumentTypeCoercion occurrences="3">
<code>$this-&gt;getSubject()</code>
<code>$user</code>
<code>$user</code>
</ArgumentTypeCoercion>
<PossiblyNullArgument occurrences="1">
<code>$this-&gt;getSubject()</code>
</PossiblyNullArgument>
Expand Down Expand Up @@ -64,6 +59,10 @@
<code>$securityRoles</code>
<code>$securityRoles</code>
</InvalidArgument>
<InvalidArrayOffset occurrences="2">
<code>$securityRoles[$role]</code>
<code>$securityRoles[$role]</code>
</InvalidArrayOffset>
<InvalidOperand occurrences="1">
<code>$role</code>
</InvalidOperand>
Expand Down
1 change: 1 addition & 0 deletions src/DependencyInjection/NucleosUserAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function load(array $configs, ContainerBuilder $container): void

$config['manager_type'] = $container->getParameter('nucleos_user.storage');

/** @var array<string, mixed> $bundles */
$bundles = $container->getParameter('kernel.bundles');

$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
Expand Down
2 changes: 1 addition & 1 deletion src/Security/RolesBuilder/AdminRolesBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private function getAdminLabel(AdminInterface $admin): string
return sprintf(
'%s > %s',
$this->getGroupLabel($admin),
$admin->getTranslator()->trans($admin->getLabel(), [], $admin->getTranslationDomain())
$admin->getTranslator()->trans($admin->getLabel() ?? '', [], $admin->getTranslationDomain())
);
}

Expand Down

0 comments on commit d6391dd

Please sign in to comment.