Closed
Description
The PHP short echo used widely in PHTML templates cannot be commented out easily:
<?= //$block->getChildHtml('will_not_work') ?>
<?= /*$block->getChildHtml('will_not_work')*/ ?>
You must star comment the entire declaration, which is tedious:
<?php /*
<?= $block->getChildHtml('will_work') ?>
*/ ?>
And also breaks another necessary commenting use case:
<?php /*
I should be commented out, and I am.
<?php /*
<?= $block->getChildHtml('will_work') ?>
*/ ?>
I should be commented out, but I won't be.
*/ ?>
The PHP short echo should have been considered an anti-pattern because it restricts commenting, which is a hallmark of good code.
The standard echo is far more flexible and barely more verbose:
<?php //echo $block->getChildHtml('will_work') ?>
<?php /*echo $block->getChildHtml('will_work')*/ ?>
<?php /*
I should be commented out, and I am.
<?php //echo $block->getChildHtml('will_work') ?>
I should be commented out, and I am.
*/ ?>