Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ private function processThisToStatic(Class_ $class, ClassReflection $classReflec
return null;
}

$isStaticMethod = $this->staticAnalyzer->isStaticMethod($classReflection, $methodName, $class);
if (! $isStaticMethod) {
if ($subNode->isFirstClassCallable()) {
return null;
}

if ($subNode->isFirstClassCallable()) {
$isStaticMethod = $this->staticAnalyzer->isStaticMethod($classReflection, $methodName, $class);
if (! $isStaticMethod) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions rules/Php71/Rector/BooleanOr/IsIterableRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public function refactor(Node $node): ?Node

private function shouldSkip(): bool
{
if ($this->reflectionProvider->hasFunction(new Name('is_iterable'), null)) {
if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::IS_ITERABLE)) {
return false;
}

return ! $this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::IS_ITERABLE);
return ! $this->reflectionProvider->hasFunction(new Name('is_iterable'), null);
}
}
7 changes: 4 additions & 3 deletions rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function refactor(Node $node): ?Node
return null;
}

if ($node->isFirstClassCallable()) {
return null;
}

// unreliable count of arguments
$functionLikeReflection = $this->reflectionResolver->resolveFunctionLikeReflectionFromCall($node);
if ($functionLikeReflection instanceof UnionTypeMethodReflection) {
Expand Down Expand Up @@ -90,9 +94,6 @@ public function refactor(Node $node): ?Node
}

$maximumAllowedParameterCount = $this->resolveMaximumAllowedParameterCount($functionLikeReflection);
if ($node->isFirstClassCallable()) {
return null;
}

if ($this->shouldSkipFunctionReflection($functionLikeReflection)) {
return null;
Expand Down
10 changes: 5 additions & 5 deletions rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ public function refactor(Node $node): ?Node
return null;
}

// constant is defined in current lower/upper case
if ($this->reflectionProvider->hasConstant(new Name($constantName), null)) {
return null;
}

// is uppercase, all good
if ($constantName === $uppercasedConstantName) {
return null;
Expand All @@ -158,6 +153,11 @@ public function refactor(Node $node): ?Node
return null;
}

// constant is defined in current lower/upper case
if ($this->reflectionProvider->hasConstant(new Name($constantName), null)) {
return null;
}

$node->name = new FullyQualified($uppercasedConstantName);

return $node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ public function refactor(Node $node): ?Node
return null;
}

$callerType = $this->getType($node->class);
if (! $callerType->isSuperTypeOf(new ObjectType('ReflectionFunction'))->yes()) {
$firstArg = $node->getArgs()[0] ?? null;
if (! $firstArg instanceof Arg) {
return null;
}

$firstArg = $node->getArgs()[0] ?? null;
if (! $firstArg instanceof Arg) {
$callerType = $this->getType($node->class);
if (! $callerType->isSuperTypeOf(new ObjectType('ReflectionFunction'))->yes()) {
return null;
}

Expand Down
Loading