Skip to content

Commit

Permalink
Feat: Enable all aliases in NoAliasFunctionsFixer (part of #94)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed May 23, 2024
1 parent cc54000 commit 139faea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@
ArrayPushFixer::class,
// Replace non multibyte-safe functions with corresponding mb function
MbStrFunctionsFixer::class,
// Master functions shall be used instead of aliases
NoAliasFunctionsFixer::class,
// Replaces `rand`, `srand`, `getrandmax` functions calls with their `mt_*` analogs
RandomApiMigrationFixer::class,
// Cast shall be used, not `settype()`
Expand Down Expand Up @@ -458,6 +456,8 @@
'var_dump' => null,
],
])
// Master functions shall be used instead of aliases
->withConfiguredRule(NoAliasFunctionsFixer::class, ['sets' => ['@all']])
// There should be exactly one blank line before a namespace declaration.
->withConfiguredRule(BlankLinesBeforeNamespaceFixer::class, ['min_line_breaks' => 2, 'max_line_breaks' => 2])
// Proper operator spacing
Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/Fixtures/Basic.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ class Basic
* Phpdoc used instead of plain comment
*/
if ($foo === 'bar') {
$baz = 'bat';
// NoAliasFunctionsFixer
$baz = implode(',', ['foo', 'bar']);
}

// TernaryToElvisOperatorFixer
return ($foo ?: 'not true');
}
Expand Down
4 changes: 3 additions & 1 deletion tests/Integration/Fixtures/Basic.wrong.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ class Basic
* Phpdoc used instead of plain comment
*/
if ($foo === 'bar') {
$baz = 'bat';
// NoAliasFunctionsFixer
$baz = join(',', ['foo', 'bar']);
}

// TernaryToElvisOperatorFixer
return ($foo ? $foo : 'not true');
}
Expand Down

0 comments on commit 139faea

Please sign in to comment.