You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The predominant advantage of adding support for this is that it allows you to use reference assignment for multiple variables at once, which is not currently possible. [...] the advantage here is that you can reference assign some, but not all of the variables in list().
After running this PHP code, the reference exists on $array[1][0] since $a is still in scope after the foreach(). This part cannot be reproduced in PHP 7.2
If we didn't care about the references, but only about the final values, this is doable:
Feature Request
This is the continuation from #4315 and #4371, to downgrade the list reference assignment inside a
foreach
:According to the RFC this is not downgradable:
After running this PHP code, the reference exists on
$array[1][0]
since$a
is still in scope after theforeach()
. This part cannot be reproduced in PHP 7.2If we didn't care about the references, but only about the final values, this is doable:
Notice how the reference at the end points to the 2nd item in the array, and not to the 1st element of that item.
Hence, the final references cannot be recreated, but the values can.
Suggestion
Create a new set
DANGEROUS_DOWNGRADE_PHP73
, and call this ruleDangerousDowngradeListReferenceAssignmentInsideForeachRector
Diff
The text was updated successfully, but these errors were encountered: