diff --git a/rules-tests/CodeQuality/Rector/StmtsAwareInterface/MoveInnerFunctionToTopLevelRector/Fixture/skip_redefine_native_function.php.inc b/rules-tests/CodeQuality/Rector/StmtsAwareInterface/MoveInnerFunctionToTopLevelRector/Fixture/skip_redefine_native_function.php.inc new file mode 100644 index 00000000000..b998f9c2b88 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/StmtsAwareInterface/MoveInnerFunctionToTopLevelRector/Fixture/skip_redefine_native_function.php.inc @@ -0,0 +1,20 @@ +name->toString()); foreach ($siblingStmts as $siblingStmt) { if (! $siblingStmt instanceof Function_) { continue; @@ -134,6 +144,13 @@ private function hasSiblingFunctionOfSameName(Function_ $innerFunction, array $s if ($this->nodeNameResolver->areNamesEqual($siblingStmt, $innerFunction)) { return true; } + + if ($this->reflectionProvider->hasFunction($innerFunctionName, null)) { + $functionReflection = $this->reflectionProvider->getFunction($innerFunctionName, null); + if ($functionReflection instanceof NativeFunctionReflection) { + return true; + } + } } return false;