signpostmarv/php-cs-fixer-config

PHP-CS-Fixer Config

v0.11.0 2019-07-12 21:00 UTC

README

Scrutinizer Code Quality Build Status

There's two different versions, one for general use & one for use on projects that use phpstan for static analysis

Installation & Usage

  1. composer require --dev signpostmarv/php-cs-fixer-config
  2. create your .php_cs or .php_cs.dist file and enter the corresponding code for the config you wish to use

General Use

return \SignpostMarv\CS\Config::createWithPaths(
	__FILE__,
	(__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR),
	(__DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR)
)

Use without PHP 7.1 Nullable return types

return \SignpostMarv\CS\ConfigUsedWithoutNullableReturn::createWithPaths(
	__FILE__,
	(__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR),
	(__DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR)
)

With PHPStan

return \SignpostMarv\CS\ConfigUsedWithPhpstan::createWithPaths(
	__FILE__,
	(__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR),
	(__DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR)
)

Use without PHP 7.1 Nullable return types

return \SignpostMarv\CS\ConfigUsedWithPhpstanWithoutNullableReturn::createWithPaths(
	__FILE__,
	(__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR),
	(__DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR)
)

Customising Rules

  1. Extend SignpostMarv\CS\Config
  2. Either
    • override the SignpostMarv\CS\Config::DEFAULT_RULES array const
    • override the SignpostMarv\CS\Config::RuntimeResolveRules() static method as in ConfigUsedWithPhpstan