Skip to content

Commit e9abe34

Browse files
committed
minor #286 [PHP-CS-Fixer] Add ordered_class_elements rule (OskarStark)
This PR was merged into the main branch. Discussion ---------- [PHP-CS-Fixer] Add `ordered_class_elements` rule | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | -- | License | MIT The ``@Symfony`` ruleset doesn't enforce method ordering by default. Added explicit configuration to ensure public methods come before private methods, along with proper ordering for all class elements. Commits ------- 2f06497 Add ordered_class_elements rule to PHP-CS-Fixer config
2 parents 01614e0 + 2f06497 commit e9abe34

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.php-cs-fixer.dist.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,25 @@
3939
'header' => implode('', $fileHeaderParts),
4040
],
4141
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
42+
'ordered_class_elements' => [
43+
'order' => [
44+
'use_trait',
45+
'case',
46+
'constant_public',
47+
'constant_protected',
48+
'constant_private',
49+
'property_public',
50+
'property_protected',
51+
'property_private',
52+
'construct',
53+
'destruct',
54+
'magic',
55+
'phpunit',
56+
'method_public',
57+
'method_protected',
58+
'method_private',
59+
],
60+
],
4261
])
4362
->setRiskyAllowed(true)
4463
->setFinder(

0 commit comments

Comments
 (0)