PSalm
Psalm can fix some error, so let’s start with vendor/bin/psalm.phar --init
and then vendor/bin/psalm.phar src/
to check errors and if it say that can solve any. It will show something like:
Psalm can automatically fix 7 of these issues. ` what you should type to fix)
Run Psalm again with
--alter --issues=InvalidReturnType,MissingReturnType,MissingClosureReturnType --dry-run
Note: Do the same for tests folder and plugins src
and tests
.
Fixing manual errors
The easy way to fix is going from model to controller namespace, and work on one namespace at a time.
vendor/bin/psalm.phar --show-info=false src/Model/Entity
vendor/bin/psalm.phar --show-info=false src/Model/Behavior
vendor/bin/psalm.phar --show-info=false src/Model/Table
vendor/bin/psalm.phar --show-info=false src/Model
vendor/bin/psalm.phar --show-info=false src/View
vendor/bin/psalm.phar --show-info=false src/Shell
vendor/bin/psalm.phar --show-info=false src/Service
vendor/bin/psalm.phar --show-info=false src/Controller
vendor/bin/psalm.phar --show-info=false src/[Any big namespace]
vendor/bin/psalm.phar --show-info=false src
vendor/bin/psalm.phar --show-info=false tests/
At the end we can ignore the invalid errors with composer psalm-rebuild-baseline