Skip to content

Commit 719f086

Browse files
Copilotdanog
andcommitted
Apply PR #11725 changes and fix missing ArgumentAnalyzer.php update
- Change checkFullyQualifiedClassLikeName signature from two strings to ?Context $context - Change handleClassLikeReferenceInMigration signature similarly - Update all callers in ClassLikes, Codebase, and analyzer files - Fix missing ArgumentAnalyzer.php (root cause of CI failures) - Use null-safe ?-> operator when accessing context properties Co-authored-by: danog <7339644+danog@users.noreply.github.com>
1 parent 4cc8281 commit 719f086

23 files changed

+79
-120
lines changed

src/Psalm/Codebase.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,12 @@ public function fileExists(string $file_path): bool
622622
public function classOrInterfaceExists(
623623
string $fq_class_name,
624624
?CodeLocation $code_location = null,
625-
?string $calling_fq_class_name = null,
626-
?string $calling_method_id = null,
625+
?Context $context = null,
627626
): bool {
628627
return $this->classlikes->classOrInterfaceExists(
629628
$fq_class_name,
630629
$code_location,
631-
$calling_fq_class_name,
632-
$calling_method_id,
630+
$context,
633631
);
634632
}
635633

@@ -641,14 +639,12 @@ public function classOrInterfaceExists(
641639
public function classOrInterfaceOrEnumExists(
642640
string $fq_class_name,
643641
?CodeLocation $code_location = null,
644-
?string $calling_fq_class_name = null,
645-
?string $calling_method_id = null,
642+
?Context $context = null,
646643
): bool {
647644
return $this->classlikes->classOrInterfaceOrEnumExists(
648645
$fq_class_name,
649646
$code_location,
650-
$calling_fq_class_name,
651-
$calling_method_id,
647+
$context,
652648
);
653649
}
654650

@@ -665,14 +661,12 @@ public function classExtendsOrImplements(string $fq_class_name, string $possible
665661
public function classExists(
666662
string $fq_class_name,
667663
?CodeLocation $code_location = null,
668-
?string $calling_fq_class_name = null,
669-
?string $calling_method_id = null,
664+
?Context $context = null,
670665
): bool {
671666
return $this->classlikes->classExists(
672667
$fq_class_name,
673668
$code_location,
674-
$calling_fq_class_name,
675-
$calling_method_id,
669+
$context,
676670
);
677671
}
678672

@@ -698,14 +692,12 @@ public function classImplements(string $fq_class_name, string $interface): bool
698692
public function interfaceExists(
699693
string $fq_interface_name,
700694
?CodeLocation $code_location = null,
701-
?string $calling_fq_class_name = null,
702-
?string $calling_method_id = null,
695+
?Context $context = null,
703696
): bool {
704697
return $this->classlikes->interfaceExists(
705698
$fq_interface_name,
706699
$code_location,
707-
$calling_fq_class_name,
708-
$calling_method_id,
700+
$context,
709701
);
710702
}
711703

src/Psalm/Internal/Analyzer/AttributesAnalyzer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ private static function analyzeAttributeConstruction(
140140
$fq_attribute_name,
141141
$attribute_name_location,
142142
null,
143-
null,
144143
$suppressed_issues,
145144
new ClassLikeNameOptions(
146145
false,

src/Psalm/Internal/Analyzer/ClassAnalyzer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,6 @@ private function checkImplementedInterfaces(
20562056
$fq_interface_name,
20572057
$interface_location,
20582058
null,
2059-
null,
20602059
$this->getSuppressedIssues(),
20612060
) === false) {
20622061
return false;
@@ -2343,7 +2342,6 @@ private function checkParentClass(
23432342
$parent_fq_class_name,
23442343
$parent_reference_location,
23452344
null,
2346-
null,
23472345
$storage->suppressed_issues + $this->getSuppressedIssues(),
23482346
) === false) {
23492347
return;

src/Psalm/Internal/Analyzer/ClassLikeAnalyzer.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ public static function checkFullyQualifiedClassLikeName(
201201
StatementsSource $statements_source,
202202
string $fq_class_name,
203203
CodeLocation $code_location,
204-
?string $calling_fq_class_name,
205-
?string $calling_method_id,
204+
?Context $context,
206205
array $suppressed_issues,
207206
?ClassLikeNameOptions $options = null,
208207
bool $check_classes = true,
@@ -256,22 +255,19 @@ public static function checkFullyQualifiedClassLikeName(
256255
$class_exists = $codebase->classlikes->classExists(
257256
$fq_class_name,
258257
!$options->inferred ? $code_location : null,
259-
$calling_fq_class_name,
260-
$calling_method_id,
258+
$context,
261259
);
262260

263261
$interface_exists = $codebase->classlikes->interfaceExists(
264262
$fq_class_name,
265263
!$options->inferred ? $code_location : null,
266-
$calling_fq_class_name,
267-
$calling_method_id,
264+
$context,
268265
);
269266

270267
$enum_exists = $codebase->classlikes->enumExists(
271268
$fq_class_name,
272269
!$options->inferred ? $code_location : null,
273-
$calling_fq_class_name,
274-
$calling_method_id,
270+
$context,
275271
);
276272

277273
if (!$class_exists

src/Psalm/Internal/Analyzer/FileAnalyzer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ public function analyze(
229229
$fq_source_classlike,
230230
$location,
231231
null,
232-
null,
233232
$this->suppressed_issues,
234233
new ClassLikeNameOptions(
235234
true,

src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,7 @@ public function analyze(
715715
$statements_analyzer,
716716
$expected_exception,
717717
$storage->throw_locations[$expected_exception],
718-
$context->self,
719-
$context->calling_method_id,
718+
$context,
720719
$statements_analyzer->getSuppressedIssues(),
721720
new ClassLikeNameOptions(
722721
false,
@@ -1414,7 +1413,7 @@ private function alterParams(
14141413
$this,
14151414
$param_name_node,
14161415
$resolved_name,
1417-
$context->calling_method_id,
1416+
$context,
14181417
false,
14191418
true,
14201419
);
@@ -1448,7 +1447,7 @@ private function alterParams(
14481447
$this,
14491448
$return_name_node,
14501449
$resolved_name,
1451-
$context->calling_method_id,
1450+
$context,
14521451
false,
14531452
true,
14541453
);

src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,7 @@ public static function checkIteratorType(
629629
$statements_analyzer,
630630
$iterator_atomic_type->value,
631631
new CodeLocation($statements_analyzer->getSource(), $expr),
632-
$context->self,
633-
$context->calling_method_id,
632+
$context,
634633
$statements_analyzer->getSuppressedIssues(),
635634
new ClassLikeNameOptions(true),
636635
) === false) {

src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public static function analyze(
194194
$statements_analyzer,
195195
$catch_type,
196196
$fq_catch_class,
197-
$context->calling_method_id,
197+
$context,
198198
);
199199
}
200200

@@ -203,8 +203,7 @@ public static function analyze(
203203
$statements_analyzer,
204204
$fq_catch_class,
205205
new CodeLocation($statements_analyzer->getSource(), $catch_type, $context->include_location),
206-
$context->self,
207-
$context->calling_method_id,
206+
$context,
208207
$statements_analyzer->getSuppressedIssues(),
209208
new ClassLikeNameOptions(true),
210209
);

src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,7 +2691,6 @@ private static function getGetclassInequalityAssertions(
26912691
$var_type,
26922692
new CodeLocation($source, $whichclass_expr),
26932693
null,
2694-
null,
26952694
$source->getSuppressedIssues(),
26962695
) !== false
26972696
) {
@@ -3395,7 +3394,6 @@ private static function getGetclassEqualityAssertions(
33953394
$var_type,
33963395
new CodeLocation($source, $whichclass_expr),
33973396
null,
3398-
null,
33993397
$source->getSuppressedIssues(),
34003398
new ClassLikeNameOptions(true),
34013399
) === false

src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/StaticPropertyAssignmentAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public static function analyze(
156156
$statements_analyzer,
157157
$stmt->class,
158158
$fq_class_name,
159-
$context->calling_method_id,
159+
$context,
160160
);
161161

162162
if (!$moved_class) {

0 commit comments

Comments
 (0)