serializer icon indicating copy to clipboard operation
serializer copied to clipboard

Make SubscribingHandlerInterface::getSubscribingMethods() return iterable

Open simPod opened this issue 5 years ago • 7 comments

I'm using generators inside of this method so this would allow them to be used officially

Q A
Bug fix? no
New feature? no
Doc updated no
BC breaks? yes
Deprecations? no
Tests pass? yes
License MIT

simPod avatar Jul 04 '20 09:07 simPod

is adding this method signature a BC break? how would it behave if someone tries to override it ?

goetas avatar Jul 04 '20 16:07 goetas

You're right, it was array before so it's BC

simPod avatar Jul 04 '20 16:07 simPod

If this is a BC break I would suggest to make this function no longer static. It is not used that way.

proggeler avatar Dec 17 '20 10:12 proggeler

Not sure if it's BC break. array is covariant to iterable.

simPod avatar Dec 17 '20 11:12 simPod

The BC break is that implementations of the interface without the return type won't work anymore due to signature incompatibility.

Tobion avatar Apr 24 '21 11:04 Tobion

@Tobion afaik implementations of the interface without the return type are compatible

interface Foo
{
    public function fcn() : iterable;
}

class Bar implements Foo
{
    public function fcn()
    {
    }
}

simPod avatar Jul 29 '21 07:07 simPod

No it's not: https://3v4l.org/c8lWB

Tobion avatar Aug 05 '21 15:08 Tobion