Skip to content

Commit

Permalink
[ScopeNestingComparator] Remove ScopeNestingComparator to remove pare…
Browse files Browse the repository at this point in the history
…nt lookup (#4316)

* [ScopeNestingComparator] Remove ScopeNestingComparator to remove parent lookup

* scoped

* cs

* add back ControlStructure

* try remove if check on NullTypeAssignDetector

* try rollback ContextNodeVisitor
  • Loading branch information
samsonasik committed Jun 22, 2023
1 parent ffce073 commit b6650fa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 94 deletions.
87 changes: 0 additions & 87 deletions packages/NodeNestingScope/ScopeNestingComparator.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\NodeTraverser;
use Rector\NodeNestingScope\ScopeNestingComparator;
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
use Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer;
Expand All @@ -21,7 +20,6 @@
final class NullTypeAssignDetector
{
public function __construct(
private readonly ScopeNestingComparator $scopeNestingComparator,
private readonly DoctrineTypeAnalyzer $doctrineTypeAnalyzer,
private readonly NodeTypeResolver $nodeTypeResolver,
private readonly PropertyAssignMatcher $propertyAssignMatcher,
Expand All @@ -42,11 +40,6 @@ public function detect(ClassLike $classLike, string $propertyName): bool
return null;
}

if ($this->scopeNestingComparator->isNodeConditionallyScoped($expr)) {
$needsNullType = true;
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
}

// not in doctrine property
$staticType = $this->nodeTypeResolver->getType($expr);
if ($this->doctrineTypeAnalyzer->isDoctrineCollectionWithIterableUnionType($staticType)) {
Expand Down

0 comments on commit b6650fa

Please sign in to comment.