Skip to content
Open
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
24 changes: 8 additions & 16 deletions src/Psalm/Codebase.php
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,12 @@ public function fileExists(string $file_path): bool
public function classOrInterfaceExists(
string $fq_class_name,
?CodeLocation $code_location = null,
?string $calling_fq_class_name = null,
?string $calling_method_id = null,
?Context $context = null,
): bool {
return $this->classlikes->classOrInterfaceExists(
$fq_class_name,
$code_location,
$calling_fq_class_name,
$calling_method_id,
$context,
);
}

Expand All @@ -761,14 +759,12 @@ public function classOrInterfaceExists(
public function classOrInterfaceOrEnumExists(
string $fq_class_name,
?CodeLocation $code_location = null,
?string $calling_fq_class_name = null,
?string $calling_method_id = null,
?Context $context = null,
): bool {
return $this->classlikes->classOrInterfaceOrEnumExists(
$fq_class_name,
$code_location,
$calling_fq_class_name,
$calling_method_id,
$context,
);
}

Expand All @@ -787,14 +783,12 @@ public function classExtendsOrImplements(string $fq_class_name, string $possible
public function classExists(
string $fq_class_name,
?CodeLocation $code_location = null,
?string $calling_fq_class_name = null,
?string $calling_method_id = null,
?Context $context = null,
): bool {
return $this->classlikes->classExists(
$fq_class_name,
$code_location,
$calling_fq_class_name,
$calling_method_id,
$context,
);
}

Expand Down Expand Up @@ -826,14 +820,12 @@ public function classImplements(string $fq_class_name, string $interface): bool
public function interfaceExists(
string $fq_interface_name,
?CodeLocation $code_location = null,
?string $calling_fq_class_name = null,
?string $calling_method_id = null,
?Context $context = null,
): bool {
return $this->classlikes->interfaceExists(
$fq_interface_name,
$code_location,
$calling_fq_class_name,
$calling_method_id,
$context,
);
}

Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Analyzer/AttributesAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ private static function analyzeAttributeConstruction(
$fq_attribute_name,
$attribute_name_location,
null,
null,
$suppressed_issues,
new ClassLikeNameOptions(
false,
Expand Down
2 changes: 0 additions & 2 deletions src/Psalm/Internal/Analyzer/ClassAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,6 @@ private function checkImplementedInterfaces(
$fq_interface_name,
$interface_location,
null,
null,
$this->getSuppressedIssues(),
) === false) {
return false;
Expand Down Expand Up @@ -2371,7 +2370,6 @@ private function checkParentClass(
$parent_fq_class_name,
$parent_reference_location,
null,
null,
$storage->suppressed_issues + $this->getSuppressedIssues(),
) === false) {
return;
Expand Down
12 changes: 4 additions & 8 deletions src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ public static function checkFullyQualifiedClassLikeName(
StatementsSource $statements_source,
string $fq_class_name,
CodeLocation $code_location,
?string $calling_fq_class_name,
?string $calling_method_id,
?Context $context,
array $suppressed_issues,
?ClassLikeNameOptions $options = null,
bool $check_classes = true,
Expand Down Expand Up @@ -265,22 +264,19 @@ public static function checkFullyQualifiedClassLikeName(
$class_exists = $codebase->classlikes->classExists(
$fq_class_name,
!$options->inferred ? $code_location : null,
$calling_fq_class_name,
$calling_method_id,
$context,
);

$interface_exists = $codebase->classlikes->interfaceExists(
$fq_class_name,
!$options->inferred ? $code_location : null,
$calling_fq_class_name,
$calling_method_id,
$context,
);

$enum_exists = $codebase->classlikes->enumExists(
$fq_class_name,
!$options->inferred ? $code_location : null,
$calling_fq_class_name,
$calling_method_id,
$context,
);

if (!$class_exists
Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Analyzer/FileAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ public function analyze(
$fq_source_classlike,
$location,
null,
null,
$this->suppressed_issues,
new ClassLikeNameOptions(
true,
Expand Down
7 changes: 3 additions & 4 deletions src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,7 @@ public function analyze(
$statements_analyzer,
$expected_exception,
$storage->throw_locations[$expected_exception],
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(
false,
Expand Down Expand Up @@ -1447,7 +1446,7 @@ private function alterParams(
$this,
$param_name_node,
$resolved_name,
$context->calling_method_id,
$context,
false,
true,
);
Expand Down Expand Up @@ -1481,7 +1480,7 @@ private function alterParams(
$this,
$return_name_node,
$resolved_name,
$context->calling_method_id,
$context,
false,
true,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,7 @@ public static function checkIteratorType(
$statements_analyzer,
$iterator_atomic_type->value,
new CodeLocation($statements_analyzer->getSource(), $expr),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(true),
) === false) {
Expand Down
5 changes: 2 additions & 3 deletions src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public static function analyze(
$statements_analyzer,
$catch_type,
$fq_catch_class,
$context->calling_method_id,
$context,
);
}

Expand All @@ -202,8 +202,7 @@ public static function analyze(
$statements_analyzer,
$fq_catch_class,
new CodeLocation($statements_analyzer->getSource(), $catch_type, $context->include_location),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(true),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2695,7 +2695,6 @@ private static function getGetclassInequalityAssertions(
$var_type,
new CodeLocation($source, $whichclass_expr),
null,
null,
$source->getSuppressedIssues(),
) !== false
) {
Expand Down Expand Up @@ -3399,7 +3398,6 @@ private static function getGetclassEqualityAssertions(
$var_type,
new CodeLocation($source, $whichclass_expr),
null,
null,
$source->getSuppressedIssues(),
new ClassLikeNameOptions(true),
) === false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static function analyze(
$statements_analyzer,
$stmt->class,
$fq_class_name,
$context->calling_method_id,
$context,
);

if (!$moved_class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1442,8 +1442,7 @@ private static function verifyExplicitParam(
$statements_analyzer,
$input_expr->value,
$arg_location,
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(true),
) === false
Expand All @@ -1461,8 +1460,7 @@ private static function verifyExplicitParam(
$statements_analyzer,
$item->value->value,
$arg_location,
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(true),
) === false
Expand Down Expand Up @@ -1542,8 +1540,7 @@ private static function verifyExplicitParam(
$statements_analyzer,
$callable_fq_class_name,
$arg_location,
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(true),
) === false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ public static function analyze(
$statements_analyzer,
$fq_class_name,
new CodeLocation($source, $stmt->var),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(true, false, true, true, $lhs_type_part->from_docblock),
$context->check_classes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static function analyze(
$statements_analyzer,
$stmt->class,
$fq_class_name,
$context->calling_method_id,
$context,
);
}

Expand All @@ -209,8 +209,7 @@ public static function analyze(
$statements_analyzer,
$fq_class_name,
new CodeLocation($statements_analyzer->getSource(), $stmt->class),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
) === false) {
ArgumentsAnalyzer::analyze(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,7 @@ public static function analyze(
new CodeLocation($source, $stmt->class),
!$context->collect_initializations
&& !$context->collect_mutations
? $context->self
: null,
!$context->collect_initializations
&& !$context->collect_mutations
? $context->calling_method_id
? $context
: null,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(false, false, false, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,7 @@ public static function analyze(
new CodeLocation($statements_analyzer, $stmt->class),
!$context->collect_initializations
&& !$context->collect_mutations
? $context->self
: null,
!$context->collect_initializations
&& !$context->collect_mutations
? $context->calling_method_id
? $context
: null,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(
Expand All @@ -114,8 +110,7 @@ public static function analyze(
$statements_analyzer,
$fq_class_name,
new CodeLocation($statements_analyzer, $stmt->class),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
)) {
return;
Expand Down Expand Up @@ -147,8 +142,7 @@ public static function analyze(
$statements_analyzer,
$fq_class_name,
new CodeLocation($statements_analyzer, $stmt->class),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
)) {
return;
Expand Down Expand Up @@ -288,7 +282,7 @@ public static function analyze(
$statements_analyzer,
$stmt->class,
$fq_class_name,
$context->calling_method_id,
$context,
false,
$stmt->class->getFirst() === 'self',
);
Expand Down Expand Up @@ -796,7 +790,7 @@ private static function handleNamedCall(
$statements_analyzer,
$stmt->class,
$fq_class_name,
$context->calling_method_id,
$context,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public static function analyze(
$statements_analyzer,
$stmt->class,
$new_fq_class_name,
$context->calling_method_id,
$context,
strtolower($old_declaring_fq_class_name) !== strtolower($new_fq_class_name),
$stmt->class->getFirst() === 'self',
)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ public static function analyzeFetch(
$statements_analyzer,
$fq_class_name,
new CodeLocation($statements_analyzer->getSource(), $stmt->class),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
new ClassLikeNameOptions(false, true),
) === false) {
Expand All @@ -137,7 +136,7 @@ public static function analyzeFetch(
$statements_analyzer,
$stmt->class,
$fq_class_name,
$context->calling_method_id,
$context,
false,
$stmt->class->getFirst() === 'self',
);
Expand Down Expand Up @@ -523,7 +522,7 @@ public static function analyzeFetch(
$statements_analyzer,
$stmt->class,
$fq_class_name,
$context->calling_method_id,
$context,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ public static function analyze(
$statements_analyzer,
$fq_class_name,
new CodeLocation($statements_analyzer->getSource(), $stmt->class),
$context->self,
$context->calling_method_id,
$context,
$statements_analyzer->getSuppressedIssues(),
) !== true) {
return false;
Expand Down Expand Up @@ -338,7 +337,7 @@ public static function analyze(
$statements_analyzer,
$stmt->class,
$fq_class_name,
$context->calling_method_id,
$context,
);

if (!$moved_class) {
Expand Down
Loading
Loading