How to resolved WARNING | Unescaped output detected of GrumPHP Magento 2.

When you use GrumPHP code sniffer tool to commit your code for the project to follow Magento Coding Standard.

GrumPHP is the Automatic Code Quality Checker tools for PHP based applications.

Sometimes you may have faced the warning like,

WARNING | Unescaped output detected at line no. 3

When you check the warning line no. in a specific template file, your code look likes,

<?php //comment for template ?>
<div class="actions-toolbar">
    <?= $block->getActions($item) ?>
</div

Warning was on the line, <?= $block->getActions($item) ?>

You can resolve the warning by using /* @noEscape */ comment line before the PHP variable.

Final code would be,

<div class="actions-toolbar">
    <?= /* @noEscape */ $block->getActions($item) ?>
</div>

Now When you try to commit the code, your warning will be removed by using /* @noEscape */ comment.