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 next thing in the file is the end of it but the fixer assumes there should be something else (assumes the return is inside a method/function) when actually in this case the tokens index is null and the expression fails with "Illegal offset type"
Simply checking $functionEndIndex !== null should fix the problem
Runtime version
PHP CS Fixer 3.28.0 Jump & Run by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.2.10
Code snippet that reproduces the problem
<?phpreturn [
staticfunction() { return []; ),
];
The text was updated successfully, but these errors were encountered:
Bug report
Description
When run in files simply returning arrays, such as configuration files, shouldBeFixed method errors in the process of detecting the end of the array: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/src/Fixer/ArrayNotation/ReturnToYieldFromFixer.php#L85
The next thing in the file is the end of it but the fixer assumes there should be something else (assumes the return is inside a method/function) when actually in this case the tokens index is null and the expression fails with "Illegal offset type"
Simply checking
$functionEndIndex !== null
should fix the problemRuntime version
PHP CS Fixer 3.28.0 Jump & Run by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.2.10
Code snippet that reproduces the problem
The text was updated successfully, but these errors were encountered: