prolic / HumusAmqp

PHP 7.4 AMQP library
https://humusamqp.readthedocs.io/
MIT License
76 stars 17 forks source link

Compatibility with latest ConfigurationTrait #44

Closed bartmcleod closed 7 years ago

bartmcleod commented 7 years ago

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 methods dimensions() and mandatoryOptions() is iterable

Reproduce by installing the latest sandrokeil/interop-config

prolic commented 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.

bartmcleod commented 7 years ago

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.

sandrokeil commented 7 years ago

@bartmcleod There is no error if return type array differs from iterable see my tests. What PHP error get you exactly?

bartmcleod commented 7 years ago

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.

prolic commented 7 years ago

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 .