Skip to content

Allow short ternary operator for boolean #268

Open
@LastDragon-ru

Description

@LastDragon-ru

Disallow short ternary operator (?:) - implies weak comparison, it's recommended to use null coalesce operator (??) or ternary operator with strict condition.

It is not the case if the left value is always boolean, right?

$a = false;      // boolean
$b = $a ?: null; // much more readable than
$c = $a !== false ? true : null;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions