Skip to content

Commit

Permalink
Merge pull request #217 from spaze/spaze/psalm
Browse files Browse the repository at this point in the history
Psalm & PHPStan strict rules
  • Loading branch information
antonioribeiro authored Oct 14, 2024
2 parents 264dc6f + 07a92b3 commit a46da2d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ jobs:

- name: Execute PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon

- name: Execute Psalm
run: vendor/bin/psalm
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"require-dev": {
"phpunit/phpunit": "^7.5.15|^8.5|^9.0",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-strict-rules": "^1.6"
"phpstan/phpstan-strict-rules": "^1.6",
"vimeo/psalm": "^5.26"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 17 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
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"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
10 changes: 7 additions & 3 deletions tests/tools/analyse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@ source tests/tools/helpers.sh

function main
{
get_phpstan_path
get_paths

banner

$PHPSTAN analyse -c phpstan.neon
$PSALM
}

function get_phpstan_path()
function get_paths()
{
current_directory

PHPSTAN="$ROOT_DIRECTORY/vendor/bin/phpstan"
PSALM="$ROOT_DIRECTORY/vendor/bin/psalm"
}

function banner
{
echo Google2FA testing framework
echo -----------------------------
echo
echo You can execute these tests by running $PHPSTAN
echo You can execute these tests by running
echo - $PHPSTAN
echo - $PSALM
echo
}

Expand Down

0 comments on commit a46da2d

Please sign in to comment.