mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-18 09:02:26 +00:00
Update to nikic/php-parser 4.13.0 (#904)
* Update to nikic/php-parser 4.13.0 * check Arg on PregMatchTypeCorrector * [ci-review] Rector Rectify * [ci-review] Rector Rectify * check Aeg on NodeTransformer * check arg on RegexPatternArgumentManipulator * [ci-review] Rector Rectify * check Arg on FuncCallManipulator * check Arg on ClassMethodAssignManipulator * check Arg on StringifyStrNeedlesRector * [ci-review] Rector Rectify * Arg check on CompactFuncCallAnalyzer * Arg check on CompactFuncCallAnalyzer * check Arg on CallableInMethodCallToVariableRector * check Arg on CallableInMethodCallToVariableRector * Arg check on BeConstructedWithAssignFactory * Add ArgsAnalyzer to check Arg instance in in Args position * Arg check on SubstrMatchAndRefactor * Arg check on NewArgToMethodCallRector * check Arg on ConsistentImplodeRector * Arg check on DuringMethodCallFactory * Arg check on CountOnNullRector * Arg check on ExportToReflectionFunctionRector * Arg check on ImplodeAnalyzer * Arg check on WhileEachToForeachRector * Arg check on DowngradeIsCountableRector * Arg check on VariableNaming * Arg check on ConditionResolver * Arg check on DirNameFileConstantToDirConstantRector * Arg check on NewFluentChainMethodCallNodeAnalyzer * Arg check on MbStrrposEncodingArgumentPositionRector * Arg check on UnwrapFutureCompatibleIfFunctionExistsRector * Arg check on JsonArrayFactory * Arg check on RemoveFuncCallRector * Arg check on ArrayKeyExistsOnPropertyRector * Arg check on FunctionExistsFunCallAnalyzer * Arg check on SetTypeToCastRector * Arg check on ReplaceEachAssignmentWithKeyCurrentRector * Arg check on PregMatchTypeCorrector * Arg check on SwapFuncCallArgumentsRector * Arg check on FilterVarToAddSlashesRector * Arg check on ClassOnObjectRector * Arg check on ClassOnObjectRector * Arg check on CallerParamMatcher * Arg check on ArgumentFuncCallToMethodCallRector * add ArgsAnalyzer::isArgsInstanceInArgsPositions() for multi check directly * Arg check on ArraySpreadInsteadOfArrayMergeRector * Arg check on GetDebugTypeRector * Arg check on GetDebugTypeRector * Arg check on StringifyDefineRector * Arg check on DowngradeArrayKeyFirstLastRector * Arg check on IsArrayAndDualCheckToAble * Arg check on CreateFunctionToAnonymousFunctionRector * Arg check on AddArrayDefaultToArrayPropertyRector * Arg check on IsObjectOnIncompleteClassRector * Arg check on ForToForeachRector * Arg check on ClassMethodNodeRemover * Arg check on CompactConverter * Arg check on IsAWithStringWithThirdArgumentRector * Arg check on CallUserFuncArrayToVariadicRector * Arg check on MysqlPConnectToMysqliConnectRector * Arg check on MysqlAssignToMysqliRector * Arg check on InArrayAndArrayKeysToArrayKeyExistsRector * Arg check on NonVariableToVariableOnFunctionCallRector * Arg check on VersionCompareFuncCallToConstantRector * fix test * Arg check on StrEndsWithRector * Arg check on TokenManipulator * Arg check on StrStartsWithFactory * Arg check on DowngradeIsIterableRector * Arg check on DowngradeStripTagsCallWithArrayRector * [ci-review] Rector Rectify * [ci-review] Rector Rectify * Arg check on ChangeDiffForHumansArgsRector * Arg check on ThrowWithPreviousExceptionRector * [ci-review] Rector Rectify * [ci-review] Rector Rectify * Arg check on StrposMatchAndRefactor * Arg check on UseMessageVariableForSprintfInSymfonyStyleRector * [ci-review] Rector Rectify * [ci-review] Rector Rectify * fix * Arg check on PhpSpecClassToPHPUnitClassRector * Arg check on CallTypesResolver * Arg check on NonVariableToVariableOnFunctionCallRector * Arg check on DispatchStringToObjectRector * Arg check on GetClassToInstanceOfRector * Arg check on StrncmpMatchAndRefactor * Arg check on StrncmpMatchAndRefactor * Arg check on ArraySpreadInsteadOfArrayMergeRector * Arg check on ArrayKeysAndInArrayToArrayKeyExistsRector * Arg check on DowngradeSessionStartArrayOptionsRector * Arg check on CountArrayToEmptyArrayComparisonRector * Arg check on DowngradeClosureFromCallableRector * Arg check on EregToPregMatchRector * Arg check on GetClassOnNullRector * Arg check on use RemoveSoleValueSprintfRector * Arg check on UnSpreadOperatorRector * Arg check on DowngradeStrContainsRector * [ci-review] Rector Rectify * Arg check on ArrayMergeOfNonArraysToSimpleArrayRector * Arg check on IntvalToTypeCastRector * Arg check on RemoveUnusedVariableAssignRector * Arg check on ConsistentPregDelimiterRector * Arg check on CountManipulator * Arg check on DowngradeDefineArrayConstantRector * Arg check on RemoveReferenceFromCallRector * Arg check on SimplifyInArrayValuesRector * Arg check on SingleInArrayToCompareRector * Arg check on SimplifyIfIssetToNullCoalescingRector * Arg check on StrlenZeroToIdenticalEmptyStringRector * [ci-review] Rector Rectify * Add ComplexType check * Arg check on UnwrapSprintfOneArgumentRector * Arg check on CurrentAndParentClassMethodComparator * Arg check on CompactToVariablesRector * [ci-review] Rector Rectify * ComplexType check * Arg check on MockVariableCollector * re-generate preload.php * [ci-review] Rector Rectify * fix phpstan ignore error * Arg check on FormerNullableArgumentToScalarTypedRector * ComplexType check on MakeTypedPropertyNullableIfCheckedRector * Arg check on ArgumentRemoverRector * using getArgs() on PhpSpecPromisesToPHPUnitAssertRector * using getArgs() on args using in method call args * Arg check on PhpSpecMocksToPHPUnitMocksRector * Arg check on SetCookieRector * Arg check on StringsAssertNakedRector * Arg check on PregReplaceEModifierRector * using getArgs() on multiple count() usage * using getArgs() on args using in method call args * using getArgs() on args using in method call args * using getArgs() on args using in method call args * Arg check on MysqlFuncCallToMysqliRector * using getArgs() on args using in method call args * using getArgs() on args using in method call args * Arg check on DowngradeCovariantReturnTypeRector * Arg check on SetCookieOptionsArrayToArgumentsRector * using getArgs() on too complex check * Arg check on DowngradeNegativeStringOffsetToStrlenRector * ensure preload always used when file exists * Arg check on SimplifyFuncGetArgsCountRector * set back reportUnmatchedIgnoredErrors as different between local and github * Arg check on ArgumentDefaultValueReplacer * fix test of getArgs() on MysqlQueryMysqlErrorWithLinkRector * Arg check on SymmetricArrayDestructuringToListRector * Arg check on UseMessageVariableForSprintfInSymfonyStyleRector * Arg check on ConsistentPregDelimiterRector * Arg check on CallUserFuncToMethodCallRector * Arg check on ArrayKeyExistsTernaryThenValueToCoalescingRector * Arg check on SimplifyStrposLowerRector * Arg check on CompactToVariablesRector * Arg check on CompactToVariablesRector * Arg check on ChangeArrayPushToArrayAssignRector * Arg check on ChangeArrayPushToArrayAssignRector * Arg check on CompactConverter * final touch: Arg check on CallUserFuncWithArrowFunctionToInlineRector * fix Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
042daa1929
commit
17cfa9f376
|
@ -34,7 +34,9 @@ $autoloadIncluder->includeDependencyOrRepositoryVendorAutoloadIfExists();
|
|||
$extractedPhpstanAutoload = __DIR__ . '/../vendor/phpstan/phpstan-extracted/vendor/autoload.php';
|
||||
if (file_exists($extractedPhpstanAutoload)) {
|
||||
require_once $extractedPhpstanAutoload;
|
||||
} elseif (should_include_preload()) {
|
||||
}
|
||||
|
||||
if (file_exists(__DIR__ . '/../preload.php')) {
|
||||
require_once __DIR__ . '/../preload.php';
|
||||
}
|
||||
|
||||
|
@ -141,19 +143,3 @@ final class AutoloadIncluder
|
|||
require_once $filePath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// load local php-parser only in prefixed version or development repository
|
||||
function should_include_preload(): bool
|
||||
{
|
||||
if (file_exists(__DIR__ . '/../vendor/scoper-autoload.php')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! file_exists(getcwd() . '/composer.json')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$composerJsonFileContent = file_get_contents(getcwd() . '/composer.json');
|
||||
return strpos($composerJsonFileContent, '"name": "rector/rector"') !== false;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"idiosyncratic/editorconfig": "^0.1.3",
|
||||
"myclabs/php-enum": "^1.8",
|
||||
"nette/utils": "^3.2",
|
||||
"nikic/php-parser": "4.12.0",
|
||||
"nikic/php-parser": "4.13.0",
|
||||
"phpstan/phpdoc-parser": "^0.5.5",
|
||||
"phpstan/phpstan": "0.12.99",
|
||||
"phpstan/phpstan-phpunit": "^0.12.22",
|
||||
|
|
|
@ -11,6 +11,7 @@ use PhpParser\Node\Expr\Variable;
|
|||
use PHPStan\Type\ArrayType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
|
@ -23,7 +24,8 @@ final class PregMatchTypeCorrector
|
|||
private BetterNodeFinder $betterNodeFinder,
|
||||
private NodeNameResolver $nodeNameResolver,
|
||||
private ParentScopeFinder $parentScopeFinder,
|
||||
private NodeComparator $nodeComparator
|
||||
private NodeComparator $nodeComparator,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -58,12 +60,15 @@ final class PregMatchTypeCorrector
|
|||
continue;
|
||||
}
|
||||
|
||||
if (! isset($funcCallNode->args[2])) {
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($funcCallNode->args, 2)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var Arg $thirdArg */
|
||||
$thirdArg = $funcCallNode->args[2];
|
||||
|
||||
// are the same variables
|
||||
if (! $this->nodeComparator->areNodesEqual($funcCallNode->args[2]->value, $node)) {
|
||||
if (! $this->nodeComparator->areNodesEqual($thirdArg->value, $node)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
12
phpstan.neon
12
phpstan.neon
|
@ -42,7 +42,7 @@ parameters:
|
|||
scanDirectories:
|
||||
- stubs
|
||||
|
||||
# reportUnmatchedIgnoredErrors: false
|
||||
reportUnmatchedIgnoredErrors: false
|
||||
checkGenericClassInNonGenericObjectType: false
|
||||
|
||||
excludes_analyse:
|
||||
|
@ -106,7 +106,6 @@ parameters:
|
|||
- '#Cognitive complexity for "Rector\\Transform\\Rector\\Class_\\AddInterfaceByParentRector\:\:refactor\(\)" is \d+, keep it under 9#'
|
||||
|
||||
|
||||
- '#Parameter \#1 \$type of class PhpParser\\Node\\NullableType constructor expects PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#'
|
||||
- '#Parameter \#1 \$objectType of method Rector\\Naming\\Naming\\PropertyNaming\:\:fqnToVariableName\(\) expects PHPStan\\Type\\ObjectType\|string, PHPStan\\Type\\Type given#'
|
||||
# known value
|
||||
- '#Property PhpParser\\Node\\Stmt\\Foreach_\:\:\$valueVar \(PhpParser\\Node\\Expr\) does not accept PhpParser\\Node\\Expr\|null#'
|
||||
|
@ -358,12 +357,6 @@ parameters:
|
|||
|
||||
- '#Cannot call method getSmartFileInfo\(\) on Rector\\Core\\ValueObject\\Application\\File\|null#'
|
||||
|
||||
# doc typo in php-parser
|
||||
- '#Parameter \#2 \$args of class PhpParser\\Node\\Expr\\FuncCall constructor expects array<PhpParser\\Node\\Arg\>, array<int, PhpParser\\Node\\Arg\|null\> given#'
|
||||
|
||||
# php-parser bug
|
||||
- '#Parameter \#1 \$type of method PhpParser\\Builder\\FunctionLike\:\:setReturnType\(\) expects PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|string, PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#'
|
||||
|
||||
- '#Method Rector\\Core\\Tests\\DependencyInjection\\ConfigurableRectorImportConfigCallsMergeTest\:\:provideData\(\) return type has no value type specified in iterable type Iterator#'
|
||||
|
||||
-
|
||||
|
@ -514,6 +507,3 @@ parameters:
|
|||
- packages/FileFormatter/ValueObject/NewLine.php #15
|
||||
- src/Application/VersionResolver.php #16
|
||||
- utils/compiler/src/Unprefixer.php #9
|
||||
|
||||
# false positive, class exists is right above
|
||||
- '#Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class\-string<Rector\\RectorInstaller\\GeneratedConfig\>\|Rector\\RectorInstaller\\GeneratedConfig, string given#'
|
||||
|
|
479
preload.php
479
preload.php
|
@ -2,249 +2,254 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Comment.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Error.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NameContext.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php';
|
||||
require_once __DIR__ . '/vendor/symplify/symfony-php-config/src/Reflection/ArgumentAndParameterFactory.php';
|
||||
require_once __DIR__ . '/vendor/symplify/symfony-php-config/src/Exception/ValueObjectException.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Error.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Comment.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/ComplexType.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php';
|
||||
require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php';
|
||||
require_once __DIR__ . '/vendor/symplify/symfony-php-config/src/ValueObjectInliner.php';
|
||||
require_once __DIR__ . '/vendor/symplify/symfony-php-config/src/Exception/ValueObjectException.php';
|
||||
require_once __DIR__ . '/vendor/symplify/symfony-php-config/src/Reflection/ArgumentAndParameterFactory.php';
|
||||
require_once __DIR__ . '/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php';
|
||||
|
|
|
@ -87,8 +87,11 @@ final class ArgumentDefaultValueReplacer
|
|||
private function processArgs(
|
||||
MethodCall | StaticCall | FuncCall $expr,
|
||||
ReplaceArgumentDefaultValueInterface $replaceArgumentDefaultValue
|
||||
): Expr {
|
||||
): ?Expr {
|
||||
$position = $replaceArgumentDefaultValue->getPosition();
|
||||
if (! $expr->args[$position] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$argValue = $this->valueResolver->getValue($expr->args[$position]->value);
|
||||
|
||||
|
@ -97,7 +100,7 @@ final class ArgumentDefaultValueReplacer
|
|||
) && $argValue === $replaceArgumentDefaultValue->getValueBefore()) {
|
||||
$expr->args[$position] = $this->normalizeValueToArgument($replaceArgumentDefaultValue->getValueAfter());
|
||||
} elseif (is_array($replaceArgumentDefaultValue->getValueBefore())) {
|
||||
$newArgs = $this->processArrayReplacement($expr->args, $replaceArgumentDefaultValue);
|
||||
$newArgs = $this->processArrayReplacement($expr->getArgs(), $replaceArgumentDefaultValue);
|
||||
|
||||
if ($newArgs) {
|
||||
$expr->args = $newArgs;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Arguments\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Arguments\ValueObject\SwapFuncCallArguments;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
|
@ -129,6 +130,10 @@ CODE_SAMPLE
|
|||
continue;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[$oldPosition] instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newArguments[$newPosition] = $funcCall->args[$oldPosition];
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Carbon\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
|
@ -82,6 +83,10 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$secondArgValue = $node->args[1]->value;
|
||||
if ($this->valueResolver->isTrue($secondArgValue)) {
|
||||
$node->args[1]->value = $this->nodeFactory->createClassConstFetch(
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\CodeQuality;
|
||||
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -22,6 +23,11 @@ final class CompactConverter
|
|||
public function hasAllArgumentsNamed(FuncCall $funcCall): bool
|
||||
{
|
||||
foreach ($funcCall->args as $arg) {
|
||||
// VariadicPlaceholder doesn't has name, so it return false directly
|
||||
if (! $arg instanceof Arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var string|null $variableName */
|
||||
$variableName = $this->valueResolver->getValue($arg->value);
|
||||
if (! is_string($variableName)) {
|
||||
|
@ -37,6 +43,10 @@ final class CompactConverter
|
|||
$array = new Array_();
|
||||
|
||||
foreach ($funcCall->args as $arg) {
|
||||
if (! $arg instanceof Arg) {
|
||||
throw new ShouldNotHappenException();
|
||||
}
|
||||
|
||||
/** @var string|null $variableName */
|
||||
$variableName = $this->valueResolver->getValue($arg->value);
|
||||
if (! is_string($variableName)) {
|
||||
|
|
|
@ -138,6 +138,7 @@ CODE_SAMPLE
|
|||
$new->args[1] = new Arg(new MethodCall($catchedThrowableVariable, 'getCode'));
|
||||
}
|
||||
|
||||
/** @var Arg $arg1 */
|
||||
$arg1 = $new->args[1];
|
||||
if ($arg1->name instanceof Identifier && $arg1->name->toString() === 'previous') {
|
||||
$new->args[1] = new Arg(new MethodCall($catchedThrowableVariable, 'getCode'));
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Rector\CodeQuality\Rector\For_;
|
|||
|
||||
use Doctrine\Inflector\Inflector;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
|
@ -217,7 +218,7 @@ CODE_SAMPLE
|
|||
|
||||
$funcCall = $initExpr->expr;
|
||||
|
||||
if ($this->nodeNameResolver->isName($funcCall, self::COUNT)) {
|
||||
if ($this->nodeNameResolver->isName($funcCall, self::COUNT) && $funcCall->args[0] instanceof Arg) {
|
||||
$this->countValueVariableExpr = $initExpr->var;
|
||||
$this->countValueName = $this->getName($initExpr->var);
|
||||
$this->iteratedExpr = $funcCall->args[0]->value;
|
||||
|
@ -249,7 +250,7 @@ CODE_SAMPLE
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->nodeNameResolver->isName($funcCall, self::COUNT)) {
|
||||
if ($this->nodeNameResolver->isName($funcCall, self::COUNT) && $funcCall->args[0] instanceof Arg) {
|
||||
$this->iteratedExpr = $funcCall->args[0]->value;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
|
@ -66,6 +67,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$arrayVariable = $node->args[1]->value;
|
||||
|
||||
/** @var Assign|Node|null $previousAssignArraysKeysFuncCall */
|
||||
|
@ -107,8 +116,24 @@ CODE_SAMPLE
|
|||
return $this->createArrayKeyExists($node, $arrayKeysFuncCall);
|
||||
}
|
||||
|
||||
private function createArrayKeyExists(FuncCall $inArrayFuncCall, FuncCall $arrayKeysFuncCall): FuncCall
|
||||
private function createArrayKeyExists(FuncCall $inArrayFuncCall, FuncCall $arrayKeysFuncCall): ?FuncCall
|
||||
{
|
||||
if (! isset($inArrayFuncCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $inArrayFuncCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! isset($arrayKeysFuncCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $arrayKeysFuncCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$arguments = [$inArrayFuncCall->args[0], $arrayKeysFuncCall->args[0]];
|
||||
|
||||
return new FuncCall(new Name('array_key_exists'), $arguments);
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -76,6 +77,11 @@ CODE_SAMPLE
|
|||
|
||||
$array = new Array_();
|
||||
foreach ($node->args as $arg) {
|
||||
// found non Arg? return early
|
||||
if (! $arg instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$nestedArrayItem = $arg->value;
|
||||
if (! $nestedArrayItem instanceof Array_) {
|
||||
return null;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ArrowFunction;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -75,7 +76,16 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
// change the node
|
||||
$firstArgValue = $node->args[0]->value;
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArg = $node->args[0];
|
||||
if (! $firstArg instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArgValue = $firstArg->value;
|
||||
if ($firstArgValue instanceof ArrowFunction) {
|
||||
return $firstArgValue->expr;
|
||||
}
|
||||
|
|
|
@ -80,10 +80,18 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$arrayDimFetch = new ArrayDimFetch($node->args[0]->value);
|
||||
|
||||
$position = 1;
|
||||
while (isset($node->args[$position])) {
|
||||
while (isset($node->args[$position]) && $node->args[$position] instanceof Arg) {
|
||||
$assign = new Assign($arrayDimFetch, $node->args[$position]->value);
|
||||
$assignExpression = new Expression($assign);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
|
@ -88,7 +89,10 @@ CODE_SAMPLE
|
|||
return $this->compactConverter->convertToArray($node);
|
||||
}
|
||||
|
||||
$firstValue = $node->args[0]->value;
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
|
||||
$firstValue = $firstArg->value;
|
||||
$firstValueStaticType = $this->getStaticType($firstValue);
|
||||
if (! $firstValueStaticType instanceof ConstantArrayType) {
|
||||
return null;
|
||||
|
@ -138,7 +142,10 @@ CODE_SAMPLE
|
|||
|
||||
$this->arrayCompacter->compactStringToVariableArray($array);
|
||||
|
||||
$assignVariable = $funcCall->args[0]->value;
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $funcCall->args[0];
|
||||
|
||||
$assignVariable = $firstArg->value;
|
||||
$preAssign = new Assign($assignVariable, $array);
|
||||
|
||||
$currentStatement = $funcCall->getAttribute(AttributeKey::CURRENT_STATEMENT);
|
||||
|
|
|
@ -5,8 +5,10 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -16,6 +18,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class InArrayAndArrayKeysToArrayKeyExistsRector extends AbstractRector
|
||||
{
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition(
|
||||
|
@ -41,20 +47,27 @@ final class InArrayAndArrayKeysToArrayKeyExistsRector extends AbstractRector
|
|||
return null;
|
||||
}
|
||||
|
||||
$secondArgument = $node->args[1]->value;
|
||||
if (! $secondArgument instanceof FuncCall) {
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($node->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->isName($secondArgument, 'array_keys')) {
|
||||
/** @var Arg $secondArgument */
|
||||
$secondArgument = $node->args[1];
|
||||
if (! $secondArgument->value instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (count($secondArgument->args) > 1) {
|
||||
if (! $this->isName($secondArgument->value, 'array_keys')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (count($secondArgument->value->args) > 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $keyArg */
|
||||
$keyArg = $node->args[0];
|
||||
/** @var Arg $arrayArg */
|
||||
$arrayArg = $node->args[1];
|
||||
|
||||
/** @var FuncCall $innerFuncCallNode */
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Cast\Int_;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
|
@ -65,7 +66,7 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (isset($node->args[1])) {
|
||||
if (isset($node->args[1]) && $node->args[1] instanceof Arg) {
|
||||
$secondArgumentValue = $this->valueResolver->getValue($node->args[1]->value);
|
||||
// default value
|
||||
if ($secondArgumentValue !== 10) {
|
||||
|
@ -73,6 +74,14 @@ CODE_SAMPLE
|
|||
}
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Int_($node->args[0]->value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,10 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArgumentStaticType = $this->getStaticType($node->args[0]->value);
|
||||
if (! $firstArgumentStaticType instanceof StringType) {
|
||||
return null;
|
||||
|
|
|
@ -5,9 +5,11 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PHPStan\Type\StringType;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -17,6 +19,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class RemoveSoleValueSprintfRector extends AbstractRector
|
||||
{
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Remove sprintf() wrapper if not needed', [
|
||||
|
@ -71,7 +77,13 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$maskArgument = $node->args[0]->value;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($node->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
$maskArgument = $firstArg->value;
|
||||
if (! $maskArgument instanceof String_) {
|
||||
return null;
|
||||
}
|
||||
|
@ -80,7 +92,9 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$valueArgument = $node->args[1]->value;
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $node->args[1];
|
||||
$valueArgument = $secondArg->value;
|
||||
if (! $this->nodeTypeResolver->isStaticType($valueArgument, StringType::class)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use PhpParser\Node\Expr\Cast\Object_;
|
|||
use PhpParser\Node\Expr\Cast\String_;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -44,6 +45,10 @@ final class SetTypeToCastRector extends AbstractRector
|
|||
'string' => String_::class,
|
||||
];
|
||||
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Changes settype() to (type) where possible', [
|
||||
|
@ -92,14 +97,26 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$typeNode = $this->valueResolver->getValue($node->args[1]->value);
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 1)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $node->args[1];
|
||||
$typeNode = $this->valueResolver->getValue($secondArg->value);
|
||||
if ($typeNode === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$typeNode = strtolower($typeNode);
|
||||
|
||||
$varNode = $node->args[0]->value;
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
$varNode = $firstArg->value;
|
||||
$parentNode = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
|
||||
// result of function or probably used
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -40,6 +41,10 @@ final class SimplifyFuncGetArgsCountRector extends AbstractRector
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0]->value instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -40,6 +41,14 @@ final class SimplifyInArrayValuesRector extends AbstractRector
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1]->value instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
|
@ -50,6 +59,14 @@ final class SimplifyInArrayValuesRector extends AbstractRector
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$node->args[1] = $innerFunCall->args[0];
|
||||
|
||||
return $node;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
|
@ -45,6 +46,10 @@ final class SimplifyStrposLowerRector extends AbstractRector
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0]->value instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\BinaryOp\Equal;
|
||||
|
@ -70,6 +71,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1]->value instanceof Array_) {
|
||||
return null;
|
||||
}
|
||||
|
@ -85,6 +94,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArrayItemValue = $firstArrayItem->value;
|
||||
// strict
|
||||
if (isset($node->args[2])) {
|
||||
|
|
|
@ -5,7 +5,9 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -16,6 +18,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class UnwrapSprintfOneArgumentRector extends AbstractRector
|
||||
{
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('unwrap sprintf() with one argument', [
|
||||
|
@ -52,10 +58,16 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if ($node->args[0]->unpack) {
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $node->args[0]->value;
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
if ($firstArg->unpack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $firstArg->value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\Identical;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
|
@ -77,6 +78,14 @@ final class GetClassToInstanceOfRector extends AbstractRector
|
|||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $twoNodeMatch->getSecondExpr();
|
||||
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$varNode = $funcCall->args[0]->value;
|
||||
|
||||
if ($firstExpr instanceof String_) {
|
||||
|
|
|
@ -5,10 +5,12 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\Identical;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -18,6 +20,11 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class StrlenZeroToIdenticalEmptyStringRector extends AbstractRector
|
||||
{
|
||||
public function __construct(
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition(
|
||||
|
@ -61,32 +68,58 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
$variable = null;
|
||||
if ($node->left instanceof FuncCall) {
|
||||
if (! $this->isName($node->left, 'strlen')) {
|
||||
return null;
|
||||
}
|
||||
return $this->processLeftIdentical($node, $node->left);
|
||||
}
|
||||
|
||||
if (! $this->valueResolver->isValue($node->right, 0)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->right instanceof FuncCall) {
|
||||
return $this->processRightIdentical($node, $node->right);
|
||||
}
|
||||
|
||||
$variable = $node->left->args[0]->value;
|
||||
} elseif ($node->right instanceof FuncCall) {
|
||||
if (! $this->isName($node->right, 'strlen')) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->valueResolver->isValue($node->left, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$variable = $node->right->args[0]->value;
|
||||
} else {
|
||||
private function processLeftIdentical(Identical $identical, FuncCall $funcCall): ?Identical
|
||||
{
|
||||
if (! $this->isName($funcCall, 'strlen')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->valueResolver->isValue($identical->right, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($funcCall->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $funcCall->args[0];
|
||||
/** @var Expr $variable */
|
||||
$variable = $firstArg->value;
|
||||
|
||||
return new Identical($variable, new String_(''));
|
||||
}
|
||||
|
||||
private function processRightIdentical(Identical $identical, FuncCall $funcCall): ?Identical
|
||||
{
|
||||
if (! $this->isName($funcCall, 'strlen')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->valueResolver->isValue($identical->left, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($funcCall->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $funcCall->args[0];
|
||||
/** @var Expr $variable */
|
||||
$variable = $firstArg->value;
|
||||
|
||||
return new Identical($variable, new String_(''));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ use PhpParser\Node\Name;
|
|||
use PhpParser\Node\Stmt\Else_;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -24,6 +25,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class SimplifyIfIssetToNullCoalescingRector extends AbstractRector
|
||||
{
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Simplify binary if to null coalesce', [
|
||||
|
@ -108,11 +113,19 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $this->nodeComparator->areNodesEqual($firstAssign->expr->args[0]->value, $valueNode)) {
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($firstAssign->expr->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->nodeComparator->areNodesEqual($secondAssign->expr, $firstAssign->expr->args[1]->value)) {
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $firstAssign->expr->args[0];
|
||||
if (! $this->nodeComparator->areNodesEqual($firstArg->value, $valueNode)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $firstAssign->expr->args[1];
|
||||
if (! $this->nodeComparator->areNodesEqual($secondAssign->expr, $secondArg->value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodeQuality\Rector\Ternary;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\BinaryOp\Coalesce;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -95,8 +96,19 @@ CODE_SAMPLE
|
|||
*/
|
||||
private function areArrayKeysExistsArgsMatchingDimFetch(FuncCall $funcCall, ArrayDimFetch $arrayDimFetch): bool
|
||||
{
|
||||
$keyExpr = $funcCall->args[0]->value;
|
||||
$valuesExpr = $funcCall->args[1]->value;
|
||||
$firstArg = $funcCall->args[0];
|
||||
if (! $firstArg instanceof Arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$keyExpr = $firstArg->value;
|
||||
|
||||
$secondArg = $funcCall->args[1];
|
||||
if (! $secondArg instanceof Arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$valuesExpr = $secondArg->value;
|
||||
|
||||
if (! $this->nodeComparator->areNodesEqual($arrayDimFetch->var, $valuesExpr)) {
|
||||
return false;
|
||||
|
|
|
@ -4,15 +4,18 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\CodingStyle\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
|
||||
final class ImplodeAnalyzer
|
||||
{
|
||||
public function __construct(
|
||||
private NodeNameResolver $nodeNameResolver
|
||||
private NodeNameResolver $nodeNameResolver,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -29,11 +32,17 @@ final class ImplodeAnalyzer
|
|||
return false;
|
||||
}
|
||||
|
||||
if (! isset($expr->args[1])) {
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($expr->args, 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$firstArgumentValue = $expr->args[0]->value;
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($expr->args, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $expr->args[0];
|
||||
$firstArgumentValue = $firstArg->value;
|
||||
if (! $firstArgumentValue instanceof String_) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Rector\CodingStyle\NodeFactory;
|
|||
|
||||
use Nette\Utils\Json;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
|
@ -60,8 +61,14 @@ final class JsonArrayFactory
|
|||
$placeholderNode = $this->matchPlaceholderNode($onlyItem->value, $placeholderNodes);
|
||||
|
||||
if ($placeholderNode && $this->implodeAnalyzer->isImplodeToJson($placeholderNode)) {
|
||||
/** @var FuncCall $placeholderNode */
|
||||
return $placeholderNode->args[1]->value;
|
||||
/**
|
||||
* @var FuncCall $placeholderNode
|
||||
* @var Arg $firstArg
|
||||
*
|
||||
* Arg check already on $this->implodeAnalyzer->isImplodeToJson() above
|
||||
*/
|
||||
$firstArg = $placeholderNode->args[1];
|
||||
return $firstArg->value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,10 @@ CODE_SAMPLE
|
|||
continue;
|
||||
}
|
||||
|
||||
if (! $arg instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$variadicArgs[] = $arg;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodingStyle\Rector\Class_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
|
@ -17,6 +18,7 @@ use PhpParser\Node\Stmt\Property;
|
|||
use PhpParser\Node\Stmt\PropertyProperty;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\CodingStyle\TypeAnalyzer\IterableTypeAnalyzer;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
|
@ -31,7 +33,8 @@ final class AddArrayDefaultToArrayPropertyRector extends AbstractRector
|
|||
{
|
||||
public function __construct(
|
||||
private PropertyFetchAnalyzer $propertyFetchAnalyzer,
|
||||
private IterableTypeAnalyzer $iterableTypeAnalyzer
|
||||
private IterableTypeAnalyzer $iterableTypeAnalyzer,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -177,11 +180,13 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$countedArgument = $node->args[0]->value;
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
$countedArgument = $firstArg->value;
|
||||
if (! $countedArgument instanceof PropertyFetch) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use PhpParser\Node\Expr\FuncCall;
|
|||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\CodingStyle\NodeFactory\ArrayCallableToMethodCallFactory;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
|
@ -27,7 +28,8 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
final class CallUserFuncArrayToVariadicRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
public function __construct(
|
||||
private ArrayCallableToMethodCallFactory $arrayCallableToMethodCallFactory
|
||||
private ArrayCallableToMethodCallFactory $arrayCallableToMethodCallFactory,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -75,8 +77,16 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$firstArgValue = $node->args[0]->value;
|
||||
$secondArgValue = $node->args[1]->value;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($node->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
$firstArgValue = $firstArg->value;
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $node->args[1];
|
||||
$secondArgValue = $secondArg->value;
|
||||
|
||||
if ($firstArgValue instanceof String_) {
|
||||
$functionName = $this->valueResolver->getValue($firstArgValue);
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodingStyle\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
|
@ -70,6 +71,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArgValue = $node->args[0]->value;
|
||||
if (! $firstArgValue instanceof Array_) {
|
||||
return null;
|
||||
|
|
|
@ -8,6 +8,7 @@ use PhpParser\Node;
|
|||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\TypeAnalyzer\StringTypeAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -21,7 +22,8 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
final class ConsistentImplodeRector extends AbstractRector
|
||||
{
|
||||
public function __construct(
|
||||
private StringTypeAnalyzer $stringTypeAnalyzer
|
||||
private StringTypeAnalyzer $stringTypeAnalyzer,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -86,17 +88,32 @@ CODE_SAMPLE
|
|||
return $node;
|
||||
}
|
||||
|
||||
$firstArgumentValue = $node->args[0]->value;
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $arg0 */
|
||||
$arg0 = $node->args[0];
|
||||
$firstArgumentValue = $arg0->value;
|
||||
if ($firstArgumentValue instanceof String_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (count($node->args) === 2 && $this->stringTypeAnalyzer->isStringOrUnionStringOnlyType(
|
||||
$node->args[1]->value
|
||||
)) {
|
||||
$node->args = array_reverse($node->args);
|
||||
if (count($node->args) !== 2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $node;
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 1)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $arg1 */
|
||||
$arg1 = $node->args[1];
|
||||
if ($this->stringTypeAnalyzer->isStringOrUnionStringOnlyType($arg1->value)) {
|
||||
$node->args = array_reverse($node->args);
|
||||
return $node;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,6 +124,10 @@ CODE_SAMPLE
|
|||
continue;
|
||||
}
|
||||
|
||||
if (! $node->args[$position] instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->refactorArgument($node->args[$position]);
|
||||
|
||||
return $node;
|
||||
|
@ -145,6 +149,10 @@ CODE_SAMPLE
|
|||
continue;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[$position] instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->refactorArgument($funcCall->args[$position]);
|
||||
|
||||
return $funcCall;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodingStyle\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\BinaryOp\Greater;
|
||||
|
@ -71,6 +72,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Expr $expr */
|
||||
$expr = $node->args[0]->value;
|
||||
|
||||
|
@ -113,6 +122,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($booleanNot->expr->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $booleanNot->expr->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Expr $expr */
|
||||
$expr = $booleanNot->expr->args[0]->value;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodingStyle\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
use PhpParser\Node\Expr\BinaryOp\Greater;
|
||||
|
@ -18,6 +19,7 @@ use PhpParser\Node\Expr\FuncCall;
|
|||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Scalar\LNumber;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Util\PhpVersionFactory;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -49,7 +51,8 @@ final class VersionCompareFuncCallToConstantRector extends AbstractRector
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
private PhpVersionFactory $phpVersionFactory
|
||||
private PhpVersionFactory $phpVersionFactory,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -104,14 +107,20 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $this->isPhpVersionConstant($node->args[0]->value) && ! $this->isPhpVersionConstant(
|
||||
$node->args[1]->value
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($node->args, [0, 1, 2])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg[] $args */
|
||||
$args = $node->args;
|
||||
if (! $this->isPhpVersionConstant($args[0]->value) && ! $this->isPhpVersionConstant(
|
||||
$args[1]->value
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$left = $this->getNewNodeForArg($node->args[0]->value);
|
||||
$right = $this->getNewNodeForArg($node->args[1]->value);
|
||||
$left = $this->getNewNodeForArg($args[0]->value);
|
||||
$right = $this->getNewNodeForArg($args[1]->value);
|
||||
if ($left === null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -121,7 +130,7 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
/** @var String_ $operator */
|
||||
$operator = $node->args[2]->value;
|
||||
$operator = $args[2]->value;
|
||||
$comparisonClass = self::OPERATOR_TO_COMPARISON[$operator->value];
|
||||
|
||||
return new $comparisonClass($left, $right);
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\CodingStyle\Rector\MethodCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
|
@ -75,6 +76,10 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$argValue = $node->args[0]->value;
|
||||
if (! $argValue instanceof FuncCall) {
|
||||
return null;
|
||||
|
@ -88,6 +93,10 @@ CODE_SAMPLE
|
|||
$assign = new Assign($messageVariable, $argValue);
|
||||
$this->nodesToAddCollector->addNodeBeforeNode($assign, $node);
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$node->args[0]->value = $messageVariable;
|
||||
|
||||
return $node;
|
||||
|
|
|
@ -8,6 +8,7 @@ use PhpParser\Node\Arg;
|
|||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\VariadicPlaceholder;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\MethodReflection;
|
||||
|
@ -56,7 +57,7 @@ final class CurrentAndParentClassMethodComparator
|
|||
}
|
||||
|
||||
/**
|
||||
* @param Arg[] $parentStaticCallArgs
|
||||
* @param Arg[]|VariadicPlaceholder[] $parentStaticCallArgs
|
||||
* @param Param[] $currentClassMethodParams
|
||||
*/
|
||||
private function areArgsAndParamsEqual(array $parentStaticCallArgs, array $currentClassMethodParams): bool
|
||||
|
@ -74,6 +75,10 @@ final class CurrentAndParentClassMethodComparator
|
|||
return false;
|
||||
}
|
||||
|
||||
if (! $arg instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// this only compares variable name, but those can be differnt, so its kinda useless
|
||||
$param = $currentClassMethodParams[$key];
|
||||
if (! $this->nodeComparator->areNodesEqual($param->var, $arg->value)) {
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DeadCode;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Equal;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
|
@ -88,7 +89,7 @@ final class ConditionResolver
|
|||
|
||||
// includes compare sign as 3rd argument
|
||||
$versionCompareSign = null;
|
||||
if (isset($funcCall->args[2])) {
|
||||
if (isset($funcCall->args[2]) && $funcCall->args[2] instanceof Arg) {
|
||||
$versionCompareSign = $this->valueResolver->getValue($funcCall->args[2]->value);
|
||||
}
|
||||
|
||||
|
@ -112,6 +113,14 @@ final class ConditionResolver
|
|||
|
||||
private function resolveArgumentValue(FuncCall $funcCall, int $argumentPosition): ?int
|
||||
{
|
||||
if (! isset($funcCall->args[$argumentPosition])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[$argumentPosition] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArgValue = $funcCall->args[$argumentPosition]->value;
|
||||
|
||||
/** @var mixed|null $version */
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DeadCode\NodeManipulator;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Greater;
|
||||
use PhpParser\Node\Expr\BinaryOp\GreaterOrEqual;
|
||||
|
@ -103,6 +104,14 @@ final class CountManipulator
|
|||
return false;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$countedExpr = $node->args[0]->value;
|
||||
|
||||
return $this->nodeComparator->areNodesEqual($countedExpr, $expr);
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DeadCode\Rector\Assign;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
|
@ -158,6 +159,10 @@ CODE_SAMPLE
|
|||
Assign $assign
|
||||
): bool {
|
||||
foreach ($expr->args as $arg) {
|
||||
if (! $arg instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$variable = $arg->value;
|
||||
if (! $variable instanceof Variable) {
|
||||
continue;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DeadCode\Rector\If_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
|
@ -90,6 +91,14 @@ CODE_SAMPLE
|
|||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $node->cond;
|
||||
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$functionToExistName = $this->valueResolver->getValue($funcCall->args[0]->value);
|
||||
if (! is_string($functionToExistName)) {
|
||||
return null;
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\Defluent\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use PHPStan\Type\MixedType;
|
||||
|
@ -36,6 +37,14 @@ final class NewFluentChainMethodCallNodeAnalyzer
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($methodCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $methodCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$onlyArgValue = $methodCall->args[0]->value;
|
||||
if (! $onlyArgValue instanceof New_) {
|
||||
return null;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DependencyInjection\NodeRemover;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
|
@ -89,6 +90,10 @@ final class ClassMethodNodeRemover
|
|||
private function removeParamFromArgs(StaticCall $staticCall, string $paramName): void
|
||||
{
|
||||
foreach ($staticCall->args as $key => $arg) {
|
||||
if (! $arg instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $this->nodeNameResolver->isName($arg->value, $paramName)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp70\Rector\Expression;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Const_;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -12,6 +13,7 @@ use PhpParser\Node\Scalar\String_;
|
|||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeNestingScope\ParentFinder;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -23,7 +25,8 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
final class DowngradeDefineArrayConstantRector extends AbstractRector
|
||||
{
|
||||
public function __construct(
|
||||
private ParentFinder $parentFinder
|
||||
private ParentFinder $parentFinder,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -76,12 +79,15 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg[] $args */
|
||||
$args = $funcCall->args;
|
||||
|
||||
/** @var String_ $arg0 */
|
||||
$arg0 = $funcCall->args[0]->value;
|
||||
$arg0 = $args[0]->value;
|
||||
$arg0Value = $arg0->value;
|
||||
|
||||
/** @var Array_ $arg1Value */
|
||||
$arg1Value = $funcCall->args[1]->value;
|
||||
$arg1Value = $args[1]->value;
|
||||
|
||||
return new Node\Stmt\Const_([new Const_($arg0Value, $arg1Value)]);
|
||||
}
|
||||
|
@ -93,6 +99,12 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
$args = $funcCall->args;
|
||||
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($args, [0, 1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @var Arg[] $args */
|
||||
if (! $args[0]->value instanceof String_) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,14 @@ CODE_SAMPLE
|
|||
|
||||
$currentStatement = $node->getAttribute(AttributeKey::CURRENT_STATEMENT);
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Array_ $options */
|
||||
$options = $node->args[0]->value;
|
||||
|
||||
|
@ -99,6 +107,10 @@ CODE_SAMPLE
|
|||
return true;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ! $funcCall->args[0]->value instanceof Array_;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use PhpParser\Node\Expr\Assign;
|
|||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt\Foreach_;
|
||||
use PhpParser\Node\VariadicPlaceholder;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -73,6 +74,7 @@ CODE_SAMPLE
|
|||
$args[] = $arrayItem instanceof ArrayItem ? new Arg($arrayItem->value) : null;
|
||||
}
|
||||
|
||||
/** @var Arg[]|VariadicPlaceholder[] $args */
|
||||
return new FuncCall(new Name('list'), $args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp71\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Instanceof_;
|
||||
|
@ -67,6 +68,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var mixed $arg */
|
||||
$arg = $node->args[0]->value;
|
||||
$funcCall = $this->nodeFactory->createFuncCall('is_array', [$arg]);
|
||||
|
|
|
@ -70,6 +70,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$tempVariableName = $this->variableNaming->createCountedValueName(
|
||||
'callable',
|
||||
$node->getAttribute(AttributeKey::SCOPE)
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp71\Rector\String_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\BinaryOp\Minus;
|
||||
|
@ -104,12 +105,20 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $args[2]->value instanceof UnaryMinus) {
|
||||
if ($args[2] instanceof Arg && ! $args[2]->value instanceof UnaryMinus) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[2] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$strlenFuncCall = $this->nodeFactory->createFuncCall('strlen', [$args[0]]);
|
||||
$funcCall->args[2]->value = new Minus($strlenFuncCall, $args[2]->value->expr);
|
||||
$funcCall->args[2]->value = new Minus($strlenFuncCall, $funcCall->args[2]->value->expr);
|
||||
|
||||
return $funcCall;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\DowngradePhp72\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
|
@ -39,6 +40,14 @@ final class FunctionExistsFunCallAnalyzer
|
|||
/** @var FuncCall $functionExists */
|
||||
$functionExists = $firstParentIf->cond;
|
||||
|
||||
if (! isset($functionExists->args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $functionExists->args[0] instanceof Arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->valueResolver->isValue($functionExists->args[0]->value, $functionName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Rector\DowngradePhp72\Rector\FuncCall;
|
|||
|
||||
use Nette\NotImplementedException;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp\BitwiseOr;
|
||||
|
@ -70,7 +71,7 @@ final class DowngradePregUnmatchedAsNullConstantRector extends AbstractRector
|
|||
return null;
|
||||
}
|
||||
|
||||
$args = $node->args;
|
||||
$args = $node->getArgs();
|
||||
if (! isset($args[3])) {
|
||||
return null;
|
||||
}
|
||||
|
@ -81,7 +82,7 @@ final class DowngradePregUnmatchedAsNullConstantRector extends AbstractRector
|
|||
|
||||
if ($flags instanceof BitwiseOr) {
|
||||
$this->cleanBitWiseOrFlags($node, $flags);
|
||||
if (! $this->nodeComparator->areNodesEqual($flags, $node->args[3]->value)) {
|
||||
if (! $this->nodeComparator->areNodesEqual($flags, $args[3]->value)) {
|
||||
return $this->handleEmptyStringToNullMatch($node, $variable);
|
||||
}
|
||||
|
||||
|
@ -245,6 +246,10 @@ CODE_SAMPLE
|
|||
$bitwiseOr = $bitwiseOr->right;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[3] instanceof Arg) {
|
||||
return;
|
||||
}
|
||||
|
||||
$funcCall->args[3]->value = $bitwiseOr;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp73\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
|
@ -71,8 +72,16 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
private function refactorArrayKeyFirst(FuncCall $funcCall): FuncCall
|
||||
private function refactorArrayKeyFirst(FuncCall $funcCall): ?FuncCall
|
||||
{
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$array = $funcCall->args[0]->value;
|
||||
|
||||
$resetFuncCall = $this->nodeFactory->createFuncCall('reset', [$array]);
|
||||
|
@ -83,8 +92,16 @@ CODE_SAMPLE
|
|||
return $funcCall;
|
||||
}
|
||||
|
||||
private function refactorArrayKeyLast(FuncCall $funcCall): FuncCall
|
||||
private function refactorArrayKeyLast(FuncCall $funcCall): ?FuncCall
|
||||
{
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$array = $funcCall->args[0]->value;
|
||||
$resetFuncCall = $this->nodeFactory->createFuncCall('end', [$array]);
|
||||
$this->nodesToAddCollector->addNodeBeforeNode($resetFuncCall, $funcCall);
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp73\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Instanceof_;
|
||||
|
@ -55,6 +56,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$isArrayFuncCall = $this->nodeFactory->createFuncCall('is_array', $node->args);
|
||||
$instanceof = new Instanceof_($node->args[0]->value, new FullyQualified('Countable'));
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use PhpParser\Node\Expr\ArrayItem;
|
|||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -65,6 +66,10 @@ CODE_SAMPLE
|
|||
);
|
||||
}
|
||||
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
|
@ -102,7 +107,7 @@ CODE_SAMPLE
|
|||
return true;
|
||||
}
|
||||
|
||||
return ! ($funcCall->args[2]->value instanceof Array_);
|
||||
return ! ($funcCall->args[2] instanceof Arg && $funcCall->args[2]->value instanceof Array_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,10 +117,23 @@ CODE_SAMPLE
|
|||
{
|
||||
$this->highestIndex = 1;
|
||||
|
||||
$newArgs = [$funcCall->args[0], $funcCall->args[1]];
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($funcCall->args, [0, 1, 2])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $funcCall->args[0];
|
||||
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $funcCall->args[1];
|
||||
|
||||
$newArgs = [$firstArg, $secondArg];
|
||||
|
||||
/** @var Arg $thirdArg */
|
||||
$thirdArg = $funcCall->args[2];
|
||||
|
||||
/** @var Array_ $optionsArray */
|
||||
$optionsArray = $funcCall->args[2]->value;
|
||||
$optionsArray = $thirdArg->value;
|
||||
/** @var ArrayItem|null $arrayItem */
|
||||
foreach ($optionsArray->items as $arrayItem) {
|
||||
if ($arrayItem === null) {
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp74\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\NullableType;
|
||||
|
@ -155,7 +156,7 @@ CODE_SAMPLE
|
|||
|
||||
private function resolveDifferentAncestorReturnType(
|
||||
ClassMethod $classMethod,
|
||||
UnionType | NullableType | Name | Identifier $returnTypeNode
|
||||
UnionType | NullableType | Name | Identifier | ComplexType $returnTypeNode
|
||||
): Type {
|
||||
$scope = $classMethod->getAttribute(AttributeKey::SCOPE);
|
||||
if (! $scope instanceof Scope) {
|
||||
|
|
|
@ -99,7 +99,9 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$allowableTagsParam = $node->args[1]->value;
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $node->args[1];
|
||||
$allowableTagsParam = $secondArg->value;
|
||||
|
||||
if ($allowableTagsParam instanceof Array_) {
|
||||
// If it is an array, convert it to string
|
||||
|
@ -141,6 +143,14 @@ CODE_SAMPLE
|
|||
return true;
|
||||
}
|
||||
|
||||
if (! isset($funcCall->args[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[1] instanceof Arg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Process anything other than String and null (eg: variables, function calls)
|
||||
$allowableTagsParam = $funcCall->args[1]->value;
|
||||
|
||||
|
|
|
@ -117,11 +117,12 @@ CODE_SAMPLE
|
|||
|
||||
private function processArgs(FuncCall | MethodCall | StaticCall | New_ $node): ?Node
|
||||
{
|
||||
if ($node->args === []) {
|
||||
$args = $node->getArgs();
|
||||
if ($args === []) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->cleanTrailingComma($node, $node->args);
|
||||
return $this->cleanTrailingComma($node, $args);
|
||||
}
|
||||
|
||||
private function processUses(Closure $node): void
|
||||
|
|
|
@ -5,10 +5,12 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp80\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -20,6 +22,11 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class DowngradeStrContainsRector extends AbstractRector
|
||||
{
|
||||
public function __construct(
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition(
|
||||
|
@ -70,8 +77,17 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$haystack = $funcCall->args[0]->value;
|
||||
$needle = $funcCall->args[1]->value;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($funcCall->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $funcCall->args[0];
|
||||
$haystack = $firstArg->value;
|
||||
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $funcCall->args[1];
|
||||
$needle = $secondArg->value;
|
||||
|
||||
$funcCall = $this->nodeFactory->createFuncCall('strpos', [$haystack, $needle]);
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ final class DowngradeStrEndsWithRector extends AbstractRector
|
|||
|
||||
private function createSubstrCompareFuncCall(FuncCall $funcCall): FuncCall
|
||||
{
|
||||
$args = $funcCall->args;
|
||||
$args = $funcCall->getArgs();
|
||||
|
||||
$strlenFuncCall = $this->createStrlenFuncCall($funcCall->args[1]->value);
|
||||
$strlenFuncCall = $this->createStrlenFuncCall($args[1]->value);
|
||||
$args[] = new Arg(new UnaryMinus($strlenFuncCall));
|
||||
|
||||
return new FuncCall(new Name('substr_compare'), $args);
|
||||
|
|
|
@ -81,7 +81,7 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
$args = $node->args;
|
||||
$args = $node->getArgs();
|
||||
if ($this->shouldSkip($args)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -119,12 +119,22 @@ CODE_SAMPLE
|
|||
return true;
|
||||
}
|
||||
|
||||
if (! isset($methodCall->args[0])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! $methodCall->args[0] instanceof Arg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ! $this->getStaticType($methodCall->args[0]->value) instanceof StringType;
|
||||
}
|
||||
|
||||
private function updateNode(MethodCall $methodCall): MethodCall
|
||||
{
|
||||
$methodCall->args[0] = new Arg($this->createNewAnonymousEventClass($methodCall->args[0]->value));
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $methodCall->args[0];
|
||||
$methodCall->args[0] = new Arg($this->createNewAnonymousEventClass($firstArg->value));
|
||||
return $methodCall;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\MockeryToProphecy\Collector;
|
||||
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
|
@ -42,6 +43,14 @@ final class MockVariableCollector
|
|||
/** @var string $variableName */
|
||||
$variableName = $this->nodeNameResolver->getName($variable);
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$type = $node->args[0]->value;
|
||||
|
||||
$mockedType = $this->valueResolver->getValue($type);
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\MysqlToMysqli\Rector\Assign;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -152,7 +153,7 @@ CODE_SAMPLE
|
|||
private function processMysqlResult(Assign $assign, FuncCall $funcCall): FuncCall
|
||||
{
|
||||
$fetchField = null;
|
||||
if (isset($funcCall->args[2])) {
|
||||
if (isset($funcCall->args[2]) && $funcCall->args[2] instanceof Arg) {
|
||||
$fetchField = $funcCall->args[2]->value;
|
||||
unset($funcCall->args[2]);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ CODE_SAMPLE
|
|||
/**
|
||||
* @param FuncCall $node
|
||||
*/
|
||||
public function refactor(Node $node): FuncCall
|
||||
public function refactor(Node $node): ?FuncCall
|
||||
{
|
||||
if ($this->isName($node, 'mysql_create_db')) {
|
||||
return $this->processMysqlCreateDb($node);
|
||||
|
@ -71,14 +71,14 @@ CODE_SAMPLE
|
|||
$node->args[0] = new Arg(new String_('SHOW DATABASES'));
|
||||
}
|
||||
|
||||
if ($this->isName($node, 'mysql_list_fields')) {
|
||||
if ($this->isName($node, 'mysql_list_fields') && $node->args[0] instanceof Arg && $node->args[1] instanceof Arg) {
|
||||
$node->name = new Name(self::MYSQLI_QUERY);
|
||||
$node->args[0]->value = $this->joinStringWithNode('SHOW COLUMNS FROM', $node->args[1]->value);
|
||||
|
||||
unset($node->args[1]);
|
||||
}
|
||||
|
||||
if ($this->isName($node, 'mysql_list_tables')) {
|
||||
if ($this->isName($node, 'mysql_list_tables') && $node->args[0] instanceof Arg) {
|
||||
$node->name = new Name(self::MYSQLI_QUERY);
|
||||
$node->args[0]->value = $this->joinStringWithNode('SHOW TABLES FROM', $node->args[0]->value);
|
||||
}
|
||||
|
@ -86,16 +86,32 @@ CODE_SAMPLE
|
|||
return $node;
|
||||
}
|
||||
|
||||
private function processMysqlCreateDb(FuncCall $funcCall): FuncCall
|
||||
private function processMysqlCreateDb(FuncCall $funcCall): ?FuncCall
|
||||
{
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$funcCall->name = new Name(self::MYSQLI_QUERY);
|
||||
$funcCall->args[0]->value = $this->joinStringWithNode('CREATE DATABASE', $funcCall->args[0]->value);
|
||||
|
||||
return $funcCall;
|
||||
}
|
||||
|
||||
private function processMysqlDropDb(FuncCall $funcCall): FuncCall
|
||||
private function processMysqlDropDb(FuncCall $funcCall): ?FuncCall
|
||||
{
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$funcCall->name = new Name(self::MYSQLI_QUERY);
|
||||
$funcCall->args[0]->value = $this->joinStringWithNode('DROP DATABASE', $funcCall->args[0]->value);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\MysqlToMysqli\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Concat;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -67,6 +68,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$node->name = new Name('mysqli_connect');
|
||||
|
||||
$node->args[0]->value = $this->joinStringWithNode('p:', $node->args[0]->value);
|
||||
|
|
|
@ -131,9 +131,10 @@ CODE_SAMPLE
|
|||
continue;
|
||||
}
|
||||
|
||||
$args = $node->getArgs();
|
||||
if (
|
||||
$node->args === []
|
||||
|| ! $this->isProbablyMysql($node->args[0]->value)
|
||||
$args === []
|
||||
|| ! $this->isProbablyMysql($args[0]->value)
|
||||
) {
|
||||
$connectionVariable = $this->findConnectionVariable($node);
|
||||
|
||||
|
@ -143,7 +144,7 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$node->args = array_merge([new Arg($connectionVariable)], $node->args);
|
||||
$node->args = array_merge([new Arg($connectionVariable)], $node->getArgs());
|
||||
}
|
||||
|
||||
$node->name = new Name($newFunction);
|
||||
|
|
|
@ -235,6 +235,14 @@ final class VariableNaming
|
|||
string $fallbackName,
|
||||
string $suffix
|
||||
): string {
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$argumentValue = $funcCall->args[0]->value;
|
||||
if ($argumentValue instanceof MethodCall || $argumentValue instanceof StaticCall) {
|
||||
$name = $this->nodeNameResolver->getName($argumentValue->name);
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php53\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\MagicConst\Dir;
|
||||
use PhpParser\Node\Scalar\MagicConst\File;
|
||||
|
@ -67,6 +68,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArgValue = $node->args[0]->value;
|
||||
if (! $firstArgValue instanceof File) {
|
||||
return null;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php54\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
|
@ -63,6 +64,10 @@ CODE_SAMPLE
|
|||
public function refactor(Node $node): FuncCall
|
||||
{
|
||||
foreach ($node->args as $nodeArg) {
|
||||
if (! $nodeArg instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($nodeArg->byRef) {
|
||||
$nodeArg->byRef = false;
|
||||
}
|
||||
|
|
|
@ -5,10 +5,12 @@ declare(strict_types=1);
|
|||
namespace Rector\Php55\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Php55\RegexMatcher;
|
||||
|
@ -26,7 +28,8 @@ final class PregReplaceEModifierRector extends AbstractRector implements MinPhpV
|
|||
{
|
||||
public function __construct(
|
||||
private AnonymousFunctionFactory $anonymousFunctionFactory,
|
||||
private RegexMatcher $regexMatcher
|
||||
private RegexMatcher $regexMatcher,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -84,13 +87,21 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$firstArgumentValue = $node->args[0]->value;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($node->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArgument */
|
||||
$firstArgument = $node->args[0];
|
||||
$firstArgumentValue = $firstArgument->value;
|
||||
$patternWithoutE = $this->regexMatcher->resolvePatternExpressionWithoutEIfFound($firstArgumentValue);
|
||||
if (! $patternWithoutE instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$secondArgumentValue = $node->args[1]->value;
|
||||
/** @var Arg $secondArgument */
|
||||
$secondArgument = $node->args[1];
|
||||
$secondArgumentValue = $secondArgument->value;
|
||||
$anonymousFunction = $this->anonymousFunctionFactory->createAnonymousFunctionFromString(
|
||||
$secondArgumentValue
|
||||
);
|
||||
|
@ -99,8 +110,8 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
$node->name = new Name('preg_replace_callback');
|
||||
$node->args[0]->value = $patternWithoutE;
|
||||
$node->args[1]->value = $anonymousFunction;
|
||||
$firstArgument->value = $patternWithoutE;
|
||||
$secondArgument->value = $anonymousFunction;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@ declare(strict_types=1);
|
|||
namespace Rector\Php56\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp\Pow;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
|
@ -18,6 +20,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class PowToExpRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition(
|
||||
|
@ -47,10 +53,16 @@ final class PowToExpRector extends AbstractRector implements MinPhpVersionInterf
|
|||
return null;
|
||||
}
|
||||
|
||||
$firstArgument = $node->args[0]->value;
|
||||
$secondArgument = $node->args[1]->value;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($node->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Pow($firstArgument, $secondArgument);
|
||||
/** @var Arg $firstArgument */
|
||||
$firstArgument = $node->args[0];
|
||||
/** @var Arg $secondArgument */
|
||||
$secondArgument = $node->args[1];
|
||||
|
||||
return new Pow($firstArgument->value, $secondArgument->value);
|
||||
}
|
||||
|
||||
public function provideMinPhpVersion(): int
|
||||
|
|
|
@ -65,7 +65,7 @@ final class CallUserMethodRector extends AbstractRector implements MinPhpVersion
|
|||
$newName = self::OLD_TO_NEW_FUNCTIONS[$this->getName($node)];
|
||||
$node->name = new Name($newName);
|
||||
|
||||
$oldArgs = $node->args;
|
||||
$oldArgs = $node->getArgs();
|
||||
|
||||
unset($node->args[1]);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use PhpParser\Node\Expr\Variable;
|
|||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Scalar\LNumber;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
|
@ -43,7 +44,8 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
private EregToPcreTransformer $eregToPcreTransformer
|
||||
private EregToPcreTransformer $eregToPcreTransformer,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -68,21 +70,34 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
return [FuncCall::class];
|
||||
}
|
||||
|
||||
private function shouldSkip(FuncCall $funcCall): bool
|
||||
{
|
||||
$functionName = $this->getName($funcCall);
|
||||
if ($functionName === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! isset(self::OLD_NAMES_TO_NEW_ONES[$functionName])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ! $this->argsAnalyzer->isArgInstanceInArgsPosition($funcCall->args, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FuncCall $node
|
||||
*/
|
||||
public function refactor(Node $node): ?Node
|
||||
{
|
||||
if ($this->shouldSkip($node)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var string $functionName */
|
||||
$functionName = $this->getName($node);
|
||||
if ($functionName === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! isset(self::OLD_NAMES_TO_NEW_ONES[$functionName])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$patternNode = $node->args[0]->value;
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
$patternNode = $firstArg->value;
|
||||
if ($patternNode instanceof String_) {
|
||||
$this->processStringPattern($node, $patternNode, $functionName);
|
||||
} elseif ($patternNode instanceof Variable) {
|
||||
|
@ -94,7 +109,7 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
$node->name = new Name(self::OLD_NAMES_TO_NEW_ONES[$functionName]);
|
||||
|
||||
// ereg|eregi 3rd argument return value fix
|
||||
if (in_array($functionName, ['ereg', 'eregi'], true) && isset($node->args[2])) {
|
||||
if (in_array($functionName, ['ereg', 'eregi'], true) && isset($node->args[2]) && $node->args[2] instanceof Arg) {
|
||||
$parentNode = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if ($parentNode instanceof Assign) {
|
||||
return $this->createTernaryWithStrlenOfFirstMatch($node);
|
||||
|
@ -109,7 +124,9 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
$pattern = $string->value;
|
||||
$pattern = $this->eregToPcreTransformer->transform($pattern, $this->isCaseInsensitiveFunction($functionName));
|
||||
|
||||
$funcCall->args[0]->value = new String_($pattern);
|
||||
/** @var Arg $arg */
|
||||
$arg = $funcCall->args[0];
|
||||
$arg->value = new String_($pattern);
|
||||
}
|
||||
|
||||
private function processVariablePattern(FuncCall $funcCall, Variable $variable, string $functionName): void
|
||||
|
@ -124,7 +141,9 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
$endDelimiter = $this->isCaseInsensitiveFunction($functionName) ? '#mi' : '#m';
|
||||
$concat = new Concat($startConcat, new String_($endDelimiter));
|
||||
|
||||
$funcCall->args[0]->value = $concat;
|
||||
/** @var Arg $arg */
|
||||
$arg = $funcCall->args[0];
|
||||
$arg->value = $concat;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,6 +154,14 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
*/
|
||||
private function processSplitLimitArgument(FuncCall $funcCall, string $functionName): void
|
||||
{
|
||||
if (! isset($funcCall->args[2])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[2] instanceof Arg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! \str_starts_with($functionName, 'split')) {
|
||||
return;
|
||||
}
|
||||
|
@ -159,7 +186,9 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
|
||||
private function createTernaryWithStrlenOfFirstMatch(FuncCall $funcCall): Ternary
|
||||
{
|
||||
$arrayDimFetch = new ArrayDimFetch($funcCall->args[2]->value, new LNumber(0));
|
||||
/** @var Arg $thirdArg */
|
||||
$thirdArg = $funcCall->args[2];
|
||||
$arrayDimFetch = new ArrayDimFetch($thirdArg->value, new LNumber(0));
|
||||
$strlenFuncCall = $this->nodeFactory->createFuncCall('strlen', [$arrayDimFetch]);
|
||||
|
||||
return new Ternary($funcCall, $strlenFuncCall, $this->nodeFactory->createFalse());
|
||||
|
|
|
@ -82,25 +82,26 @@ final class MultiDirnameRector extends AbstractRector implements MinPhpVersionIn
|
|||
return null;
|
||||
}
|
||||
|
||||
if (count($funcCall->args) >= 3) {
|
||||
$args = $funcCall->getArgs();
|
||||
if (count($args) >= 3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// dirname($path, <LEVEL>);
|
||||
if (count($funcCall->args) === 2) {
|
||||
if (! $funcCall->args[1]->value instanceof LNumber) {
|
||||
if (count($args) === 2) {
|
||||
if (! $args[1]->value instanceof LNumber) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var LNumber $levelNumber */
|
||||
$levelNumber = $funcCall->args[1]->value;
|
||||
$levelNumber = $args[1]->value;
|
||||
|
||||
$this->nestingLevel += $levelNumber->value;
|
||||
} else {
|
||||
++$this->nestingLevel;
|
||||
}
|
||||
|
||||
$nestedFuncCallNode = $funcCall->args[0]->value;
|
||||
$nestedFuncCallNode = $args[0]->value;
|
||||
if (! $nestedFuncCallNode instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php70\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
|
@ -21,6 +22,7 @@ use PHPStan\Analyser\MutatingScope;
|
|||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ParameterReflection;
|
||||
use PHPStan\Type\MixedType;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
|
@ -42,7 +44,8 @@ final class NonVariableToVariableOnFunctionCallRector extends AbstractRector imp
|
|||
public function __construct(
|
||||
private VariableNaming $variableNaming,
|
||||
private ParentScopeFinder $parentScopeFinder,
|
||||
private ReflectionResolver $reflectionResolver
|
||||
private ReflectionResolver $reflectionResolver,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -88,6 +91,10 @@ final class NonVariableToVariableOnFunctionCallRector extends AbstractRector imp
|
|||
}
|
||||
|
||||
foreach ($arguments as $key => $argument) {
|
||||
if (! $node->args[$key] instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$replacements = $this->getReplacementsFor($argument, $currentScope, $scopeNode);
|
||||
|
||||
$current = $node->getAttribute(AttributeKey::CURRENT_STATEMENT);
|
||||
|
@ -129,7 +136,7 @@ final class NonVariableToVariableOnFunctionCallRector extends AbstractRector imp
|
|||
/** @var ParameterReflection $parameterReflection */
|
||||
foreach ($parametersAcceptor->getParameters() as $key => $parameterReflection) {
|
||||
// omitted optional parameter
|
||||
if (! isset($call->args[$key])) {
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($call->args, $key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -137,7 +144,9 @@ final class NonVariableToVariableOnFunctionCallRector extends AbstractRector imp
|
|||
continue;
|
||||
}
|
||||
|
||||
$argument = $call->args[$key]->value;
|
||||
/** @var Arg $arg */
|
||||
$arg = $call->args[$key];
|
||||
$argument = $arg->value;
|
||||
|
||||
if ($this->isVariableLikeNode($argument)) {
|
||||
continue;
|
||||
|
|
|
@ -54,6 +54,14 @@ final class IsArrayAndDualCheckToAble
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// both use same var
|
||||
if (! $funcCall->args[0]->value instanceof Variable) {
|
||||
return null;
|
||||
|
|
|
@ -87,7 +87,9 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$countedNode = $node->args[0]->value;
|
||||
/** @var Arg $arg0 */
|
||||
$arg0 = $node->args[0];
|
||||
$countedNode = $arg0->value;
|
||||
if ($this->countableTypeAnalyzer->isCountableType($countedNode)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -143,6 +145,10 @@ CODE_SAMPLE
|
|||
return true;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($funcCall->args[0]->value instanceof ClassConstFetch) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Rector\Php72\NodeFactory;
|
|||
|
||||
use Nette\Utils\Strings;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
|
@ -68,7 +69,7 @@ final class AnonymousFunctionFactory
|
|||
public function create(
|
||||
array $params,
|
||||
array $stmts,
|
||||
Identifier | Name | NullableType | UnionType | null $returnTypeNode
|
||||
Identifier | Name | NullableType | UnionType | ComplexType | null $returnTypeNode
|
||||
): Closure {
|
||||
$useVariables = $this->createUseVariablesFromParams($stmts, $params);
|
||||
|
||||
|
|
|
@ -75,6 +75,15 @@ CODE_SAMPLE
|
|||
|
||||
/** @var FuncCall $eachFuncCall */
|
||||
$eachFuncCall = $node->expr;
|
||||
|
||||
if (! isset($eachFuncCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $eachFuncCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$eachedVariable = $eachFuncCall->args[0]->value;
|
||||
|
||||
$assignVariable = $node->var;
|
||||
|
|
|
@ -18,6 +18,7 @@ use PhpParser\Node\Scalar\String_;
|
|||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Php\ReservedKeywordAnalyzer;
|
||||
use Rector\Core\PhpParser\Parser\InlineCodeParser;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
|
@ -37,7 +38,8 @@ final class CreateFunctionToAnonymousFunctionRector extends AbstractRector imple
|
|||
public function __construct(
|
||||
private InlineCodeParser $inlineCodeParser,
|
||||
private AnonymousFunctionFactory $anonymousFunctionFactory,
|
||||
private ReservedKeywordAnalyzer $reservedKeywordAnalyzer
|
||||
private ReservedKeywordAnalyzer $reservedKeywordAnalyzer,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -96,8 +98,17 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$params = $this->createParamsFromString($node->args[0]->value);
|
||||
$stmts = $this->parseStringToBody($node->args[1]->value);
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($node->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $node->args[1];
|
||||
|
||||
$params = $this->createParamsFromString($firstArg->value);
|
||||
$stmts = $this->parseStringToBody($secondArg->value);
|
||||
|
||||
$refactored = $this->anonymousFunctionFactory->create($params, $stmts, null);
|
||||
foreach ($refactored->uses as $key => $use) {
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php72\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -77,6 +78,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArgValue = $node->args[0]->value;
|
||||
|
||||
// only relevant inside the class
|
||||
|
@ -149,6 +158,14 @@ CODE_SAMPLE
|
|||
return false;
|
||||
}
|
||||
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->nodeComparator->areNodesEqual(
|
||||
$ternary->cond->left,
|
||||
$funcCall->args[0]->value
|
||||
|
@ -172,6 +189,14 @@ CODE_SAMPLE
|
|||
return false;
|
||||
}
|
||||
|
||||
if (! isset($funcCall->args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $funcCall->args[0] instanceof Arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->nodeComparator->areNodesEqual(
|
||||
$ternary->cond->left,
|
||||
$funcCall->args[0]->value
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php72\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PHPStan\Type\ObjectType;
|
||||
|
@ -65,6 +66,14 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
$incompleteClassObjectType = new ObjectType('__PHP_Incomplete_Class');
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->isObjectType($node->args[0]->value, $incompleteClassObjectType)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php72\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ConstFetch;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
|
@ -77,6 +78,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->stringTypeAnalyzer->isStringOrUnionStringOnlyType($node->args[0]->value)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,10 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[0]->value instanceof String_) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php72\Rector\While_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -99,6 +100,14 @@ CODE_SAMPLE
|
|||
/** @var List_ $listNode */
|
||||
$listNode = $assignNode->var;
|
||||
|
||||
if (! isset($eachFuncCall->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $eachFuncCall->args[0] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$foreachedExpr = count($listNode->items) === 1 ? $this->nodeFactory->createFuncCall(
|
||||
'array_keys',
|
||||
[$eachFuncCall->args[0]]
|
||||
|
|
|
@ -104,12 +104,12 @@ CODE_SAMPLE
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($funcCall->args[2]->value instanceof Array_) {
|
||||
if ($funcCall->args[2] instanceof Arg && $funcCall->args[2]->value instanceof Array_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($argsCount === 3) {
|
||||
return $funcCall->args[2]->value instanceof Variable;
|
||||
return $funcCall->args[2] instanceof Arg && $funcCall->args[2]->value instanceof Variable;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -122,7 +122,7 @@ CODE_SAMPLE
|
|||
{
|
||||
$items = [];
|
||||
|
||||
$args = $funcCall->args;
|
||||
$args = $funcCall->getArgs();
|
||||
|
||||
$newArgs = [];
|
||||
$newArgs[] = $args[0];
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php73\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Cast\String_;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
|
@ -80,6 +81,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// is argument string?
|
||||
$needleArgNode = $node->args[1]->value;
|
||||
if ($this->nodeTypeAnalyzer->isStringTypeExpr($needleArgNode)) {
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php74\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use PHPStan\Type\ObjectType;
|
||||
|
@ -73,6 +74,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! isset($node->args[1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$firstArgStaticType = $this->getStaticType($node->args[1]->value);
|
||||
if (! $firstArgStaticType instanceof ObjectType) {
|
||||
return null;
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php74\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
|
@ -104,6 +105,10 @@ CODE_SAMPLE
|
|||
$array = new Array_();
|
||||
|
||||
foreach ($funcCall->args as $arg) {
|
||||
if (! $arg instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// cannot handle unpacked arguments
|
||||
if ($arg->unpack) {
|
||||
return null;
|
||||
|
@ -144,8 +149,10 @@ CODE_SAMPLE
|
|||
private function resolveValue(Expr $expr): Expr
|
||||
{
|
||||
if ($expr instanceof FuncCall && $this->isIteratorToArrayFuncCall($expr)) {
|
||||
/** @var Arg $arg */
|
||||
$arg = $expr->args[0];
|
||||
/** @var FuncCall $expr */
|
||||
$expr = $expr->args[0]->value;
|
||||
$expr = $arg->value;
|
||||
}
|
||||
|
||||
if (! $expr instanceof Ternary) {
|
||||
|
@ -194,6 +201,14 @@ CODE_SAMPLE
|
|||
return false;
|
||||
}
|
||||
|
||||
return $this->nodeNameResolver->isName($expr, 'iterator_to_array');
|
||||
if (! $this->nodeNameResolver->isName($expr, 'iterator_to_array')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! isset($expr->args[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $expr->args[0] instanceof Arg;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\Php74\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
|
@ -66,6 +67,10 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[1] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! $this->isName($node->args[1]->value, 'FILTER_SANITIZE_MAGIC_QUOTES')) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,10 @@ final class MbStrrposEncodingArgumentPositionRector extends AbstractRector imple
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! $node->args[2] instanceof Arg) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$secondArgType = $this->getStaticType($node->args[2]->value);
|
||||
if ($secondArgType instanceof IntegerType) {
|
||||
return null;
|
||||
|
|
|
@ -11,6 +11,7 @@ use PhpParser\Node\Expr\New_;
|
|||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Name;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
|
@ -24,6 +25,10 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class ExportToReflectionFunctionRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
public function __construct(private ArgsAnalyzer $argsAnalyzer)
|
||||
{
|
||||
}
|
||||
|
||||
public function provideMinPhpVersion(): int
|
||||
{
|
||||
return PhpVersionFeature::EXPORT_TO_REFLECTION_FUNCTION;
|
||||
|
@ -75,9 +80,21 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$new = new New_($node->class, [new Arg($node->args[0]->value)]);
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset($node->args[1]) && $this->valueResolver->isTrue($node->args[1]->value)) {
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $node->args[0];
|
||||
$new = new New_($node->class, [new Arg($firstArg->value)]);
|
||||
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($node->args, 1)) {
|
||||
return $new;
|
||||
}
|
||||
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $node->args[1];
|
||||
if ($this->valueResolver->isTrue($secondArg->value)) {
|
||||
return new String_($new);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,14 @@ declare(strict_types=1);
|
|||
namespace Rector\Php80\MatchAndRefactor\StrStartsWithMatchAndRefactor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\LNumber;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\Php80\Contract\StrStartWithMatchAndRefactorInterface;
|
||||
|
@ -29,7 +31,8 @@ final class StrncmpMatchAndRefactor implements StrStartWithMatchAndRefactorInter
|
|||
private NodeNameResolver $nodeNameResolver,
|
||||
private StrStartsWithFactory $strStartsWithFactory,
|
||||
private NodeComparator $nodeComparator,
|
||||
private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory
|
||||
private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -76,7 +79,13 @@ final class StrncmpMatchAndRefactor implements StrStartWithMatchAndRefactorInter
|
|||
$strncmpFuncCall = $strStartsWith->getFuncCall();
|
||||
$needleExpr = $strStartsWith->getNeedleExpr();
|
||||
|
||||
$secondArgumentValue = $strncmpFuncCall->args[2]->value;
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($strncmpFuncCall->args, 2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $thirdArg */
|
||||
$thirdArg = $strncmpFuncCall->args[2];
|
||||
$secondArgumentValue = $thirdArg->value;
|
||||
if (! $secondArgumentValue instanceof FuncCall) {
|
||||
return false;
|
||||
}
|
||||
|
@ -86,8 +95,14 @@ final class StrncmpMatchAndRefactor implements StrStartWithMatchAndRefactorInter
|
|||
}
|
||||
|
||||
/** @var FuncCall $strlenFuncCall */
|
||||
$strlenFuncCall = $strncmpFuncCall->args[2]->value;
|
||||
$strlenArgumentValue = $strlenFuncCall->args[0]->value;
|
||||
$strlenFuncCall = $thirdArg->value;
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($strlenFuncCall->args, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $strlenFuncCall->args[0];
|
||||
$strlenArgumentValue = $firstArg->value;
|
||||
|
||||
return $this->nodeComparator->areNodesEqual($needleExpr, $strlenArgumentValue);
|
||||
}
|
||||
|
@ -96,12 +111,20 @@ final class StrncmpMatchAndRefactor implements StrStartWithMatchAndRefactorInter
|
|||
{
|
||||
$strncmpFuncCall = $strStartsWith->getFuncCall();
|
||||
|
||||
$hardcodedStringNeedle = $strncmpFuncCall->args[1]->value;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($strncmpFuncCall->args, [1, 2])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $strncmpFuncCall->args[1];
|
||||
$hardcodedStringNeedle = $secondArg->value;
|
||||
if (! $hardcodedStringNeedle instanceof String_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$lNumberLength = $strncmpFuncCall->args[2]->value;
|
||||
/** @var Arg $thirdArg */
|
||||
$thirdArg = $strncmpFuncCall->args[2];
|
||||
$lNumberLength = $thirdArg->value;
|
||||
if (! $lNumberLength instanceof LNumber) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ declare(strict_types=1);
|
|||
namespace Rector\Php80\MatchAndRefactor\StrStartsWithMatchAndRefactor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\Php80\Contract\StrStartWithMatchAndRefactorInterface;
|
||||
|
@ -22,7 +24,8 @@ final class StrposMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
public function __construct(
|
||||
private NodeNameResolver $nodeNameResolver,
|
||||
private ValueResolver $valueResolver,
|
||||
private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory
|
||||
private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -34,32 +37,18 @@ final class StrposMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
$isPositive = $binaryOp instanceof Identical;
|
||||
|
||||
if ($binaryOp->left instanceof FuncCall && $this->nodeNameResolver->isName($binaryOp->left, 'strpos')) {
|
||||
if (! $this->valueResolver->isValue($binaryOp->right, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $binaryOp->left;
|
||||
$haystack = $funcCall->args[0]->value;
|
||||
$needle = $funcCall->args[1]->value;
|
||||
|
||||
return new StrStartsWith($funcCall, $haystack, $needle, $isPositive);
|
||||
return $this->processBinaryOpLeft($binaryOp, $isPositive);
|
||||
}
|
||||
|
||||
if ($binaryOp->right instanceof FuncCall && $this->nodeNameResolver->isName($binaryOp->right, 'strpos')) {
|
||||
if (! $this->valueResolver->isValue($binaryOp->left, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $binaryOp->right;
|
||||
$haystack = $funcCall->args[0]->value;
|
||||
$needle = $funcCall->args[1]->value;
|
||||
|
||||
return new StrStartsWith($funcCall, $haystack, $needle, $isPositive);
|
||||
if (! $binaryOp->right instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
if (! $this->nodeNameResolver->isName($binaryOp->right, 'strpos')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->processBinaryOpRight($binaryOp, $isPositive);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,4 +61,48 @@ final class StrposMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
|
||||
return $this->strStartsWithFuncCallFactory->createStrStartsWith($strStartsWith);
|
||||
}
|
||||
|
||||
private function processBinaryOpLeft(BinaryOp $binaryOp, bool $isPositive): ?StrStartsWith
|
||||
{
|
||||
if (! $this->valueResolver->isValue($binaryOp->right, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $binaryOp->left;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($funcCall->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $funcCall->args[0];
|
||||
$haystack = $firstArg->value;
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $funcCall->args[1];
|
||||
$needle = $secondArg->value;
|
||||
|
||||
return new StrStartsWith($funcCall, $haystack, $needle, $isPositive);
|
||||
}
|
||||
|
||||
private function processBinaryOpRight(BinaryOp $binaryOp, bool $isPositive): ?StrStartsWith
|
||||
{
|
||||
if (! $this->valueResolver->isValue($binaryOp->left, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $binaryOp->right;
|
||||
if (! $this->argsAnalyzer->isArgsInstanceInArgsPositions($funcCall->args, [0, 1])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $firstArg */
|
||||
$firstArg = $funcCall->args[0];
|
||||
$haystack = $firstArg->value;
|
||||
/** @var Arg $secondArg */
|
||||
$secondArg = $funcCall->args[1];
|
||||
$needle = $secondArg->value;
|
||||
|
||||
return new StrStartsWith($funcCall, $haystack, $needle, $isPositive);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ declare(strict_types=1);
|
|||
namespace Rector\Php80\MatchAndRefactor\StrStartsWithMatchAndRefactor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Scalar\LNumber;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
|
@ -24,7 +26,8 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
private NodeNameResolver $nodeNameResolver,
|
||||
private ValueResolver $valueResolver,
|
||||
private NodeComparator $nodeComparator,
|
||||
private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory
|
||||
private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory,
|
||||
private ArgsAnalyzer $argsAnalyzer
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -38,7 +41,14 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
if ($binaryOp->left instanceof FuncCall && $this->nodeNameResolver->isName($binaryOp->left, 'substr')) {
|
||||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $binaryOp->left;
|
||||
$haystack = $funcCall->args[0]->value;
|
||||
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($funcCall->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $arg */
|
||||
$arg = $funcCall->args[0];
|
||||
$haystack = $arg->value;
|
||||
|
||||
return new StrStartsWith($funcCall, $haystack, $binaryOp->right, $isPositive);
|
||||
}
|
||||
|
@ -46,7 +56,14 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
if ($binaryOp->right instanceof FuncCall && $this->nodeNameResolver->isName($binaryOp->right, 'substr')) {
|
||||
/** @var FuncCall $funcCall */
|
||||
$funcCall = $binaryOp->right;
|
||||
$haystack = $funcCall->args[0]->value;
|
||||
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($funcCall->args, 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Arg $arg */
|
||||
$arg = $funcCall->args[0];
|
||||
$haystack = $arg->value;
|
||||
|
||||
return new StrStartsWith($funcCall, $haystack, $binaryOp->left, $isPositive);
|
||||
}
|
||||
|
@ -70,11 +87,23 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
private function isStrlenWithNeedleExpr(StrStartsWith $strStartsWith): bool
|
||||
{
|
||||
$substrFuncCall = $strStartsWith->getFuncCall();
|
||||
if (! $this->valueResolver->isValue($substrFuncCall->args[1]->value, 0)) {
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($substrFuncCall->args, 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$secondFuncCallArgValue = $substrFuncCall->args[2]->value;
|
||||
/** @var Arg $arg1 */
|
||||
$arg1 = $substrFuncCall->args[1];
|
||||
if (! $this->valueResolver->isValue($arg1->value, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($substrFuncCall->args, 2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $arg2 */
|
||||
$arg2 = $substrFuncCall->args[2];
|
||||
$secondFuncCallArgValue = $arg2->value;
|
||||
if (! $secondFuncCallArgValue instanceof FuncCall) {
|
||||
return false;
|
||||
}
|
||||
|
@ -84,8 +113,15 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
}
|
||||
|
||||
/** @var FuncCall $strlenFuncCall */
|
||||
$strlenFuncCall = $substrFuncCall->args[2]->value;
|
||||
$needleExpr = $strlenFuncCall->args[0]->value;
|
||||
$strlenFuncCall = $arg2->value;
|
||||
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($strlenFuncCall->args, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $arg0 */
|
||||
$arg0 = $strlenFuncCall->args[0];
|
||||
$needleExpr = $arg0->value;
|
||||
|
||||
$comparedNeedleExpr = $strStartsWith->getNeedleExpr();
|
||||
return $this->nodeComparator->areNodesEqual($needleExpr, $comparedNeedleExpr);
|
||||
|
@ -94,7 +130,13 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
private function isHardcodedStringWithLNumberLength(StrStartsWith $strStartsWith): bool
|
||||
{
|
||||
$substrFuncCall = $strStartsWith->getFuncCall();
|
||||
if (! $this->valueResolver->isValue($substrFuncCall->args[1]->value, 0)) {
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($substrFuncCall->args, 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $arg1 */
|
||||
$arg1 = $substrFuncCall->args[1];
|
||||
if (! $this->valueResolver->isValue($arg1->value, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -103,7 +145,13 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
return false;
|
||||
}
|
||||
|
||||
$lNumberLength = $substrFuncCall->args[2]->value;
|
||||
if (! $this->argsAnalyzer->isArgInstanceInArgsPosition($substrFuncCall->args, 2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Arg $arg2 */
|
||||
$arg2 = $substrFuncCall->args[2];
|
||||
$lNumberLength = $arg2->value;
|
||||
if (! $lNumberLength instanceof LNumber) {
|
||||
return false;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user