ang3/php-dev-binaries

PHP project binaries for developers

v2.0.0 2023-01-30 16:40 UTC

This package is auto-updated.

Last update: 2024-10-29 05:34:59 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads

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.