automattic/phpcs-neutron-standard
Pros:
DisallowLongformArraySniff) reduce manual refactoring effort.TypeHintSniff or RequireStrictTypesSniff).Cons:
array{} syntax or mixed type deprecation).laravel-shift/php-code-style or dealerdirect/phpcodesniffer-composer-installer setups.phpcodesniffer-composer-installer (standardized approach for Laravel projects).phpcs.xml configuration (e.g., combining with PSR12, WordPress, or custom rules).vendor/bin/phpcs.phpcs version to 3.6.x (last tested in v1.7.0) in composer.json.slevomat/coding-standard.RequireStrictTypesSniff may clash with Laravel’s declare(strict_types=1) in bootstrap/app.php. Requires explicit whitelisting in phpcs.xml.DisallowGlobalFunctionsSniff may flag Laravel’s global helpers (e.g., app(), route()). Needs custom exceptions.LongFunctionSniff (configurable via maxFunctionLines) could slow down CI if applied to large codebases. Test with a sample of 10K+ LOC before full adoption.laravel-shift/php-code-style or similar? Overlap may reduce value.phpstan/extension-installer for static analysis) that cover modern PHP better?pint, phpstan)?PSR12) for WordPress/Laravel hybrid apps.slevomat/coding-standard).app/Http/Controllers) with:
vendor/bin/phpcs --standard=NeutronStandard --report=full src/
composer.json (dev dependency):
composer require --dev automattic/phpcs-neutron-standard dealerdirect/phpcodesniffer-composer-installer
phpcs.xml:
<ruleset>
<rule ref="NeutronStandard">
<exclude name="DisallowGlobalFunctionsSniff" /> <!-- Example exception -->
<arg name="maxFunctionLines" value="50" /> <!-- Customize LongFunctionSniff -->
</rule>
<rule ref="PSR12" /> <!-- Combine with existing standards -->
</ruleset>
- name: Run PHPCS
run: vendor/bin/phpcs --standard=NeutronStandard --warning-severity=9 src/
--warning-severity=9) to avoid blocking PRs.RequireStrictTypesSniff globally).phpcs/phpcs:^3.6 to avoid breaking changes..blade.php files in phpcs.xml:
<file>*.php</file>
<exclude-pattern>*.blade.php</exclude-pattern>
app(), route().Settings > PHP > Quality Tools).phpcs is installed (composer require --dev squizlabs/php_codesniffer).NeutronStandard alongside existing rules (e.g., PSR12).phpcs.xml (exclude/override as needed).maxFunctionLines).array{}) may need manual additions.CHANGELOG.md to track local modifications.--severity flags) aid debugging.app() helper).--parallelHow can I help you explore Laravel packages today?