Skip to content

Support is_null() in TernaryToNullCoalescingRector #9648

@Soean

Description

@Soean

Feature Request

The TernaryToNullCoalescingRector already refactors $value === null and isset($value), I would also propose refactor is_null($value) to ??

-$value === null ? 10 : $value;
+$value ?? 10;
-isset($value) ? $value : 10;
+$value ?? 10;

Diff

New:

-is_null($value) ? 10 : $value;
+$value ?? 10;

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