Closed bugcafe closed 3 years ago
The issue with the extra trailing }
is a bug that's been fixed in the latest release (v1.8.2). Thanks for reporting that!
The array changing is the expected behaviour of the PHP plugin for Prettier. If you want the old style syntax I believe you have to change the phpVersion
option: https://github.com/prettier/plugin-php#configuration
Is it intended that the formatting will change my code?
Its a little disconcerting when the code is changed and not just formatted. In this particular case its changed the code so a parse error occurs after save that doesnt occur otherwise.
Before Save:
After Save:
You will notice that the $stmt->execute(array( has changed to $stmt->execute([
There is also now a trailing } at the end which is more of a concern as it causes a parse error.
But I wasnt expecting that the code would change, I was expecting it to be tidied up but not changed.
IS this a bug, or is it an intentional thing, alternately , is there a way to prevent it from changing the code and just tidying it up instead?
This is in a PHP file.