Closed
Description
Description
The following code:
<?php
$index = 1;
function getList() { return [2, 3]; }
$a = [$index => list($x, $y) = getList()];
print_r($a);
Resulted in this output:
PHP Fatal error: Cannot use list() as standalone expression in test.php on line 6
But I expected this output instead:
Array
(
[1] => Array
(
[0] => 2
[1] => 3
)
)
This syntax is correct since PHP 5.4 up to 8.2.
Timeframe: it started to fail yesterday in PHP CS Fixer CI:
- last passed build: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/actions/runs/5070108485
- first failed build: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/actions/runs/5075648935/jobs/9119207560
PHP Version
8.3.0-dev
Operating System
No response