Browse Source

mb_*: rely on ReflectionFunction::isInternal to detect correct list of functions to fix

Filippo Tessarotto 5 years ago
parent
commit
083d062050

+ 1 - 1
src/Fixer/Alias/MbStrFunctionsFixer.php

@@ -55,7 +55,7 @@ final class MbStrFunctionsFixer extends AbstractFunctionReferenceFixer
         $this->functions = array_filter(
             self::$functionsMap,
             static function (array $mapping) {
-                return \function_exists($mapping['alternativeName']);
+                return \function_exists($mapping['alternativeName']) && (new \ReflectionFunction($mapping['alternativeName']))->isInternal();
             }
         );
     }

+ 1 - 1
tests/Fixer/Alias/MbStrFunctionsFixerTest.php

@@ -63,7 +63,7 @@ final class MbStrFunctionsFixerTest extends AbstractFixerTestCase
             ],
         ];
 
-        if (\function_exists('mb_str_split')) {
+        if (\PHP_VERSION_ID >= 70400) {
             $cases[] = [
                 '<?php $a = mb_str_split($a);',
                 '<?php $a = str_split($a);',