Skip to content

Generic.Formatting.DisallowMultipleStatements errors when mutliple short echo tags are used on the same line #1156

Closed
@nkovacs

Description

@nkovacs

In #423 you made an exception to Generic.Formatting.DisallowMultipleStatements for multiple php open/close tags in the same line.

This works inconsistently. The following are all okay:

<div class="<?php echo $class; ?>" id="<?php echo $id; ?>"></div>
<div class="<?php echo $class ?>" id="<?php echo $id ?>"></div>
<div class="<?= $class ?>" id="<?= $id ?>"></div>

But this isn't:

<div class="<?= $class; ?>" id="<?= $id; ?>"></div>

I've added a failing test: https://github.com/nkovacs/PHP_CodeSniffer/tree/disallow-multiple-statements-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions