Not sure if this is intentional
<?php
class Foo
{
/**
* @return int[]
*/
public function doFoo()
{
return [1, 2, 3];
}
}
class Bar extends Foo
{
public function doFoo(): array
{
return parent::doFoo();
}
}
ERROR: LessSpecificImplementedReturnType - 16:28 - The return type 'array
' for Foo::doFoo is more specific than the implemented return type for Bar::dofoo 'array '
https://psalm.dev/r/483659eb7f
Bar::doFoo added a more specific native return type but IMO the phpDoc type should still be inherited. Otherwise the phpDoc types just have to be copied manually.
Oh thanks for this - this was reported by @jwage last week, but from a more convoluted scenario. This is a great test case.
Cool, thank you 馃檪
Most helpful comment
Oh thanks for this - this was reported by @jwage last week, but from a more convoluted scenario. This is a great test case.