Skip to content

semicolons in short echo tags #609

Description

@joemaller

Has there been any discussion about semicolons in short echo tags?

Using dev builds, this:

<?= $content ?>

Changes to this (added semicolon):

<?= $content; ?>

Nearly every PHP short echo tag example I found omits semicolons. Because short echo tags are usually found in template contexts, the less-verbose the better.

There don't appear to be any PSR recommendations about this, though the CakePHP project (the only big-project guidance I could find) recommends omitting short echo tag semicolons:

// wrong = semicolon, no spaces
<td><?=$name;?></td>

// good = spaces, no semicolon
<td><?= $name ?></td>

If short echo tag semicolons are the way Prettier-PHP is going, I'd like to start moving my code in that direction. If short echo tag semicolons are under discussion or being considered as an option, I vote for omitting them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions