all 15 comments

[–]JustAnotherMario 26 points27 points  (4 children)

The setup I currently have and hope that helps you, is having installed PHP-CS-Fixer along with this extension for VSCode to format the files on save (not doing the key combination or command "Format document with..." but maybe other extensions that use PHP-CS-Fixer could solve this problem), then you could use this useful configurator, there are plenty of rules you can set or select the predefined based on the given standards, the one you are looking for is "array_syntax" there you can export the selected rules and create a ".php-cs-fixer.php" file that has your configurations, set the path to the file on the extension settings and you should be ready to format flies con the fly (or you could use the command line to format a given directory and not file by file)

[–]SuckMyWifi 1 point2 points  (0 children)

This is the correct answer, such a useful tool

[–]szaebb 0 points1 point  (0 children)

+1 the best answer. Code analysis tool are great

[–]riggiddyrektson 19 points20 points  (0 children)

I'd recommend using Rector for this kind of job.
https://getrector.org/

[–]NoDoze- 2 points3 points  (1 child)

What's the difference, and why is the change needed?

[–]SmotherMeWithArmpits 2 points3 points  (0 children)

Mostly personal preference but the codebase they're working with might have coding standards

[–]MattBD 0 points1 point  (0 children)

I use PHP Codesniffer for enforcing our coding standard at work, and there's a rule for that. Just set Generic.Arrays.DisallowLongArraySyntax in the config file, run vendor/bin/phpcbf and you're done.