ang3 / php-dev-binaries
PHP project binaries for developers
Installs: 684
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Type:binary
Requires
- php: >=8.1
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.0
- phpstan/phpstan-doctrine: ^1.0
- phpstan/phpstan-symfony: ^1.0
README
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.
Summary
Installation
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
.
Usage
PHP development
Check code
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
.
Fix code
In your project directory:
$ dev_fix_code.sh <sources_dir>
sources_dir
is the relative path of the folder to analyze [default:src
]
Symfony
For Symfony applications, install the package ang3/symfony-scripts.