-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native return types on interfaces conflict with the BC goal of 3.0 #1680
Comments
The ResettableInterface problem is no problem at all as you can already add the void type in 2.x. The ProcessorInterface is indeed a tricky one.. As the 2.x one had
The problem is now I can't even change it without breaking things further in 3.x, so yes it sucks a bit but I don't think it should change as the current way is better long term. For the short term there are two workarounds:
|
Hi, and thanks for the response! What you said here does conflict with the statements in Could you elaborate how implementing option 2 would "break things further"? I do agree it would be kinda suboptimal from purely Monolog3 POV, but that I don't see how it would break anything. |
I mean I cannot change this anymore in 3.x without breaking symfony code for example, as narrowing the parameter types in implementations is not allowed https://3v4l.org/BCSSi What seems like a viable option tho is to remove the return type only, that would allow you to use LogRecord only on both param and return types, or you can widen it to That people write Monolog 2/3 compatible ProcessorInterface impl as long as they require PHP 8. |
Oh yeah, I was specifically talking about return types only. |
Indeed, sorry for the confusion ;) I'll get this in the next release then. |
Thank you! |
Monolog version 3
#1648 has added native return types on two interfaces:
Monolog\Processor\ProcessorInterface
Monolog\ResettableInterface
While the latter probably won't cause much problems, the former might and will, because a Processor package which intends to be compatible with both
^2.0
and^3.0
will have a harder time implementing such compatibility. Furthermore, theUPGRADE.md
explicitly mentions that "The interfaces do not require aLogRecord
return type even where it would be applicable".I suppose the change to
ProcessorInterface
was a simple mass-replacement mistake?The text was updated successfully, but these errors were encountered: