moxio/php-codesniffer-sniffs
Custom PHP_CodeSniffer 3.x sniffs from Moxio to catch subtle PHP bugs and unexpected behavior. Provides a standalone ruleset or individual sniffs for other standards, enforcing safer comparisons, strict base64_decode, switch continue rules, and more.
slevomat/coding-standard for stricter PSR rules or custom sniffs).phpcs.xml or Slevomat’s coding-standard.neon), but teams must now decide between one or both frameworks for consistency. Risk of rule duplication if both are used.slevomat/coding-standard (e.g., for stricter PSR-22/PSR-12 enforcement or custom rules).app() helper usage, Facade static calls). Requires thorough testing and configuration tweaks.Classes\ClassLength sniff might misfire on Laravel’s Illuminate\Support\Facades\Facade class.slevomat/coding-standard as a dependency increases composer lock complexity and potential version conflicts.phpcs.xml + coding-standard.neon) or merge them, risking drift.Str:: helper or Route:: macros correctly under Slevomat?phpcs.xml and coding-standard.neon be synchronized to avoid redundancy?- name: Run PHP_CodeSniffer
run: vendor/bin/phpcs --standard=./vendor/moxio/php-codesniffer-sniffs app/
- name: Run Slevomat Coding Standard
run: vendor/bin/ecs check --config=ecs.php src/
phpcs plugin.ecs CLI or IDE plugins (e.g., PHP Inspections for Slevomat).husky to run either phpcs or ecs (not both).laravel-pint (formatting) or pestphp/pest (testing) without redundancy.dealerdirect/phpcodesniffer-composer (Laravel-specific sniffs).phpcs.xml and identify conflicting rules with Slevomat’s defaults.vendor/bin/ecs check --config=ecs.php --fix app/ # Dry run with auto-fix
ecs.php to ignore Laravel-specific patterns (e.g., Facade static calls).ecs.php snippet:
return [
'rules' => [
// Disable rules that conflict with Laravel
\SlevomatCodingStandard\Sniffs\Classes\ClassLengthSniff::class => false,
\SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff::class => [
'max' => 100, // Relax for Laravel controllers
],
],
];
phpcs.xml rules to ecs.php where possible.composer.json):
"require-dev": {
"slevomat/coding-standard": "^8.26.0"
}
symplify/easy-coding-standard).composer why-not to check for version conflicts.CONTRIBUTING.md.phpcs.xml to include new sniffs.ecs.php with Laravel-specific exceptions.- name: Run Slevomat Coding Standard
run: vendor/bin/ecs check --config=ecs.php --parallel=4 app/
--parallel to reduce runtime.How can I help you explore Laravel packages today?