Skip to content

[Downgrade PHP 7.3] list() and array destructuring reference assignment #4315

Description

@leoloso

Feature Request

Downgrade new feature from PHP 7.3 to its equivalent PHP 7.2 code. RFC with explanation

This feature must be handled with care. Check in the RFC all the nuances, and if there is any instance where downgrading is not possible, identify that case in the rule and throw a DowngradeNotPossibleException.

Diff

$array = [1, 2];
-list($a, &$b) = $array;
+$a = $array[0];
+$b =& $array[1];

/* Note; []= syntax works the same, so the following is functionally equivalent to the example */
-[$a, &$b] = $array;
+$a = $array[0];
+$b =& $array[1];

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