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

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

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

Sometimes you may have faced warnings like,

WARNING | Unescaped output detected at line no. 3

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

<?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 the /* @noEscape */ comment line before the PHP variable.

The 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 the /* @noEscape */ comment.