Posts tagged php
PHP_CodeSniffer is a command line tool allowing to check php, js and css. The main use case is to
check code styles like the popular PSR-2. Beside checking coding styles, some communities are
already using this tool for further checks like direct access to global variables like
instead of using the provided API, e.g. take a look at Magento PHP_CodeSniffer Coding Standard.
Also there is a standard to check compatibility of the code with PHP versions.
Beside this use cases and huge benefits, there is another use case: automated code migrations that can be achieved using PHP_CodeSniffer. In this blog post I will provide the necessary basics and an example how to auto migrate your PHP code using PHP_CodeSniffer.
We first need the array we want to sort (here called
arrayToSort). Secondly we need a second
array containing the values we want to sort. In this case our names. I called the array