Add Psalm for static analysis

This commit is contained in:
Oliver Davies 2020-06-05 21:09:58 +01:00
parent 73160563b3
commit ce05172932
4 changed files with 23 additions and 1 deletions

1
.gitignore vendored
View file

@ -5,5 +5,6 @@
!/.gitignore !/.gitignore
!/composer.json !/composer.json
!/Makefile !/Makefile
!/psalm.xml
!/src/** !/src/**
!/tests/** !/tests/**

View file

@ -1,5 +1,8 @@
.PHONY: * .PHONY: *
static-code-analysis:
php vendor/bin/psalm --show-info=true
phpcs: phpcs:
php vendor/bin/phpcs --standard=PSR2 src tests php vendor/bin/phpcs --standard=PSR2 src tests

View file

@ -26,7 +26,8 @@
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.1", "phpunit/phpunit": "^9.1",
"squizlabs/php_codesniffer": "^3.5", "squizlabs/php_codesniffer": "^3.5",
"symfony/var-dumper": "^5.0" "symfony/var-dumper": "^5.0",
"vimeo/psalm": "^3.11"
}, },
"config": { "config": {
"sort-packages": true "sort-packages": true

17
psalm.xml Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
findUnusedVariablesAndParams="true"
resolveFromConfigFile="true"
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"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>