Search by

noldors / phpcsfixer-rules

noldors

Shared PHP-CS-Fixer preset and multiline layout rules.

Package info

github.com/noldor/phpcsfixer-rules

pkg:composer/noldors/phpcsfixer-rules

Statistics

Installs: 33

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0


README

One reusable PHP-CS-Fixer configuration containing the complete captured Pint profile: all 270 native rule entries, four layout rules and a function-to-pipe rule, for 275 entries in total. Anonymous function bodies use multiple lines. Custom wrapping defaults to 120 columns, at most three inline method arguments and a separate 40-character limit for a single argument. These are wrapping thresholds, not a universal hard line limit.

Requires PHP >=8.5, ext-mbstring and PHP-CS-Fixer ^3.95.25 (>=3.95.25, <4.0).

Installation

composer require --dev noldors/phpcsfixer-rules

Connection

Create or update the project's .php-cs-fixer.dist.php:

<?php

return Noldors\PhpCsFixer\Config::create(__DIR__);

The factory registers the five custom fixers through the supported custom-fixer API, enables the complete preset and allows its risky native rules, matching Pint's configuration. Native indentation or spacing changes can require another formatting run before the dry-run check passes. Its finder scans PHP files under the supplied project root and excludes vendor, node_modules, build, storage and bootstrap/cache directories, Blade templates and standard generated PHP IDE helper files.

The returned Config extends the native PHP-CS-Fixer configuration, supporting its finder and option methods. Use Config::rules() as the base for deliberate rule overrides through setRules(). See the migration guide for examples, preset provenance and version support.

vendor/bin/php-cs-fixer fix
vendor/bin/php-cs-fixer fix --dry-run --diff

Rule documentation

Long arrays used directly as a foreach iterable still require a meaningful local variable chosen during code review; the formatters do not extract one.