Skip to content
Permalink
Browse files

Only add node references to explicit locations

  • Loading branch information...
muglug committed Jul 1, 2019
1 parent 93c605b commit f5809ec24a27df9f9ef032de4916c87719bf2b1a
@@ -485,8 +485,8 @@ public static function analyzeInstance(
}
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
@@ -706,8 +706,8 @@ public static function analyzeInstance(
$has_valid_assignment_value_type = false;
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& count($class_property_types) === 1
) {
$codebase->analyzer->addNodeType(
@@ -316,7 +316,10 @@ public static function analyze(
}
}
if ($codebase->store_node_types) {
if ($codebase->store_node_types
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -572,8 +575,8 @@ public static function analyze(
}
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
$codebase->analyzer->addNodeType(
@@ -320,8 +320,8 @@ public static function analyze(
}
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
$codebase->analyzer->addNodeType(
@@ -905,7 +905,11 @@ function (PhpParser\Node\Arg $arg) {
return true;
}
if ($codebase->store_node_types && $method_id) {
if ($codebase->store_node_types
&& $method_id
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -89,7 +89,11 @@ public static function analyze(
}
}
if ($codebase->store_node_types && $fq_class_name) {
if ($codebase->store_node_types
&& $fq_class_name
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->class,
@@ -159,7 +159,11 @@ public static function analyze(
}
}
if ($codebase->store_node_types && $fq_class_name) {
if ($codebase->store_node_types
&& $fq_class_name
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->class,
@@ -996,7 +1000,11 @@ function (Assertion $assertion) use ($found_generic_params) : Assertion {
);
}
if ($codebase->store_node_types && $method_id) {
if ($codebase->store_node_types
&& $method_id
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
/** @psalm-suppress PossiblyInvalidArgument never a string, PHP Parser bug */
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
@@ -1006,8 +1014,8 @@ function (Assertion $assertion) use ($found_generic_params) : Assertion {
}
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
/** @psalm-suppress PossiblyInvalidArgument never a string, PHP Parser bug */
@@ -183,7 +183,10 @@ public static function analyzeClassConst(
$stmt->inferredType = Type::getLiteralClassString($fq_class_name);
}
if ($codebase->store_node_types) {
if ($codebase->store_node_types
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->class,
@@ -201,7 +204,10 @@ public static function analyzeClassConst(
return null;
}
if ($codebase->store_node_types) {
if ($codebase->store_node_types
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->class,
@@ -215,7 +221,10 @@ public static function analyzeClassConst(
$const_id = $fq_class_name . '::' . $stmt->name;
if ($codebase->store_node_types) {
if ($codebase->store_node_types
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -109,8 +109,8 @@ public static function analyzeInstance(
}
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeType(
$statements_analyzer->getFilePath(),
@@ -183,7 +183,10 @@ public static function analyzeInstance(
: null
);
if ($codebase->store_node_types) {
if ($codebase->store_node_types
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -267,8 +270,8 @@ public static function analyzeInstance(
$stmt->inferredType = Type::getMixed();
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeType(
$statements_analyzer->getFilePath(),
@@ -554,7 +557,10 @@ public static function analyzeInstance(
continue;
}
if ($codebase->store_node_types) {
if ($codebase->store_node_types
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -785,8 +791,8 @@ public static function analyzeInstance(
}
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
$codebase->analyzer->addNodeType(
@@ -967,7 +973,10 @@ public static function analyzeStatic(
$property_id = $fq_class_name . '::$' . $prop_name;
if ($codebase->store_node_types) {
if ($codebase->store_node_types
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->name,
@@ -991,8 +1000,8 @@ public static function analyzeStatic(
}
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
$codebase->analyzer->addNodeType(
@@ -1105,8 +1114,8 @@ public static function analyzeStatic(
$stmt->inferredType = clone $context->vars_in_scope[$var_id];
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeType(
$statements_analyzer->getFilePath(),
@@ -79,8 +79,8 @@ public static function analyze(
$stmt->inferredType = clone $context->vars_in_scope['$this'];
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
$codebase->analyzer->addNodeType(
@@ -262,8 +262,8 @@ public static function analyze(
$stmt->inferredType = clone $context->vars_in_scope[$var_name];
if ($codebase->store_node_types
&& (!$context->collect_initializations
&& !$context->collect_mutations)
&& !$context->collect_initializations
&& !$context->collect_mutations
&& isset($stmt->inferredType)
) {
$codebase->analyzer->addNodeType(
@@ -573,7 +573,11 @@ public static function analyze(
$statements_analyzer->getAliases()
);
if ($codebase->store_node_types && $fq_class_name) {
if ($codebase->store_node_types
&& $fq_class_name
&& !$context->collect_initializations
&& !$context->collect_mutations
) {
$codebase->analyzer->addNodeReference(
$statements_analyzer->getFilePath(),
$stmt->class,

0 comments on commit f5809ec

Please sign in to comment.
You can’t perform that action at this time.