Skip to content

Variable not marked as used in short open echo tag #323

Closed
@biinari

Description

@biinari

Problem

A variable is not counted as used in a short open echo tag:

<?php
$a = 'foo'; // incorrectly marked as UnusedVariable
?>
<p><?= $a ?></p>

Cases that currently work

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions