mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 88eed987cc361166359c158ffd22d264d165aa8b
88eed987cc
Ensure check isFirstClassCallable() before node->getArgs() on CallLike (#4049)
This commit is contained in:
parent
b0cbcaf37b
commit
1f621e91a4
|
@ -56,6 +56,9 @@ CODE_SAMPLE
|
|||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$hasChanged = \false;
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
foreach ($this->removeMethodCallParams as $removeMethodCallParam) {
|
||||
if (!$this->isName($node->name, $removeMethodCallParam->getMethodName())) {
|
||||
continue;
|
||||
|
|
|
@ -113,6 +113,9 @@ CODE_SAMPLE
|
|||
if ($exceptionArgumentPosition === null) {
|
||||
return null;
|
||||
}
|
||||
if ($new->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
// exception is bundled
|
||||
if (isset($new->getArgs()[$exceptionArgumentPosition])) {
|
||||
return null;
|
||||
|
|
|
@ -114,6 +114,9 @@ CODE_SAMPLE
|
|||
if ($new->args === []) {
|
||||
return null;
|
||||
}
|
||||
if ($new->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$methodReflection = $this->reflectionResolver->resolveMethodReflectionFromNew($new);
|
||||
if (!$methodReflection instanceof MethodReflection) {
|
||||
return null;
|
||||
|
@ -131,6 +134,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
private function refactorMethodCall($methodCall, Scope $scope)
|
||||
{
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$methodReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($methodCall);
|
||||
if (!$methodReflection instanceof MethodReflection) {
|
||||
return null;
|
||||
|
|
|
@ -48,6 +48,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isName($node, 'boolval')) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isName($node, 'call_user_func')) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ CODE_SAMPLE
|
|||
if (!\in_array($methodName, self::VAL_FUNCTION_NAMES, \true)) {
|
||||
return null;
|
||||
}
|
||||
// if (! isset($node->getArgs[0])) {
|
||||
// return null;
|
||||
// }
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArg = $node->getArgs()[0];
|
||||
$double = new Double($firstArg->value);
|
||||
$double->setAttribute(AttributeKey::KIND, Double::KIND_FLOAT);
|
||||
|
|
|
@ -51,6 +51,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'is_a')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (isset($node->getArgs()[2])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'sprintf')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (\count($node->getArgs()) !== 2) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@ final class SimplifyFuncGetArgsCountRector extends AbstractRector
|
|||
if (!$this->isName($node, 'count')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArg = $node->getArgs()[0];
|
||||
if (!$firstArg->value instanceof FuncCall) {
|
||||
return null;
|
||||
|
|
|
@ -33,6 +33,9 @@ final class SimplifyInArrayValuesRector extends AbstractRector
|
|||
if (!$this->isName($node, 'in_array')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->args[1])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ final class SimplifyStrposLowerRector extends AbstractRector
|
|||
if (!$this->isName($node, 'strpos')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'in_array')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->args[1])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,9 @@ final class GetClassToInstanceOfRector extends AbstractRector
|
|||
$firstExpr = $twoNodeMatch->getFirstExpr();
|
||||
/** @var FuncCall $secondExpr */
|
||||
$secondExpr = $twoNodeMatch->getSecondExpr();
|
||||
if ($secondExpr->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($secondExpr->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -142,6 +142,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
private function resolveCount(bool $isNegated, FuncCall $funcCall)
|
||||
{
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$countedType = $this->getType($funcCall->getArgs()[0]->value);
|
||||
if ($countedType->isArray()->yes()) {
|
||||
return null;
|
||||
|
|
|
@ -165,6 +165,9 @@ CODE_SAMPLE
|
|||
if (!$node instanceof FuncCall) {
|
||||
return \false;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
if (!$this->isName($node, 'count')) {
|
||||
return \false;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'call_user_func')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'implode')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (\count($node->getArgs()) === 1) {
|
||||
// complete default value ''
|
||||
$node->args[1] = $node->getArgs()[0];
|
||||
|
|
|
@ -153,6 +153,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($expr, 'count')) {
|
||||
return null;
|
||||
}
|
||||
if ($expr->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArg = $expr->getArgs()[0];
|
||||
return $firstArg->value;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,9 @@ final class CountManipulator
|
|||
if (!$this->nodeNameResolver->isName($node, 'count')) {
|
||||
return \false;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return \false;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,9 @@ CODE_SAMPLE
|
|||
}
|
||||
private function processMysqlCreateDb(FuncCall $funcCall) : ?FuncCall
|
||||
{
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($funcCall->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
@ -84,6 +87,9 @@ CODE_SAMPLE
|
|||
}
|
||||
private function processMysqlDropDb(FuncCall $funcCall) : ?FuncCall
|
||||
{
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($funcCall->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'mysql_pconnect')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
foreach (self::FUNCTION_RENAME_MAP as $oldFunction => $newFunction) {
|
||||
if (!$this->isName($node, $oldFunction)) {
|
||||
continue;
|
||||
|
|
|
@ -163,6 +163,9 @@ final class VariableNaming
|
|||
}
|
||||
private function resolveBareFuncCallArgumentName(FuncCall $funcCall, string $fallbackName, string $suffix) : string
|
||||
{
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return '';
|
||||
}
|
||||
if (!isset($funcCall->getArgs()[0])) {
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -54,6 +54,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'dirname')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (\count($node->args) !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,9 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio
|
|||
if (!isset(self::OLD_NAMES_TO_NEW_ONES[$functionName])) {
|
||||
return \true;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return \true;
|
||||
}
|
||||
return !isset($funcCall->getArgs()[0]);
|
||||
}
|
||||
private function processStringPattern(FuncCall $funcCall, String_ $string, string $functionName) : void
|
||||
|
|
|
@ -71,6 +71,9 @@ final class MultiDirnameRector extends AbstractRector implements MinPhpVersionIn
|
|||
if (!$this->isName($funcCall, self::DIRNAME)) {
|
||||
return null;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$args = $funcCall->getArgs();
|
||||
if (\count($args) >= 3) {
|
||||
return null;
|
||||
|
|
|
@ -56,6 +56,9 @@ final class IsArrayAndDualCheckToAble
|
|||
if (!$this->nodeNameResolver->isName($funcCallExpr, 'is_array')) {
|
||||
return null;
|
||||
}
|
||||
if ($funcCallExpr->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($funcCallExpr->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -149,6 +149,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($funcCall, 'count')) {
|
||||
return \true;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return \true;
|
||||
}
|
||||
// skip ternary in trait, as impossible to analyse
|
||||
$trait = $this->betterNodeFinder->findParentType($funcCall, Trait_::class);
|
||||
if ($trait instanceof Trait_) {
|
||||
|
|
|
@ -72,6 +72,9 @@ CODE_SAMPLE
|
|||
}
|
||||
/** @var FuncCall $eachFuncCall */
|
||||
$eachFuncCall = $assign->expr;
|
||||
if ($eachFuncCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($eachFuncCall->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'get_class')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArg = $node->getArgs()[0] ?? null;
|
||||
if (!$firstArg instanceof Arg) {
|
||||
return null;
|
||||
|
|
|
@ -71,6 +71,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'define')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node, 'assert')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArg = $node->getArgs()[0];
|
||||
$firstArgValue = $firstArg->value;
|
||||
if (!$firstArgValue instanceof String_) {
|
||||
|
|
|
@ -82,6 +82,9 @@ CODE_SAMPLE
|
|||
}
|
||||
/** @var FuncCall $eachFuncCall */
|
||||
$eachFuncCall = $assignNode->expr;
|
||||
if ($eachFuncCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
/** @var List_ $listNode */
|
||||
$listNode = $assignNode->var;
|
||||
if (!isset($eachFuncCall->getArgs()[0])) {
|
||||
|
|
|
@ -126,6 +126,9 @@ CODE_SAMPLE
|
|||
}
|
||||
private function resolveKeyFuncCall(Stmt $nextStmt, FuncCall $resetOrEndFuncCall) : ?FuncCall
|
||||
{
|
||||
if ($resetOrEndFuncCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
/** @var FuncCall|null */
|
||||
return $this->betterNodeFinder->findFirst($nextStmt, function (Node $subNode) use($resetOrEndFuncCall) : bool {
|
||||
if (!$subNode instanceof FuncCall) {
|
||||
|
@ -134,6 +137,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($subNode, 'key')) {
|
||||
return \false;
|
||||
}
|
||||
if ($subNode->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
return $this->nodeComparator->areNodesEqual($resetOrEndFuncCall->getArgs()[0], $subNode->getArgs()[0]);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -66,6 +66,9 @@ CODE_SAMPLE
|
|||
if (!$this->isNames($funcCall, ['json_encode', 'json_decode'])) {
|
||||
return \true;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return \true;
|
||||
}
|
||||
if ($funcCall->args === null) {
|
||||
return \true;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,9 @@ CODE_SAMPLE
|
|||
if (!$this->isNames($funcCall, ['setcookie', 'setrawcookie'])) {
|
||||
return \true;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return \true;
|
||||
}
|
||||
$argsCount = \count($funcCall->args);
|
||||
if ($argsCount <= 2) {
|
||||
return \true;
|
||||
|
|
|
@ -176,6 +176,9 @@ CODE_SAMPLE
|
|||
if (!$this->nodeNameResolver->isName($expr, 'iterator_to_array')) {
|
||||
return \false;
|
||||
}
|
||||
if ($expr->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
return isset($expr->getArgs()[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($funcCall, 'money_format')) {
|
||||
return null;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$args = $funcCall->getArgs();
|
||||
if ($this->argsAnalyzer->hasNamedArg($args)) {
|
||||
return null;
|
||||
|
|
|
@ -60,6 +60,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node->name, 'export')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArg = $node->getArgs()[0] ?? null;
|
||||
if (!$firstArg instanceof Arg) {
|
||||
return null;
|
||||
|
|
|
@ -79,6 +79,9 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
private function isStrlenWithNeedleExpr(StrStartsWith $strStartsWith) : bool
|
||||
{
|
||||
$substrFuncCall = $strStartsWith->getFuncCall();
|
||||
if ($substrFuncCall->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
$firstArg = $substrFuncCall->getArgs()[1];
|
||||
if (!$this->valueResolver->isValue($firstArg->value, 0)) {
|
||||
return \false;
|
||||
|
@ -98,6 +101,9 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
private function isHardcodedStringWithLNumberLength(StrStartsWith $strStartsWith) : bool
|
||||
{
|
||||
$substrFuncCall = $strStartsWith->getFuncCall();
|
||||
if ($substrFuncCall->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
$secondArg = $substrFuncCall->getArgs()[1];
|
||||
if (!$this->valueResolver->isValue($secondArg->value, 0)) {
|
||||
return \false;
|
||||
|
@ -106,9 +112,6 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf
|
|||
if (!$hardcodedStringNeedle instanceof String_) {
|
||||
return \false;
|
||||
}
|
||||
if ($substrFuncCall->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
if (\count($substrFuncCall->getArgs()) < 3) {
|
||||
return \false;
|
||||
}
|
||||
|
|
|
@ -195,6 +195,9 @@ final class ResourceReturnToObject
|
|||
if (!$this->nodeNameResolver->isName($funcCall, 'is_resource')) {
|
||||
return \true;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return \true;
|
||||
}
|
||||
if (!isset($funcCall->getArgs()[0])) {
|
||||
return \true;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,9 @@ CODE_SAMPLE
|
|||
if (!$this->nodeNameResolver->isName($node, 'get_class')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return new ClassConstFetch(new Name('self'), 'class');
|
||||
}
|
||||
|
|
|
@ -72,6 +72,9 @@ CODE_SAMPLE
|
|||
if (!$funcCall instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (isset($funcCall->getArgs()[2])) {
|
||||
$secondArg = $funcCall->getArgs()[2];
|
||||
if ($this->isName($funcCall->name, 'strpos') && $this->isPositiveInteger($secondArg->value)) {
|
||||
|
|
|
@ -112,6 +112,9 @@ CODE_SAMPLE
|
|||
{
|
||||
/** @var FuncCall $isObjectFuncCall */
|
||||
$isObjectFuncCall = $ternary->cond;
|
||||
if ($isObjectFuncCall->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
$firstExpr = $isObjectFuncCall->getArgs()[0]->value;
|
||||
/** @var FuncCall|ClassConstFetch $getClassFuncCallOrClassConstFetchClass */
|
||||
$getClassFuncCallOrClassConstFetchClass = $ternary->if;
|
||||
|
|
|
@ -9,6 +9,9 @@ final class StrStartsWithFactory
|
|||
{
|
||||
public function createFromFuncCall(FuncCall $funcCall, bool $isPositive) : ?StrStartsWith
|
||||
{
|
||||
if ($funcCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (\count($funcCall->getArgs()) < 2) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@ final class ComplexNewAnalyzer
|
|||
if (!$new->class instanceof FullyQualified) {
|
||||
return \true;
|
||||
}
|
||||
if ($new->isFirstClassCallable()) {
|
||||
return \false;
|
||||
}
|
||||
$args = $new->getArgs();
|
||||
foreach ($args as $arg) {
|
||||
$value = $arg->value;
|
||||
|
|
|
@ -57,6 +57,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
foreach ($this->methodCallsToFuncCalls as $methodCallToFuncCall) {
|
||||
if (!$this->isName($node->name, $methodCallToFuncCall->getMethodName())) {
|
||||
continue;
|
||||
|
|
|
@ -59,6 +59,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
foreach ($this->newArgsToMethodCalls as $newArgToMethodCall) {
|
||||
if (!$this->isObjectType($node->class, $newArgToMethodCall->getObjectType())) {
|
||||
continue;
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '5d6cff121b884ce17d6cf117e60b74dd67af75f2';
|
||||
public const PACKAGE_VERSION = '88eed987cc361166359c158ffd22d264d165aa8b';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-02 10:17:43';
|
||||
public const RELEASE_DATE = '2023-06-02 12:28:24';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit0a5ba555dd7333dbe09222d22f70764f::getLoader();
|
||||
return ComposerAutoloaderInit713a1ea64ac54d399d5089341c28caa7::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit0a5ba555dd7333dbe09222d22f70764f
|
||||
class ComposerAutoloaderInit713a1ea64ac54d399d5089341c28caa7
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit0a5ba555dd7333dbe09222d22f70764f
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0a5ba555dd7333dbe09222d22f70764f', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit713a1ea64ac54d399d5089341c28caa7', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0a5ba555dd7333dbe09222d22f70764f', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit713a1ea64ac54d399d5089341c28caa7', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0a5ba555dd7333dbe09222d22f70764f::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit0a5ba555dd7333dbe09222d22f70764f::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit0a5ba555dd7333dbe09222d22f70764f
|
||||
class ComposerStaticInit713a1ea64ac54d399d5089341c28caa7
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3068,9 +3068,9 @@ class ComposerStaticInit0a5ba555dd7333dbe09222d22f70764f
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0a5ba555dd7333dbe09222d22f70764f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0a5ba555dd7333dbe09222d22f70764f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0a5ba555dd7333dbe09222d22f70764f::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit713a1ea64ac54d399d5089341c28caa7::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
|
@ -1988,12 +1988,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "b980109c94df9fac555f52b848161053cf104243"
|
||||
"reference": "71fabfb51087ff0e6c97ad0296e20ff3634b9008"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/b980109c94df9fac555f52b848161053cf104243",
|
||||
"reference": "b980109c94df9fac555f52b848161053cf104243",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/71fabfb51087ff0e6c97ad0296e20ff3634b9008",
|
||||
"reference": "71fabfb51087ff0e6c97ad0296e20ff3634b9008",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2022,7 +2022,7 @@
|
|||
"tomasvotruba\/type-coverage": "^0.1",
|
||||
"tomasvotruba\/unused-public": "^0.1"
|
||||
},
|
||||
"time": "2023-06-01T22:34:28+00:00",
|
||||
"time": "2023-06-02T12:25:23+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e79ad05'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7e64cfd'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b980109'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5c0d61c'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e79ad05'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7e64cfd'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 71fabfb'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5c0d61c'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ final class ArgumentShiftingFactory
|
|||
{
|
||||
public function removeAllButFirstArgMethodCall(MethodCall $methodCall, string $methodName) : void
|
||||
{
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
return;
|
||||
}
|
||||
$methodCall->name = new Identifier($methodName);
|
||||
foreach (\array_keys($methodCall->getArgs()) as $i) {
|
||||
// keep first arg
|
||||
|
|
|
@ -35,6 +35,9 @@ final class ExpectExceptionCodeFactory
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($methodCall, ['assertSame', 'assertEquals'])) {
|
||||
return null;
|
||||
}
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$secondArgument = $methodCall->getArgs()[1]->value;
|
||||
if (!$secondArgument instanceof MethodCall) {
|
||||
return null;
|
||||
|
|
|
@ -29,6 +29,9 @@ final class ExpectExceptionFactory
|
|||
if (!$this->testsNodeAnalyzer->isInPHPUnitMethodCallName($methodCall, 'assertInstanceOf')) {
|
||||
return null;
|
||||
}
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$argumentVariableName = $this->nodeNameResolver->getName($methodCall->getArgs()[1]->value);
|
||||
if ($argumentVariableName === null) {
|
||||
return null;
|
||||
|
|
|
@ -42,6 +42,9 @@ final class ExpectExceptionMessageFactory
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($methodCall, ['assertSame', 'assertEquals'])) {
|
||||
return null;
|
||||
}
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$secondArgument = $methodCall->getArgs()[1]->value;
|
||||
if (!$secondArgument instanceof MethodCall) {
|
||||
return null;
|
||||
|
|
|
@ -43,6 +43,9 @@ final class ExpectExceptionMessageRegExpFactory
|
|||
if (!$this->testsNodeAnalyzer->isInPHPUnitMethodCallName($methodCall, 'assertContains')) {
|
||||
return null;
|
||||
}
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$secondArgument = $methodCall->getArgs()[1]->value;
|
||||
if (!$secondArgument instanceof MethodCall) {
|
||||
return null;
|
||||
|
|
|
@ -12,6 +12,9 @@ final class ArgumentMover
|
|||
*/
|
||||
public function removeFirst($node) : void
|
||||
{
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return;
|
||||
}
|
||||
$methodArguments = $node->getArgs();
|
||||
\array_shift($methodArguments);
|
||||
$node->args = $methodArguments;
|
||||
|
|
|
@ -111,6 +111,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($rootMethodCall->name, 'method')) {
|
||||
continue;
|
||||
}
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
continue;
|
||||
}
|
||||
// has dynamic return?
|
||||
if ($hasDynamicReturnExprs === \false) {
|
||||
$returnedExpr = $methodCall->getArgs()[0]->value;
|
||||
|
@ -127,6 +130,9 @@ CODE_SAMPLE
|
|||
// change to anonymous class
|
||||
/** @var MethodCall $methodCall */
|
||||
$methodCall = $createMockMethodCallAssign->expr;
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
continue;
|
||||
}
|
||||
$firstArg = $methodCall->getArgs()[0];
|
||||
$mockExpr = $createMockMethodCallAssign->var;
|
||||
$anonymousClass = $this->createAnonymousClass($firstArg);
|
||||
|
|
|
@ -155,6 +155,9 @@ CODE_SAMPLE
|
|||
if (!$this->isMethodCallMatch($methodCall, $arrayArgumentToDataProvider)) {
|
||||
return;
|
||||
}
|
||||
if ($methodCall->isFirstClassCallable()) {
|
||||
return;
|
||||
}
|
||||
if (\count($methodCall->getArgs()) !== 1) {
|
||||
throw new ShouldNotHappenException();
|
||||
}
|
||||
|
|
|
@ -123,6 +123,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($expr->name, 'prophesize')) {
|
||||
return null;
|
||||
}
|
||||
if ($expr->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
return $expr->getArgs()[0];
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -55,6 +55,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($expr->name, 'assertInstanceOf')) {
|
||||
return null;
|
||||
}
|
||||
if ($expr->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($node->valueVar, $expr->getArgs()[1]->value)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,9 @@ final class AssertCompareToSpecificMethodRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertSame', 'assertNotSame', 'assertEquals', 'assertNotEquals'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
// we need 2 args
|
||||
if (!isset($node->args[1])) {
|
||||
return null;
|
||||
|
|
|
@ -69,6 +69,9 @@ final class AssertComparisonToSpecificMethodRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertTrue', 'assertFalse'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
if (!$firstArgumentValue instanceof BinaryOp) {
|
||||
return null;
|
||||
|
|
|
@ -86,6 +86,9 @@ CODE_SAMPLE
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertEquals', 'assertNotEquals'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
// 1. refactor to "assertEqualsIgnoringCase()"
|
||||
$newMethodCall = $this->processAssertEqualsIgnoringCase($node);
|
||||
if ($newMethodCall !== null) {
|
||||
|
|
|
@ -73,6 +73,9 @@ final class AssertEqualsToSameRector extends AbstractRector
|
|||
if (!$this->isNames($node->name, $methodNames)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$args = $node->getArgs();
|
||||
if (!isset($args[0])) {
|
||||
return null;
|
||||
|
|
|
@ -56,6 +56,9 @@ final class AssertFalseStrposToContainsRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, $oldMethodName)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
if ($firstArgumentValue instanceof StaticCall) {
|
||||
return null;
|
||||
|
|
|
@ -58,6 +58,9 @@ final class AssertInstanceOfComparisonRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, $oldMethodNames)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
if (!$firstArgumentValue instanceof Instanceof_) {
|
||||
return null;
|
||||
|
|
|
@ -81,6 +81,9 @@ final class AssertIssetToSpecificMethodRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, [self::ASSERT_TRUE, self::ASSERT_FALSE])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
// is property access
|
||||
if (!$firstArgumentValue instanceof Isset_) {
|
||||
|
|
|
@ -57,6 +57,9 @@ final class AssertNotOperatorRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, $oldMethodNames)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
if (!$firstArgumentValue instanceof BooleanNot) {
|
||||
return null;
|
||||
|
|
|
@ -70,6 +70,9 @@ CODE_SAMPLE
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertTrue', 'assertFalse'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
if (!$firstArgumentValue instanceof FuncCall) {
|
||||
return null;
|
||||
|
|
|
@ -65,6 +65,9 @@ final class AssertRegExpRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, [self::ASSERT_SAME, self::ASSERT_EQUALS, self::ASSERT_NOT_SAME, self::ASSERT_NOT_EQUALS])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
/** @var FuncCall|Node $secondArgumentValue */
|
||||
$secondArgumentValue = $node->getArgs()[1]->value;
|
||||
if (!$secondArgumentValue instanceof FuncCall) {
|
||||
|
|
|
@ -60,6 +60,9 @@ final class AssertResourceToClosedResourceRector extends AbstractRector
|
|||
if (!$this->isNames($node->name, $methodNames)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ final class AssertSameBoolNullToSpecificMethodRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertSame', 'assertNotSame'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
if (!$firstArgumentValue instanceof ConstFetch) {
|
||||
return null;
|
||||
|
|
|
@ -74,6 +74,9 @@ CODE_SAMPLE
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertSame', 'assertEqual', 'assertNotSame', 'assertNotEqual'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArg = $node->getArgs()[0];
|
||||
if ($this->valueResolver->isTrue($firstArg->value)) {
|
||||
$this->argumentMover->removeFirst($node);
|
||||
|
|
|
@ -62,6 +62,9 @@ final class AssertTrueFalseInternalTypeToSpecificMethodRector extends AbstractRe
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, $oldMethods)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$firstArgumentValue = $node->getArgs()[0]->value;
|
||||
if (!$firstArgumentValue instanceof FuncCall) {
|
||||
return null;
|
||||
|
|
|
@ -53,6 +53,9 @@ final class AssertTrueFalseToSpecificMethodRector extends AbstractRector
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertTrue', 'assertFalse', 'assertNotTrue', 'assertNotFalse'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->args[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -96,6 +96,9 @@ CODE_SAMPLE
|
|||
*/
|
||||
private function replaceExceptionWith($node, string $exceptionClass, string $explicitMethod) : ?Node
|
||||
{
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($node->getArgs()[0])) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node->name, 'expects')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (\count($node->args) !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,9 @@ CODE_SAMPLE
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertContains', 'assertNotContains'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isPossiblyStringType($node->getArgs()[1]->value)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,9 @@ CODE_SAMPLE
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertContains', 'assertNotContains'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
// when second argument is string: do nothing
|
||||
$secondArgType = $this->getType($node->getArgs()[1]->value);
|
||||
if ($secondArgType instanceof StringType) {
|
||||
|
|
|
@ -73,6 +73,9 @@ CODE_SAMPLE
|
|||
if (!$this->testsNodeAnalyzer->isPHPUnitMethodCallNames($node, ['assertInternalType', 'assertNotInternalType'])) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$typeNode = $node->getArgs()[0]->value;
|
||||
if (!$typeNode instanceof String_) {
|
||||
return null;
|
||||
|
|
|
@ -77,6 +77,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node->name, 'will')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$callArgs = $node->getArgs();
|
||||
if (!$callArgs[0]->value instanceof MethodCall) {
|
||||
return null;
|
||||
|
|
|
@ -74,6 +74,9 @@ CODE_SAMPLE
|
|||
if (!$this->isName($node->name, 'with')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
foreach ($node->getArgs() as $i => $argNode) {
|
||||
if (!$argNode->value instanceof MethodCall) {
|
||||
continue;
|
||||
|
|
|
@ -84,6 +84,9 @@ CODE_SAMPLE
|
|||
if ($classReflection instanceof ClassReflection && $classReflection->getName() !== 'PHPUnit\\Framework\\TestCase') {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
// narrow args to one
|
||||
if (\count($node->args) > 1) {
|
||||
$node->args = [$node->getArgs()[0]];
|
||||
|
|
Loading…
Reference in New Issue