Updated Rector to commit e2213f21762d74946a34197921aa905623493e8c

e2213f2176 Remove unused addNodeAfterNode(), return nodes instead (#4023)
This commit is contained in:
Tomas Votruba 2023-05-30 08:16:08 +00:00
parent 305fa5edd6
commit 672d7d7dfe
11 changed files with 92 additions and 199 deletions

View File

@ -21,10 +21,6 @@ use Rector\PostRector\Contract\Collector\NodeCollectorInterface;
*/
final class NodesToAddCollector implements NodeCollectorInterface
{
/**
* @var Stmt[][]
*/
private $nodesToAddAfter = [];
/**
* @var Stmt[][]
*/
@ -58,7 +54,7 @@ final class NodesToAddCollector implements NodeCollectorInterface
}
public function isActive() : bool
{
return $this->nodesToAddAfter !== [] || $this->nodesToAddBefore !== [];
return $this->nodesToAddBefore !== [];
}
/**
* @deprecated
@ -77,33 +73,6 @@ final class NodesToAddCollector implements NodeCollectorInterface
$this->nodesToAddBefore[$position][] = $this->wrapToExpression($addedNode);
$this->rectorChangeCollector->notifyNodeFileInfo($positionNode);
}
/**
* @api Used in downgrade still
* @deprecated
* Better return created nodes right in refactor() method to keep context
* @internal
*/
public function addNodeAfterNode(Node $addedNode, Node $positionNode) : void
{
if ($positionNode->getAttributes() === []) {
$message = \sprintf('Switch arguments in "%s()" method', __METHOD__);
throw new ShouldNotHappenException($message);
}
/** @var MutatingScope|null $currentScope */
$currentScope = $positionNode->getAttribute(AttributeKey::SCOPE);
$this->changedNodeScopeRefresher->refresh($addedNode, $currentScope);
$position = $this->resolveNearestStmtPosition($positionNode);
$this->nodesToAddAfter[$position][] = $this->wrapToExpression($addedNode);
$this->rectorChangeCollector->notifyNodeFileInfo($positionNode);
}
/**
* @return Stmt[]
*/
public function getNodesToAddAfterNode(Node $node) : array
{
$position = \spl_object_hash($node);
return $this->nodesToAddAfter[$position] ?? [];
}
/**
* @return Stmt[]
*/
@ -112,11 +81,6 @@ final class NodesToAddCollector implements NodeCollectorInterface
$position = \spl_object_hash($node);
return $this->nodesToAddBefore[$position] ?? [];
}
public function clearNodesToAddAfter(Node $node) : void
{
$objectHash = \spl_object_hash($node);
unset($this->nodesToAddAfter[$objectHash]);
}
public function clearNodesToAddBefore(Node $node) : void
{
$objectHash = \spl_object_hash($node);

View File

@ -39,11 +39,6 @@ final class NodeAddingPostRector extends \Rector\PostRector\Rector\AbstractPostR
public function leaveNode(Node $node)
{
$newNodes = [$node];
$nodesToAddAfter = $this->nodesToAddCollector->getNodesToAddAfterNode($node);
if ($nodesToAddAfter !== []) {
$this->nodesToAddCollector->clearNodesToAddAfter($node);
$newNodes = \array_merge($newNodes, $nodesToAddAfter);
}
$nodesToAddBefore = $this->nodesToAddCollector->getNodesToAddBeforeNode($node);
if ($nodesToAddBefore !== []) {
$this->nodesToAddCollector->clearNodesToAddBefore($node);

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b97fe194b45a7915fd1509b9388315f49582cb2c';
public const PACKAGE_VERSION = 'e2213f21762d74946a34197921aa905623493e8c';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-05-30 06:37:11';
public const RELEASE_DATE = '2023-05-30 08:12:20';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInita406c5a664fc202b96dadc80d66fa52f::getLoader();
return ComposerAutoloaderInit882df8cd00b7c93090d92e3ac8015b28::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInita406c5a664fc202b96dadc80d66fa52f
class ComposerAutoloaderInit882df8cd00b7c93090d92e3ac8015b28
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInita406c5a664fc202b96dadc80d66fa52f
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInita406c5a664fc202b96dadc80d66fa52f', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit882df8cd00b7c93090d92e3ac8015b28', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInita406c5a664fc202b96dadc80d66fa52f', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit882df8cd00b7c93090d92e3ac8015b28', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInita406c5a664fc202b96dadc80d66fa52f::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit882df8cd00b7c93090d92e3ac8015b28::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInita406c5a664fc202b96dadc80d66fa52f::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit882df8cd00b7c93090d92e3ac8015b28::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInita406c5a664fc202b96dadc80d66fa52f
class ComposerStaticInit882df8cd00b7c93090d92e3ac8015b28
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3084,9 +3084,9 @@ class ComposerStaticInita406c5a664fc202b96dadc80d66fa52f
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInita406c5a664fc202b96dadc80d66fa52f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita406c5a664fc202b96dadc80d66fa52f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita406c5a664fc202b96dadc80d66fa52f::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit882df8cd00b7c93090d92e3ac8015b28::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit882df8cd00b7c93090d92e3ac8015b28::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit882df8cd00b7c93090d92e3ac8015b28::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1920,12 +1920,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "11fecf80d107fb16c81283650c2a399b159f101c"
"reference": "5803556b0c7a21e1cc997fc3e84883aec017aa20"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/11fecf80d107fb16c81283650c2a399b159f101c",
"reference": "11fecf80d107fb16c81283650c2a399b159f101c",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/5803556b0c7a21e1cc997fc3e84883aec017aa20",
"reference": "5803556b0c7a21e1cc997fc3e84883aec017aa20",
"shasum": ""
},
"require": {
@ -1949,7 +1949,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-05-29T21:34:47+00:00",
"time": "2023-05-30T07:47:53+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7f0656f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 11fecf8'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e276dee'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2348d4f'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7f0656f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5803556'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e276dee'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2348d4f'));
private function __construct()
{
}

View File

@ -3,16 +3,11 @@
declare (strict_types=1);
namespace Rector\DowngradePhp72\NodeAnalyzer;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Expr\Variable;
use Rector\Core\PhpParser\Comparing\NodeComparator;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use PHPStan\Analyser\Scope;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
final class RegexFuncAnalyzer
{
/**
@ -24,66 +19,27 @@ final class RegexFuncAnalyzer
* @var \Rector\NodeNameResolver\NodeNameResolver
*/
private $nodeNameResolver;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
*/
private $betterNodeFinder;
/**
* @readonly
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
*/
private $nodeComparator;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
*/
private $valueResolver;
public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, ValueResolver $valueResolver)
public function __construct(NodeNameResolver $nodeNameResolver)
{
$this->nodeNameResolver = $nodeNameResolver;
$this->betterNodeFinder = $betterNodeFinder;
$this->nodeComparator = $nodeComparator;
$this->valueResolver = $valueResolver;
}
public function isRegexFunctionNames(FuncCall $funcCall) : bool
public function matchRegexFuncCall(FuncCall $funcCall) : ?FuncCall
{
if ($this->nodeNameResolver->isNames($funcCall, self::REGEX_FUNCTION_NAMES)) {
return \true;
return $funcCall;
}
$variable = $funcCall->name;
if (!$variable instanceof Variable) {
return \false;
return null;
}
/** @var Assign|null $assignExprVariable */
$assignExprVariable = $this->betterNodeFinder->findFirstPrevious($funcCall, function (Node $node) use($variable) : bool {
if (!$node instanceof Assign) {
return \false;
}
return $this->nodeComparator->areNodesEqual($node->var, $variable);
});
if (!$assignExprVariable instanceof Assign) {
return \false;
}
$expr = $assignExprVariable->expr;
if (!$expr instanceof Ternary) {
return \false;
}
if (!$expr->if instanceof Expr) {
return \false;
}
return $this->hasPregMatchFunction($expr);
}
private function hasPregMatchFunction(Ternary $ternary) : bool
{
foreach (self::REGEX_FUNCTION_NAMES as $regexFunctionName) {
if ($ternary->if instanceof Expr && $this->valueResolver->isValue($ternary->if, $regexFunctionName)) {
return \true;
}
if ($this->valueResolver->isValue($ternary->else, $regexFunctionName)) {
return \true;
/** @var Scope $scope */
$scope = $funcCall->getAttribute(AttributeKey::SCOPE);
$variableType = $scope->getType($variable);
foreach ($variableType->getConstantStrings() as $constantStringType) {
if (\in_array($constantStringType->getValue(), self::REGEX_FUNCTION_NAMES, \true)) {
return $funcCall;
}
}
return \false;
return null;
}
}

View File

@ -3,7 +3,6 @@
declare (strict_types=1);
namespace Rector\DowngradePhp72\Rector\FuncCall;
use RectorPrefix202305\Nette\NotImplementedException;
use PhpParser\Node;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp\BitwiseOr;
@ -16,16 +15,14 @@ use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Param;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
use Rector\Core\Exception\NotImplementedYetException;
use Rector\Core\NodeManipulator\IfManipulator;
use Rector\Core\Rector\AbstractRector;
use Rector\DowngradePhp72\NodeAnalyzer\RegexFuncAnalyzer;
use Rector\DowngradePhp72\NodeManipulator\BitwiseFlagCleaner;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\PostRector\Collector\NodesToAddCollector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -53,59 +50,55 @@ final class DowngradePregUnmatchedAsNullConstantRector extends AbstractRector
* @var \Rector\DowngradePhp72\NodeAnalyzer\RegexFuncAnalyzer
*/
private $regexFuncAnalyzer;
/**
* @readonly
* @var \Rector\PostRector\Collector\NodesToAddCollector
*/
private $nodesToAddCollector;
public function __construct(IfManipulator $ifManipulator, BitwiseFlagCleaner $bitwiseFlagCleaner, RegexFuncAnalyzer $regexFuncAnalyzer, NodesToAddCollector $nodesToAddCollector)
public function __construct(IfManipulator $ifManipulator, BitwiseFlagCleaner $bitwiseFlagCleaner, RegexFuncAnalyzer $regexFuncAnalyzer)
{
$this->ifManipulator = $ifManipulator;
$this->bitwiseFlagCleaner = $bitwiseFlagCleaner;
$this->regexFuncAnalyzer = $regexFuncAnalyzer;
$this->nodesToAddCollector = $nodesToAddCollector;
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes() : array
{
return [FuncCall::class, ClassConst::class];
return [Expression::class, ClassConst::class, If_::class];
}
/**
* @param FuncCall|ClassConst $node
* @param Expression|ClassConst|If_ $node
*/
public function refactor(Node $node) : ?Node
public function refactor(Node $node)
{
if ($node instanceof ClassConst) {
return $this->refactorClassConst($node);
}
if (!$this->regexFuncAnalyzer->isRegexFunctionNames($node)) {
$funcCall = $this->matchRegexFuncCall($node);
if (!$funcCall instanceof FuncCall) {
return null;
}
$args = $funcCall->getArgs();
$variable = $args[2]->value;
if (!$variable instanceof Variable) {
return null;
}
$args = $node->getArgs();
if (!isset($args[3])) {
return null;
}
$flags = $args[3]->value;
/** @var Variable $variable */
$variable = $args[2]->value;
if ($flags instanceof BitwiseOr) {
$this->bitwiseFlagCleaner->cleanFuncCall($node, $flags, self::UNMATCHED_NULL_FLAG, null);
if (!$this->nodeComparator->areNodesEqual($flags, $args[3]->value)) {
return $this->handleEmptyStringToNullMatch($node, $variable);
$flagsExpr = $args[3]->value;
if ($flagsExpr instanceof BitwiseOr) {
$this->bitwiseFlagCleaner->cleanFuncCall($funcCall, $flagsExpr, self::UNMATCHED_NULL_FLAG, null);
if ($this->nodeComparator->areNodesEqual($flagsExpr, $args[3]->value)) {
return null;
}
return $this->handleEmptyStringToNullMatch($funcCall, $variable, $node);
}
if (!$flagsExpr instanceof ConstFetch) {
return null;
}
if (!$flags instanceof ConstFetch) {
if (!$this->isName($flagsExpr, self::UNMATCHED_NULL_FLAG)) {
return null;
}
if (!$this->isName($flags, self::UNMATCHED_NULL_FLAG)) {
return null;
}
$node = $this->handleEmptyStringToNullMatch($node, $variable);
unset($node->args[3]);
return $node;
unset($funcCall->args[3]);
return $this->handleEmptyStringToNullMatch($funcCall, $variable, $node);
}
public function getRuleDefinition() : RuleDefinition
{
@ -124,6 +117,7 @@ class SomeClass
public function run()
{
preg_match('/(a)(b)*(c)/', 'ac', $matches);
array_walk_recursive($matches, function (&$value) {
if ($value === '') {
$value = null;
@ -148,77 +142,61 @@ CODE_SAMPLE
}
return null;
}
private function handleEmptyStringToNullMatch(FuncCall $funcCall, Variable $variable) : FuncCall
/**
* @return Stmt|Stmt[]|null
*/
private function handleEmptyStringToNullMatch(FuncCall $funcCall, Variable $variable, Node $node)
{
$closure = new Closure();
$variablePass = new Variable('value');
$param = new Param($variablePass);
$param->byRef = \true;
$closure->params = [$param];
$assign = new Assign($variablePass, $this->nodeFactory->createNull());
$if = $this->ifManipulator->createIfStmt(new Identical($variablePass, new String_('')), new Expression($assign));
$closure->stmts[0] = $if;
$param = new Param($variablePass, null, null, \true);
$closure = new Closure(['params' => [$param], 'stmts' => [$if]]);
$arguments = $this->nodeFactory->createArgs([$variable, $closure]);
$replaceEmptyStringToNull = $this->nodeFactory->createFuncCall('array_walk_recursive', $arguments);
return $this->processReplace($funcCall, $replaceEmptyStringToNull);
$arrayWalkRecursiveFuncCall = $this->nodeFactory->createFuncCall('array_walk_recursive', $arguments);
return $this->processReplace($funcCall, $arrayWalkRecursiveFuncCall, $node);
}
private function processReplace(FuncCall $funcCall, FuncCall $replaceEmptyStringToNull) : FuncCall
/**
* @return Stmt|Stmt[]|null
*/
private function processReplace(FuncCall $funcCall, FuncCall $replaceEmptyStringToNull, Stmt $stmt)
{
$parentNode = $funcCall->getAttribute(AttributeKey::PARENT_NODE);
if ($parentNode instanceof Expression) {
$this->nodesToAddCollector->addNodeAfterNode($replaceEmptyStringToNull, $funcCall);
return $funcCall;
if ($stmt instanceof If_ && $stmt->cond === $funcCall) {
return $this->processInIf($stmt, $replaceEmptyStringToNull);
}
if ($parentNode instanceof If_ && $parentNode->cond === $funcCall) {
return $this->processInIf($parentNode, $funcCall, $replaceEmptyStringToNull);
}
if (!$parentNode instanceof Node) {
throw new NotImplementedException();
}
$parentParentNode = $parentNode->getAttribute(AttributeKey::PARENT_NODE);
if ($parentNode instanceof BooleanNot && $parentParentNode instanceof If_) {
return $this->processInIf($parentParentNode, $funcCall, $replaceEmptyStringToNull);
}
if ($parentNode instanceof Assign && $parentNode->expr === $funcCall) {
return $this->processInAssign($parentNode, $funcCall, $replaceEmptyStringToNull);
}
if (!$parentNode instanceof Identical) {
throw new NotImplementedYetException();
}
if (!$parentParentNode instanceof If_) {
throw new NotImplementedYetException();
}
return $this->processInIf($parentParentNode, $funcCall, $replaceEmptyStringToNull);
return [$stmt, new Expression($replaceEmptyStringToNull)];
}
private function processInAssign(Assign $assign, FuncCall $funcCall, FuncCall $replaceEmptyStringToNull) : FuncCall
{
$this->nodesToAddCollector->addNodeAfterNode(new Expression($replaceEmptyStringToNull), $assign);
return $funcCall;
}
private function processInIf(If_ $if, FuncCall $funcCall, FuncCall $replaceEmptyStringToNull) : FuncCall
private function processInIf(If_ $if, FuncCall $funcCall) : ?Stmt
{
$cond = $if->cond;
if (!$cond instanceof Identical && !$cond instanceof BooleanNot) {
$this->handleNotInIdenticalAndBooleanNot($if, $replaceEmptyStringToNull);
}
if ($cond instanceof Identical) {
$valueCompare = $cond->left === $funcCall ? $cond->right : $cond->left;
if ($this->valueResolver->isFalse($valueCompare)) {
$this->nodesToAddCollector->addNodeAfterNode($replaceEmptyStringToNull, $if);
}
return null;
}
if ($cond instanceof BooleanNot) {
$this->nodesToAddCollector->addNodeAfterNode($replaceEmptyStringToNull, $if);
return null;
}
return $funcCall;
return $this->handleNotInIdenticalAndBooleanNot($if, $funcCall);
}
private function handleNotInIdenticalAndBooleanNot(If_ $if, FuncCall $funcCall) : void
private function handleNotInIdenticalAndBooleanNot(If_ $if, FuncCall $funcCall) : Stmt
{
if ($if->stmts !== []) {
$firstStmt = $if->stmts[0];
$this->nodesToAddCollector->addNodeBeforeNode($funcCall, $firstStmt);
return;
return $if->stmts[0];
}
$if->stmts[0] = new Expression($funcCall);
return $if;
}
/**
* @param \PhpParser\Node\Stmt\Expression|\PhpParser\Node\Stmt\If_ $stmt
*/
private function matchRegexFuncCall($stmt) : ?FuncCall
{
$funcCalls = $this->betterNodeFinder->findInstancesOf($stmt, [FuncCall::class]);
foreach ($funcCalls as $funcCall) {
if (!$this->regexFuncAnalyzer->matchRegexFuncCall($funcCall) instanceof FuncCall) {
continue;
}
return $funcCall;
}
return null;
}
}