rector/src/NodeAnalyzer/ArgsAnalyzer.php

50 lines
1.1 KiB
PHP
Raw Normal View History

<?php
declare (strict_types=1);
namespace Rector\Core\NodeAnalyzer;
use PhpParser\Node\Arg;
use PhpParser\Node\Identifier;
final class ArgsAnalyzer
{
/**
* @api
* @deprecated Use $node->getArgs()[x] instead
* @param Arg[] $args
*/
public function isArgInstanceInArgsPosition(array $args, int $position) : bool
{
return isset($args[$position]);
}
/**
* @api
* @param Arg[] $args
* @param int[] $positions
* @deprecated use count($node->getArgs() < X instead
*/
public function isArgsInstanceInArgsPositions(array $args, array $positions) : bool
{
foreach ($positions as $position) {
if (!isset($args[$position])) {
return \false;
}
}
return \true;
}
Updated Rector to commit 1dc94831c504b3f99936f12d140401aeb10835d2 https://github.com/rectorphp/rector-src/commit/704b1bec116787abf4d48b1b2193b871dae57a13 [DowngradePhp80] Add DowngradeNumberFormatNoFourthArgRector https://github.com/rectorphp/rector-src/commit/37e2e845001a8740437ab911aca0576aa66c6eed [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/c6f84fa033a499c9ae74d324c004e15c4353e91a [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/31b5cbf4b299fa7a4a113a8be15a7df4a59bc4ac skip named arg https://github.com/rectorphp/rector-src/commit/490dbb63655677f63008f0f1e002a1e4b557182e skip different func call https://github.com/rectorphp/rector-src/commit/05854d69d03de7a4b6da504f787a84c79cc67258 skip has fourth arg https://github.com/rectorphp/rector-src/commit/d7bf81e064ae240e08af908d13091f7a02be6a71 skip no third arg https://github.com/rectorphp/rector-src/commit/8f18542a0087763600708ed586b2d1780e711c0b add failing test case https://github.com/rectorphp/rector-src/commit/7df7bcae202d3af50501cdac12ace9bb04b9d8bb implemented https://github.com/rectorphp/rector-src/commit/7702d5df1f790400fbf337ecba9735846a020d01 register https://github.com/rectorphp/rector-src/commit/efcd01a9614d497576d8f136aacbb455f3c77d07 phpstan https://github.com/rectorphp/rector-src/commit/6f7b8a2788452c6fefd97b30dea08e843782e9bb phpstan https://github.com/rectorphp/rector-src/commit/d54672face49f81d42435d00693734edabbeb3a5 phpstan https://github.com/rectorphp/rector-src/commit/2fd995c3967704babf0d1d3a24dd2a2ed7e573fd [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/3c2abcb79dc7fa167e4956c0f1cf355dd0cf605e [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/2b16ac97610cfa1d70f0fc89f415ab380e7756a5 phpstan https://github.com/rectorphp/rector-src/commit/58f3574328d8bbdfcd5cf1050b3ae35f835accf0 phpstan https://github.com/rectorphp/rector-src/commit/620d2b312559b02e0c5fd6bd8f3e1019cc1a2b7d [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/ec364cbd0330c25c684d7457fe93bdfe09ae2956 [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/0355abcde2d4bd7cca6f2a09c35ef3a741a9542b rectify fix https://github.com/rectorphp/rector-src/commit/1dc94831c504b3f99936f12d140401aeb10835d2 Merge pull request #1649 from rectorphp/downgrade-php80-numberformat
2022-01-08 17:02:43 +00:00
/**
* @param mixed[]|Arg[] $args
Updated Rector to commit 1dc94831c504b3f99936f12d140401aeb10835d2 https://github.com/rectorphp/rector-src/commit/704b1bec116787abf4d48b1b2193b871dae57a13 [DowngradePhp80] Add DowngradeNumberFormatNoFourthArgRector https://github.com/rectorphp/rector-src/commit/37e2e845001a8740437ab911aca0576aa66c6eed [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/c6f84fa033a499c9ae74d324c004e15c4353e91a [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/31b5cbf4b299fa7a4a113a8be15a7df4a59bc4ac skip named arg https://github.com/rectorphp/rector-src/commit/490dbb63655677f63008f0f1e002a1e4b557182e skip different func call https://github.com/rectorphp/rector-src/commit/05854d69d03de7a4b6da504f787a84c79cc67258 skip has fourth arg https://github.com/rectorphp/rector-src/commit/d7bf81e064ae240e08af908d13091f7a02be6a71 skip no third arg https://github.com/rectorphp/rector-src/commit/8f18542a0087763600708ed586b2d1780e711c0b add failing test case https://github.com/rectorphp/rector-src/commit/7df7bcae202d3af50501cdac12ace9bb04b9d8bb implemented https://github.com/rectorphp/rector-src/commit/7702d5df1f790400fbf337ecba9735846a020d01 register https://github.com/rectorphp/rector-src/commit/efcd01a9614d497576d8f136aacbb455f3c77d07 phpstan https://github.com/rectorphp/rector-src/commit/6f7b8a2788452c6fefd97b30dea08e843782e9bb phpstan https://github.com/rectorphp/rector-src/commit/d54672face49f81d42435d00693734edabbeb3a5 phpstan https://github.com/rectorphp/rector-src/commit/2fd995c3967704babf0d1d3a24dd2a2ed7e573fd [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/3c2abcb79dc7fa167e4956c0f1cf355dd0cf605e [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/2b16ac97610cfa1d70f0fc89f415ab380e7756a5 phpstan https://github.com/rectorphp/rector-src/commit/58f3574328d8bbdfcd5cf1050b3ae35f835accf0 phpstan https://github.com/rectorphp/rector-src/commit/620d2b312559b02e0c5fd6bd8f3e1019cc1a2b7d [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/ec364cbd0330c25c684d7457fe93bdfe09ae2956 [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/0355abcde2d4bd7cca6f2a09c35ef3a741a9542b rectify fix https://github.com/rectorphp/rector-src/commit/1dc94831c504b3f99936f12d140401aeb10835d2 Merge pull request #1649 from rectorphp/downgrade-php80-numberformat
2022-01-08 17:02:43 +00:00
*/
public function hasNamedArg(array $args) : bool
{
foreach ($args as $arg) {
if (!$arg instanceof Arg) {
continue;
}
if ($arg->name instanceof Identifier) {
Updated Rector to commit 1dc94831c504b3f99936f12d140401aeb10835d2 https://github.com/rectorphp/rector-src/commit/704b1bec116787abf4d48b1b2193b871dae57a13 [DowngradePhp80] Add DowngradeNumberFormatNoFourthArgRector https://github.com/rectorphp/rector-src/commit/37e2e845001a8740437ab911aca0576aa66c6eed [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/c6f84fa033a499c9ae74d324c004e15c4353e91a [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/31b5cbf4b299fa7a4a113a8be15a7df4a59bc4ac skip named arg https://github.com/rectorphp/rector-src/commit/490dbb63655677f63008f0f1e002a1e4b557182e skip different func call https://github.com/rectorphp/rector-src/commit/05854d69d03de7a4b6da504f787a84c79cc67258 skip has fourth arg https://github.com/rectorphp/rector-src/commit/d7bf81e064ae240e08af908d13091f7a02be6a71 skip no third arg https://github.com/rectorphp/rector-src/commit/8f18542a0087763600708ed586b2d1780e711c0b add failing test case https://github.com/rectorphp/rector-src/commit/7df7bcae202d3af50501cdac12ace9bb04b9d8bb implemented https://github.com/rectorphp/rector-src/commit/7702d5df1f790400fbf337ecba9735846a020d01 register https://github.com/rectorphp/rector-src/commit/efcd01a9614d497576d8f136aacbb455f3c77d07 phpstan https://github.com/rectorphp/rector-src/commit/6f7b8a2788452c6fefd97b30dea08e843782e9bb phpstan https://github.com/rectorphp/rector-src/commit/d54672face49f81d42435d00693734edabbeb3a5 phpstan https://github.com/rectorphp/rector-src/commit/2fd995c3967704babf0d1d3a24dd2a2ed7e573fd [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/3c2abcb79dc7fa167e4956c0f1cf355dd0cf605e [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/2b16ac97610cfa1d70f0fc89f415ab380e7756a5 phpstan https://github.com/rectorphp/rector-src/commit/58f3574328d8bbdfcd5cf1050b3ae35f835accf0 phpstan https://github.com/rectorphp/rector-src/commit/620d2b312559b02e0c5fd6bd8f3e1019cc1a2b7d [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/ec364cbd0330c25c684d7457fe93bdfe09ae2956 [ci-review] Rector Rectify https://github.com/rectorphp/rector-src/commit/0355abcde2d4bd7cca6f2a09c35ef3a741a9542b rectify fix https://github.com/rectorphp/rector-src/commit/1dc94831c504b3f99936f12d140401aeb10835d2 Merge pull request #1649 from rectorphp/downgrade-php80-numberformat
2022-01-08 17:02:43 +00:00
return \true;
}
}
return \false;
}
}