event-manager
event-manager copied to clipboard
Scalar typehints
Why don't you type hint scalar args? E.g.
$eventArgs
is type hinted, but $eventName
is not. Since the minimum supported version is PHP 7.1
there should be no compatibility issues.
If the answer is just because nobody has done it yet, I am ready to send a PR. It would make the life of your users much easier; they cannot put the hint to their subclasses right now, because that would narrow down the allowed types. On the other hand, if they want to make it broader later, they will still be allowed to do so.
On the other hand, if they want to make it broader later, they will still be allowed to do so.
That's only possible if you use php 7.2 though, which means adding the type declarations would be a BC break
Ah, I see, i forgot about it.
However, PHP 7.1 is EOL. Would't it be just fine to raise the minimal supported PHP version and then type hint?
It think it would, please send a PR :) Make sure to only add parameter type declarations, otherwise it will not be BC.
Will be fixed in 2.0.