Skip to content

[DeadCode] If/else with same content #1956

@TomasVotruba

Description

@TomasVotruba

This is right from Rector's own code 😆

-if (in_array($className, ['static', 'self', 'parent'], true)) {
-    $resolvedClassType = $this->nodeTypeResolver->resolve($classConstFetch->class);
-    $className = $this->matchClassTypeThatContainsConstant($resolvedClassType, $constantName);
-    if ($className === null) {
-        return;
-    }
-} else {
-    $resolvedClassType = $this->nodeTypeResolver->resolve($classConstFetch->class);
-    $className = $this->matchClassTypeThatContainsConstant($resolvedClassType, $constantName);
-    if ($className === null) {
-        return;
-    }
-}

+$resolvedClassType = $this->nodeTypeResolver->resolve($classConstFetch->class);
+$className = $this->matchClassTypeThatContainsConstant($resolvedClassType, $constantName);
+if ($className === null) {
+    return;
+}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions