-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Labels
Description
Description
The following code:
<?php
/**
* @return array<string, string>
*/
public function dict(): array
{
return [
'foo' => 'bar',
'1' => '1 year',
'2' => '2 years',
'3' => '3 years',
'4' => '4 years',
'5' => '5 years',
];
}
?>
Resulted in this output (static warning):
should return array<string, string> but returns array<int|string, string>
But I expected this output instead:
array<string, string>
PHP Version
PHP8.3
Operating System
Ubuntu 24.01
As I am not sure that this comes from the interpreter I also published the issue on the static analysis tool repo (phpstan) : phpstan/phpstan#11880