diff --git a/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php b/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php index 8fa27e47277..5cb1ccf9d21 100644 --- a/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php +++ b/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php @@ -153,7 +153,11 @@ public function refactorWithScope(Node $node, Scope $scope): ?Node return null; } - if (str_contains($uppercasedConstantName, '\\')) { + if ( + str_contains($uppercasedConstantName, '\\') + || str_contains($uppercasedConstantName, '(') + || str_contains($uppercasedConstantName, "'") + ) { return null; } diff --git a/tests/Issues/EmptyLongArraySyntax/EmptyLongArraySyntaxTest.php b/tests/Issues/EmptyLongArraySyntax/EmptyLongArraySyntaxTest.php new file mode 100644 index 00000000000..706b3d9b9c1 --- /dev/null +++ b/tests/Issues/EmptyLongArraySyntax/EmptyLongArraySyntaxTest.php @@ -0,0 +1,28 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/Issues/EmptyLongArraySyntax/Fixture/empty_long_array.php.inc b/tests/Issues/EmptyLongArraySyntax/Fixture/empty_long_array.php.inc new file mode 100644 index 00000000000..8ea4e282189 --- /dev/null +++ b/tests/Issues/EmptyLongArraySyntax/Fixture/empty_long_array.php.inc @@ -0,0 +1,33 @@ + +----- + diff --git a/tests/Issues/EmptyLongArraySyntax/Source/ParentWithEmptyLongArray.php b/tests/Issues/EmptyLongArraySyntax/Source/ParentWithEmptyLongArray.php new file mode 100644 index 00000000000..64e93c450d8 --- /dev/null +++ b/tests/Issues/EmptyLongArraySyntax/Source/ParentWithEmptyLongArray.php @@ -0,0 +1,12 @@ +rules([ + SensitiveConstantNameRector::class, + AddParamBasedOnParentClassMethodRector::class, + ]); +};