Skip to content

Commit

Permalink
Add psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Aug 28, 2020
1 parent f0e1dca commit ddc5f77
Show file tree
Hide file tree
Showing 7 changed files with 1,690 additions and 147 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ infection.json export-ignore
Makefile export-ignore
phpstan.neon.dist export-ignore
phpstan-baseline.neon export-ignore
psalm-baseline.xml export-ignore
psalm.xml export-ignore
phpunit.xml.dist export-ignore
/docs export-ignore
/tests export-ignore
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ jobs:
- name: "Run phpstan/phpstan"
run: composer phpstan

- name: "Run psalm"
run: vendor/bin/psalm --config=psalm.xml --diff --diff-methods --shepherd --show-info=false --stats --threads=4

tests:
name: "Test (PHP ${{ matrix.php-version }}, symfony ${{ matrix.symfony }}, ${{ matrix.dependencies }})"

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ NucleosUserAdminBundle

[![Continuous Integration](https://github.com/nucleos/NucleosUserAdminBundle/workflows/Continuous%20Integration/badge.svg)](https://github.com/nucleos/NucleosUserAdminBundle/actions)
[![Code Coverage](https://codecov.io/gh/nucleos/NucleosUserAdminBundle/branch/main/graph/badge.svg)](https://codecov.io/gh/nucleos/NucleosUserAdminBundle)
[![Type Coverage](https://shepherd.dev/github/nucleos/NucleosUserAdminBundle/coverage.svg)](https://shepherd.dev/github/nucleos/NucleosUserAdminBundle)

The NucleosUserAdminBundle is an user admin backend for [SonataAdminBundle](https://github.com/sonata-project/SonataAdminBundle).

Expand Down
68 changes: 68 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.14.2@3538fe1955d47f6ee926c0769d71af6db08aa488">
<file src="src/Action/LoginAction.php">
<TooManyArguments occurrences="1">
<code>dispatch</code>
</TooManyArguments>
</file>
<file src="src/Admin/Model/UserAdmin.php">
<PossiblyNullArgument occurrences="1">
<code>$this-&gt;getSubject()</code>
</PossiblyNullArgument>
</file>
<file src="src/DependencyInjection/Configuration.php">
<PossiblyUndefinedMethod occurrences="1">
<code>children</code>
</PossiblyUndefinedMethod>
<UndefinedMethod occurrences="1">
<code>children</code>
</UndefinedMethod>
</file>
<file src="src/Form/Type/SecurityRolesType.php">
<ParamNameMismatch occurrences="1">
<code>$formBuilder</code>
</ParamNameMismatch>
</file>
<file src="src/Security/Authorization/Voter/UserAclVoter.php">
<ParamNameMismatch occurrences="1">
<code>$subject</code>
</ParamNameMismatch>
<PossiblyInvalidMethodCall occurrences="1">
<code>isSuperAdmin</code>
</PossiblyInvalidMethodCall>
<UndefinedInterfaceMethod occurrences="1">
<code>isSuperAdmin</code>
</UndefinedInterfaceMethod>
</file>
<file src="src/Security/RolesBuilder/AdminRolesBuilder.php">
<InvalidArgument occurrences="1">
<code>$this-&gt;excludeAdmins</code>
</InvalidArgument>
<InvalidPropertyAssignmentValue occurrences="1">
<code>[]</code>
</InvalidPropertyAssignmentValue>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;excludeAdmins</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>string[]</code>
</InvalidReturnType>
<PossiblyNullArgument occurrences="1">
<code>$admin-&gt;getParent()</code>
</PossiblyNullArgument>
</file>
<file src="src/Security/RolesBuilder/SecurityRolesBuilder.php">
<InvalidArgument occurrences="1">
<code>$this-&gt;rolesHierarchy</code>
</InvalidArgument>
<InvalidPropertyAssignmentValue occurrences="1">
<code>$rolesHierarchy</code>
</InvalidPropertyAssignmentValue>
<RedundantCondition occurrences="1">
<code>$result</code>
</RedundantCondition>
<TypeDoesNotContainType occurrences="1">
<code>false === $result</code>
</TypeDoesNotContainType>
</file>
</files>
24 changes: 24 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
resolveFromConfigFile="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"
errorBaseline="psalm-baseline.xml"
>
<issueHandlers>
<LessSpecificReturnType errorLevel="info" />
</issueHandlers>

<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin" />
</plugins>

<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
5 changes: 4 additions & 1 deletion vendor-bin/tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"phpstan/phpstan-strict-rules": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"phpunit/phpunit": "^9.3",
"symfony/phpunit-bridge": "^5.1"
"psalm/plugin-phpunit": "^0.11",
"psalm/plugin-symfony": "^1.3",
"symfony/phpunit-bridge": "^5.1",
"vimeo/psalm": "^3.11"
},
"config": {
"platform": {
Expand Down
Loading

0 comments on commit ddc5f77

Please sign in to comment.