Skip to content

Commit 3c286ce

Browse files
authored
forbidEnumInFunctionArguments: deny also natcasesort (#197)
1 parent 0512340 commit 3c286ce

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Rule/ForbidEnumInFunctionArgumentsRule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ForbidEnumInFunctionArgumentsRule implements Rule
4545
'asort' => [0, self::REASON_UNPREDICTABLE_RESULT],
4646
'arsort' => [0, self::REASON_UNPREDICTABLE_RESULT],
4747
'natsort' => [0, self::REASON_IMPLICIT_TO_STRING],
48+
'natcasesort' => [0, self::REASON_IMPLICIT_TO_STRING],
4849
'array_count_values' => [0, self::REASON_SKIPS_ENUMS],
4950
'array_fill_keys' => [0, self::REASON_IMPLICIT_TO_STRING],
5051
'array_flip' => [0, self::REASON_SKIPS_ENUMS],

tests/Rule/data/ForbidEnumInFunctionArgumentsRule/code.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function testAllFunctions()
3232
asort($enums1); // error: Argument 1 in asort() cannot contain enum as the function causes unexpected results
3333
arsort($enums1); // error: Argument 1 in arsort() cannot contain enum as the function causes unexpected results
3434
natsort($enums1); // error: Argument 1 in natsort() cannot contain enum as the function causes implicit __toString conversion which is not supported for enums
35+
natcasesort($enums1); // error: Argument 1 in natcasesort() cannot contain enum as the function causes implicit __toString conversion which is not supported for enums
3536
array_count_values($enums1); // error: Argument 1 in array_count_values() cannot contain enum as the function will skip any enums and produce warning
3637
array_fill_keys($enums1, 1); // error: Argument 1 in array_fill_keys() cannot contain enum as the function causes implicit __toString conversion which is not supported for enums
3738
array_flip($enums1); // error: Argument 1 in array_flip() cannot contain enum as the function will skip any enums and produce warning

0 commit comments

Comments
 (0)