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
Is it possible to change private visibility to protected? #3125
Comments
I think you should create your own error renderer; |
I would be open to making those methods protected for extensibility. I don't have a strong opinion on that @solventt |
I think these methods should not be set to protected, otherwise we have to deal with unexpected breaking changes later on. |
@odan considering Slim 4 is in a pretty stable place right now changing the method modifier to |
@zelding Of course I did. I wrote above that now I have almost a copy of existing |
I totally agree with @odan , if you think in keep this project up to date, then don't let users extend your code. If someone wants to change the behavior, then implementing the interface and inject the new one. And if he want to reuse some code that exists, then he can just decorate the class and inject. I faced this problem on other OSS projects and we need to keep an code that must be compatible with 2 ways. Then IMHO don't do this. |
Did you try to decorate this render? YourPlainTextErrorRender implement RenderInterface Public function medthodA() Note 1 : sorry for the ugly example, I'm on phone |
When I launch functional tests I don't need exception trace log output because Its huge. I want to see only an exception type, code, message, file and line. So I decided to override the
formatExceptionFragment
method (remove 4 strings forming trace output) ofPlainTextErrorRenderer
. But the method is private and called from the__invoke
method. And so I cant overrideformatExceptionFragment
in child class - to do it - I should also copy__invoke
to child class. But then there is no point in inheritance either - you get a separate class, almost identical toPlainTextErrorRenderer
, except for 4 lines.It seems redundant to me to copy almost all the code from
PlainTextErrorRenderer
just to remove the 4 lines of code responsible for the trace output. Is it possible to change private visibility to protected of theformatExceptionFragment
method?The text was updated successfully, but these errors were encountered: