ergebnis/rector-rules
A curated set of custom Rector rules from ergebnis to automate PHP refactoring and style consistency. Includes rules for sorting arrays and match arms, simplifying call arguments, Faker updates, namespace symbol references, and PHPUnit attribute-to-prefix changes.
Expressions\Arrays\SortAssociativeArrayByKeyRectorSorts associative arrays by key.
comparison_functionThe comparison function to use for sorting keys.
string'strcasecmp', 'strcmp', 'strnatcasecmp', 'strnatcmp''strcmp'directionThe sorting direction.
string'asc', 'desc''asc' $data = [
+ 'bar' => [
+ 'quux' => 'quuz',
+ 'quz' => 'qux',
+ ],
'foo' => [
'foo',
'bar',
'baz',
- ],
- 'bar' => [
- 'quz' => 'qux',
- 'quux' => 'quuz',
],
];
Configuration:
direction: 'desc' $data = [
- 'bar' => [
- 'quux' => 'quuz',
- 'quz' => 'qux',
- ],
'foo' => [
'foo',
'bar',
'baz',
+ ],
+ 'bar' => [
+ 'quz' => 'qux',
+ 'quux' => 'quuz',
],
];
Configuration:
comparison_function: 'strcasecmp' $data = [
+ 'Quux' => 'quuz',
+ 'quux' => 'quuz',
'Quz' => 'qux',
'QuZ' => 'qux',
'quz' => 'qux',
- 'Quux' => 'quuz',
- 'quux' => 'quuz',
];
Configuration:
comparison_function: 'strnatcmp' $data = [
+ 'Quux' => 'quuz',
+ 'Quz' => 'qux',
+ 'Quz2' => 'qux',
'Quz10' => 'qux',
- 'Quz2' => 'qux',
- 'Quz' => 'qux',
- 'Quux' => 'quuz',
];
Configuration:
comparison_function: 'strnatcasecmp' $data = [
- 'Quz10' => 'qux',
- 'Quz2' => 'qux',
+ 'Quux' => 'quuz',
+ 'quux' => 'quuz',
'Quz' => 'qux',
'QuZ' => 'qux',
'quz' => 'qux',
- 'Quux' => 'quuz',
- 'quux' => 'quuz',
+ 'Quz2' => 'qux',
+ 'Quz10' => 'qux',
];
How can I help you explore Laravel packages today?