Replacing $this
with $block
in templates is not universally safe / correct #407
Open
Description
Preconditions
- In a template (
.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#L20 - Magento Coding Standard version 25
Steps to reproduce
- Run
phpcbf --standard=Magento2
on template
Expected result
- Template works the same as before auto-fixes are applied.
Actual result
- Exception is throw:
Invalid method Vendor\Module\Block\SomeBlockClass\Interceptor::helper