Bug report
From the below code the return type of sayHello() is specified in HelloWorldInterface.
When child class returns array its format is array{abc: int};
<?php declare(strict_types = 1);
interface HelloWorldInterface
{
/**
* @return array{abc: int}|string
*/
public function sayHello();
}
class HelloWorld implements HelloWorldInterface
{
/**
* @inheritDoc
*/
public function sayHello(): array
{
return [
"abc" => 1,
];
}
}
I don't get why it is complaining.
Code snippet that reproduces the problem
https://phpstan.org/r/bbaf4883-1af5-45d7-b38d-7567e32eef99
Expected output
No errors.
Did PHPStan help you today? Did it make you happy in any way?
Yes