This package provides useful binaries so as to check the code of your project. It uses phpstan/phpstan for code analysis and friendsofphp/php-cs-fixer to fix code.
This package should be installed globally.
Open a command console, enter your project directory and execute the following command to download the latest stable version of this package:
$ composer global require ang3/php-dev-binaries --dev
Finally, do not forget to add the composer bin folder to your environment variable PATH
.
In your project directory:
$ dev_check_code.sh <phpstan_level>
phpstan_level
the level (lower: 1 - Higher: 9) [default:9
]
Create the file phpstan.neon
at the root of your project:
parameters:
inferPrivatePropertyTypeFromConstructor: true
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
paths:
- %currentWorkingDirectory%/src
If the env
is neither empty nor equal to src
,
then the config file must be named following the naming convention: phpstan.<env>.neon
.
In your project directory:
$ dev_fix_code.sh <sources_dir>
sources_dir
is the relative path of the folder to analyze [default:src
]
For Symfony applications, install the package ang3/symfony-scripts.