Skip to content

Allow short ternary operator ?: #1

@jjfer

Description

@jjfer

Usual use case for short ternary is reading ACF field values and setting default if value is not set. Now it is not allowed.

$value = get_field('ploo') ? get_field('ploo') : 'moi;

could be written like

$value = get_field('ploo') ?: 'moi;

To allow short ternaries disable this: WordPress.PHP.DisallowShortTernary.Found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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