Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixes PHP Error: Undefined array key 1 #11328

Merged
merged 3 commits into from
Feb 21, 2025
Merged
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
5 changes: 4 additions & 1 deletion src/Psalm/Internal/Analyzer/ClassAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,10 @@ public static function addContextProperties(
if ($covariant) {
// If template_covariants is set template_types should also be set
assert($parent_storage->template_types !== null);
$pt_name = array_keys($parent_storage->template_types)[$pt_offset];
$pt_name = array_keys($parent_storage->template_types)[$pt_offset] ?? null;
if ($pt_name === null) {
continue;
}
if (isset($template_standins->lower_bounds[$pt_name][$parent_class])) {
$lower_bounds[$pt_name][$parent_class] =
TemplateStandinTypeReplacer::getMostSpecificTypeFromBounds(
Expand Down
Loading