Merge branch 'feat/add-psalm-checks'

This commit is contained in:
Pol Dellaiera 2021-12-21 10:15:34 +01:00
commit 8c3fb6dfa7
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
6 changed files with 2220 additions and 3 deletions

View File

@ -60,7 +60,7 @@ code_style:
- bin - bin
- tests/app/vendor/ - tests/app/vendor/
sa_tests: phpstan_tests:
stage: Tests stage: Tests
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4 image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
script: script:
@ -71,6 +71,17 @@ sa_tests:
- bin - bin
- tests/app/vendor/ - tests/app/vendor/
psalm_tests:
stage: Tests
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
script:
- bin/grumphp run --tasks=psalm
artifacts:
expire_in: 30 min
paths:
- bin
- tests/app/vendor/
unit_tests: unit_tests:
stage: Tests stage: Tests
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4 image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4

View File

@ -64,10 +64,12 @@
"symfony/phpunit-bridge": "^5.2", "symfony/phpunit-bridge": "^5.2",
"symfony/stopwatch": "^5.1", "symfony/stopwatch": "^5.1",
"symfony/var-dumper": "4.*", "symfony/var-dumper": "4.*",
"symfony/web-profiler-bundle": "^5.0" "symfony/web-profiler-bundle": "^5.0",
"vimeo/psalm": "^4.15"
}, },
"config": { "config": {
"bin-dir": "bin", "bin-dir": "bin",
"sort-packages": true,
"vendor-dir": "tests/app/vendor" "vendor-dir": "tests/app/vendor"
}, },
"autoload": { "autoload": {

View File

@ -12,3 +12,28 @@ parameters:
tasks.phpcsfixer.allow_risky: true tasks.phpcsfixer.allow_risky: true
tasks.phpcsfixer.diff: true tasks.phpcsfixer.diff: true
tasks.phpstan.level: 1 tasks.phpstan.level: 1
tasks.phpstan.blocking: true
tasks.phpstan.ignore_patterns:
- "/.github/"
- "/.idea/"
- "/build/"
- "/benchmarks/"
- "/docs/"
- "/node_modules/"
- "/resource/"
- "/spec/"
- "/var/"
- "/vendor/"
# Psalm
tasks.psalm.blocking: true
tasks.psalm.ignore_patterns:
- "/.github/"
- "/.idea/"
- "/build/"
- "/benchmarks/"
- "/node_modules/"
- "/resource/"
- "/spec/"
- "/var/"
- "/vendor/"

2162
psalm-baseline.xml Normal file

File diff suppressed because it is too large Load Diff

16
psalm.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config tests/app/vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="./tests/" />
</ignoreFiles>
</projectFiles>
</psalm>

View File

@ -35,11 +35,12 @@ interface ResponderInterface
/** /**
* Returns a JsonResponse that uses the serializer component if enabled, or json_encode. * Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
* *
* @param mixed $data
* @param array<string, list<string>|string> $headers * @param array<string, list<string>|string> $headers
* @param array<string, mixed> $context * @param array<string, mixed> $context
*/ */
public function json( public function json(
mixed $data, $data,
int $status = 200, int $status = 200,
array $headers = [], array $headers = [],
array $context = [] array $context = []