php-cs-fixer or standalone) ensures minimal architectural disruption.DisallowNullSafeObjectOperator) may conflict with Laravel’s dynamic property access (e.g., $request->input()). Requires custom configuration or exclusions.DisallowNullSafeObjectOperator if Laravel’s dynamic features are critical.phpcs --cache)?Arrays.TrailingArrayComma)?nullsafe in service containers).phpcs with all sniffs to identify violations.Arrays.TrailingArrayComma).Classes.DisallowConstructorPropertyPromotion).husky + simple-phpunit).--cache) for CI speed.--parallel) for large codebases.slevomat/coding-standard and php-cs-fixer versions are compatible.PHP_CodeSniffer (e.g., squizlabs/php_codesniffer:^3.7).composer require --dev slevomat/coding-standard
vendor/bin/phpcs --standard=SlevomatCodingStandard run src/
.php-cs-fixer.dist.php to exclude conflicting sniffs.return (new PhpCsFixer\Config())
->setRules([
'@SlevomatCodingStandard' => true,
'SlevomatCodingStandard.ControlStructures.DisallowNullSafeObjectOperator' => false,
]);
.github/workflows/php.yml:
- name: Run Slevomat Coding Standard
run: vendor/bin/phpcs --standard=SlevomatCodingStandard --error-severity=3 src/
slevomat/coding-standard for breaking changes (e.g., PHP 8.2+ features).PHP_CodeSniffer or php-cs-fixer.nullsafe allowed in AppServiceProvider?").Arrays.TrailingArrayComma).SUPPORT.md).Classes.ClassLength for legacy monolithic classes.phpcs --parallel --standard=SlevomatCodingStandard src/Tests/ src/App/).--cache to avoid reprocessing unchanged files.vendor/ and storage/ paths.app/ directory, expand to modules.| Failure Type | Impact | Mitigation |
|---|---|---|
| CI Blockage | Build failures on violations. | Treat as warnings initially; fix incrementally. |
| False Positives | Legitimate code flagged. | Whitelist files/directories. |
| Performance Bottleneck | CI timeout on large codebase. | Cache results; parallel execution. |
| Toolchain Conflict | Sniffs conflict with php-cs-fixer. |
Disable overlapping rules. |
| Auto-Fix Overreach | Unintended code changes. | Review auto-fix diffs before merging. |
Classes.ClassLength if unused).How can I help you explore Laravel packages today?