Skip to content

Squiz.Strings.EchoedStrings gives false positive when echo'ing using an inline condition #529

@u01jmg3

Description

@u01jmg3
<rule ref="Squiz.Strings.EchoedStrings" />

  • The following gives Echoed strings should not be bracketed
<?php echo ($loan_device->returndate == 0) ? 'Not returned' : date('d/m/Y', $loan_device->returndate); ?>
  • The following solves the above (by separating out and using $x) but I don't why the above isn't valid
<?php $x = date('d/m/Y', $loan_device->returndate); echo ($loan_device->returndate == 0) ? 'Not returned' : $x; ?>

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