-
Notifications
You must be signed in to change notification settings - Fork 153
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
Replacing $this
with $block
in templates is not universally safe / correct
#407
Comments
Hi @fredden. Thank you for your report. Add a comment to assign the issue:
|
@Nuranto thanks for your feedback. I have no problem with the warning / message that says that helpers are deprecated / should not be used. I have no problem with the warning / message that says that one should use This bug is for when |
I understand, and agree but my point was that they probably won’t do
anything about it since they consider this is a not a correct approach.
For my projects, I simply run the fixer with that rule excluded. But of
course that means it won’t fix other $this cases..
|
That's what we've had to do as well (remove/exclude this rule from the fixer). |
Preconditions
.phtml
file), make use of$this->helper(SomeClass:class);
. For example, https://github.com/magento/magento2/blob/2.4.4/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml#L20Steps to reproduce
phpcbf --standard=Magento2
on templateExpected result
Actual result
Invalid method Vendor\Module\Block\SomeBlockClass\Interceptor::helper
The text was updated successfully, but these errors were encountered: