Closed bartmcleod closed 7 years ago
array return type is compatible with iterable, see:
interface Foo { public function get(): iterable; }
class Bar { public function get(): array { return []; } }
$bar = new Bar();
var_dump($bar->get());
No throwable at all. However you are free to submit a PR to change that.
hmz, I got a warning: declaration of dimensions() must be compatible with... etc I think you forgot to write class Bar implements Foo
. That's why your snippet just works.
@bartmcleod There is no error if return type array
differs from iterable
see my tests. What PHP error get you exactly?
I'm afraid I cannot reproduce it... I downgraded my version of interop-config to 1.2, because of the error, but even installing 2.1 does not bring the error back. I don't remember which script caused it. Probably setup-fabric command, but that is currently broken in my setup. If I see it again I will report it back to you.
Anyway feel free to submit a PR to change this.
On Jun 28, 2017 03:26, "Bart McLeod" notifications@github.com wrote:
I'm afraid I cannot reproduce it... I downgraded my version of interop-config to 1.2, because of the error, but even installing 2.1 does not bring the error back. I don't remember which script caused it. Probably setup-fabric command, but that is currently broken in my setup. If I see it again I will report it back to you.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prolic/HumusAmqp/issues/44#issuecomment-311459739, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYEvFS45iQDdz2cmm_FZvH32rAySNpcks5sIVdLgaJpZM4OGcbW .
The factories implement RequiresConfig, RequiresMandatoryOptions. These however got new return types since their 2.0 release. The return types used in HumusAmqp are still
array
. The new return type for the methodsdimensions()
andmandatoryOptions()
isiterable
Reproduce by installing the latest
sandrokeil/interop-config