prooph / event-store-client

PHP Event Store Client Implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EventAppearedOnCatchupSubscription uses internal class and non-interface

SunMar opened this issue · comments

Hi, another thing I found is in EventAppearedOnCatchupSubscription. The __invoke() method takes an Prooph\EventStoreClient\Internal\EventStoreCatchUpSubscription but that class is marked as @internal in its PHPDoc. That is triggering a warning when the interface is implemented outside the package, since you have to type hint that class to implement the interface. Also the second parameter ResolvedEvent is relying on the Prooph\EventStoreClient\ResolvedEvent implementation rather than the Prooph\EventStoreClient\Internal\ResolvedEvent interface (the interface is also in the Internal namespace though it doesn't have @internal in its PHPDoc).

Should I not be implementing EventAppearedOnCatchupSubscription, though it is required to be able to use EventStoreConnection->subscribeToStreamFromAsync(). Is there another way? Thank you!

No, you should implement EventAppearedOnCatchupSubscription. The ResolvedEvent-interface is really ONLY internal, you should not rely on it at all.

@prolic I am not relying on it, the point is that the EventAppearedOnCatchupSubscription is the one that has the internal class EventStoreCatchUpSubscription in its signature forcing you to type hint it when you want to implement that interface. This triggers a warning by code checkers.

We can only mark the constructor as internal, if that helps you. Wanna submit a PR?

You can also add the @internal annotation to the ResolvedEvent-interface - seems like I forgot it.

Sure, I can create a PR for that, though it will probably be tomorrow.

Thank you!