Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion packages/php-linting-rules/configs/ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
->withConfiguredRule(SlevomatCodingStandard\Sniffs\Classes\EnumCaseSpacingSniff::class, ['minLinesCountBeforeWithComment' => 1, 'maxLinesCountBeforeWithComment' => 1, 'minLinesCountBeforeWithoutComment' => 0, 'maxLinesCountBeforeWithoutComment' => 0])
->withConfiguredRule(SlevomatCodingStandard\Sniffs\Classes\MethodSpacingSniff::class, ['minLinesCount' => 1, 'maxLinesCount' => 1])
->withConfiguredRule(SlevomatCodingStandard\Sniffs\Classes\ParentCallSpacingSniff::class, ['linesCountBefore' => 0, 'linesCountAfter' => 1])
->withConfiguredRule(SlevomatCodingStandard\Sniffs\Classes\PropertySpacingSniff::class, ['minLinesCountBeforeWithComment' => 1, 'maxLinesCountBeforeWithComment' => 1, 'minLinesCountBeforeWithoutComment' => 0, 'maxLinesCountBeforeWithoutComment' => 0])
->withConfiguredRule(SlevomatCodingStandard\Sniffs\Classes\PropertySpacingSniff::class, ['minLinesCountBeforeWithComment' => 1, 'maxLinesCountBeforeWithComment' => 1, 'minLinesCountBeforeWithoutComment' => 1, 'maxLinesCountBeforeWithoutComment' => 1])
->withConfiguredRule(SlevomatCodingStandard\Sniffs\Classes\TraitUseSpacingSniff::class, ['linesCountBeforeFirstUse' => 0, 'linesCountBeforeFirstUseWhenFirstInClass' => 0, 'linesCountBetweenUses' => 0, 'linesCountAfterLastUse' => 1, 'linesCountAfterLastUseWhenLastInClass' => 1])
->withConfiguredRule(SlevomatCodingStandard\Sniffs\Commenting\DocCommentSpacingSniff::class, ['linesCountBeforeFirstContent' => 0, 'linesCountBetweenDescriptionAndAnnotations' => 1, 'linesCountBetweenDifferentAnnotationsTypes' => 0, 'linesCountAfterLastContent' => 0])
->withConfiguredRule(SlevomatCodingStandard\Sniffs\ControlStructures\BlockControlStructureSpacingSniff::class, ['linesCountBefore' => 1, 'linesCountBeforeFirst' => 1, 'linesCountAfter' => 1, 'linesCountAfterLast' => 1, 'controlStructures' => ['if', 'switch', 'for', 'foreach', 'while', 'do']])
Expand Down Expand Up @@ -327,4 +327,29 @@
SlevomatCodingStandard\Sniffs\Variables\DisallowSuperGlobalVariableSniff::class,
SlevomatCodingStandard\Sniffs\Variables\DuplicateAssignmentToVariableSniff::class,
SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff::class,
])
->withSkip([
PhpCsFixer\Fixer\AttributeNotation\OrderedAttributesFixer::class => [
getcwd() . '/app/Data',
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using getcwd() for path construction is fragile and assumes the command is always run from a specific directory. Consider using __DIR__ or a more reliable base path resolution mechanism to ensure paths work correctly regardless of where the command is executed from.

Copilot uses AI. Check for mistakes.
],
SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff::class => [
getcwd() . '/app/Models',
getcwd() . '/app/Policies',
getcwd() . '/app/Repositories/QuerySorts',
getcwd() . '/app/Scopes',
getcwd() . '/app/Traits',
getcwd() . '/app/Data/Casts',
Comment on lines +335 to +341
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Skipping UnusedParameterSniff for so many directories (7 different paths) may hide genuine code quality issues. Consider addressing unused parameters in these locations or documenting why these specific directories require this exception.

Suggested change
SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff::class => [
getcwd() . '/app/Models',
getcwd() . '/app/Policies',
getcwd() . '/app/Repositories/QuerySorts',
getcwd() . '/app/Scopes',
getcwd() . '/app/Traits',
getcwd() . '/app/Data/Casts',
SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff::class => [
// Models: Often must implement framework interfaces with unused parameters.
getcwd() . '/app/Models',
// Policies: Method signatures required by Laravel, may have unused parameters.
getcwd() . '/app/Policies',
// QuerySorts: Custom sorting interfaces may require unused parameters.
getcwd() . '/app/Repositories/QuerySorts',
// Scopes: Laravel scopes require specific method signatures.
getcwd() . '/app/Scopes',
// Traits: Traits must match interface signatures, may have unused parameters.
getcwd() . '/app/Traits',
// Data Casts: Custom cast classes may require unused parameters for interface compliance.
getcwd() . '/app/Data/Casts',
// Providers: Service providers may have unused parameters for compatibility.

Copilot uses AI. Check for mistakes.
getcwd() . '/app/Providers',
],
SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff::class => [
getcwd() . '/app/Console/Commands',
getcwd() . '/app/Models',
],
SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff::class => [
getcwd() . '/app/Data/Casts',
getcwd() . '/app/Models/User/User.php',
],
SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff::class => [
getcwd() . '/app/Models/User/User.php',
],
]);