Closed biinari closed 4 months ago
A variable is not counted as used in a short open echo tag:
<?php $a = 'foo'; // incorrectly marked as UnusedVariable ?> <p><?= $a ?></p>
The sniff will correctly identify this variable as used if another statement follows it (or another short open echo tag):
<?php $a = 'foo'; ?> <p><?= $a ?></p> <p><?= 'more' ?></p>
It also correctly identifies the variable as used if the short echo tag includes a semicolon:
<?php $a = 'foo'; ?> <p><?= $a; ?></p>
Problem
A variable is not counted as used in a short open echo tag:
Cases that currently work
The sniff will correctly identify this variable as used if another statement follows it (or another short open echo tag):
It also correctly identifies the variable as used if the short echo tag includes a semicolon: