Skip to content

Commit

Permalink
Create empty params by default for SplObjectStorage
Browse files Browse the repository at this point in the history
Fixes #4055
  • Loading branch information
muglug committed Aug 25, 2020
1 parent 2b060b7 commit 346d475
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,11 @@ public static function analyze(
$template_result->upper_bounds
);
} else {
$generic_param_type = array_values($base_type)[0][0];
if ($fq_class_name === 'SplObjectStorage') {
$generic_param_type = Type::getEmpty();
} else {
$generic_param_type = array_values($base_type)[0][0];
}
}

$generic_param_type->had_template = true;
Expand Down
7 changes: 7 additions & 0 deletions tests/MethodCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,13 @@ final public function getValue() {
echo strlen($a->getValue());
}',
],
'newSplObjectStorageDefaultEmpty' => [
'<?php
$a = new SplObjectStorage();',
[
'$a' => 'SplObjectStorage<empty, empty>',
]
],
];
}

Expand Down

0 comments on commit 346d475

Please sign in to comment.