Install Inchoo_PHP7 Module¶
Clone the module from GitHub.
Install the module as normal.
shell/inchoo_php7_test.php (from within your container) to ensure the module
is installed correctly.
Complete Static Analysis¶
The simplest way to do this is to
yum install it within your local container:
yum install -y phpcs
Install PHP Compatibility Coding Standard¶
There are a number of ways to do this; see the README. The method below is the way I've found to be the most reliable
This assumes you've installed PHP_CodeSniffer using
Clone the 'sniffs' from GitHub into
/home/ec within your
Link your 'sniffs' with PHP_CodeSniffer:
1 2 3
sudo bash cd /usr/share/pear-data/PHP_CodeSniffer ln -s /home/ec/PHPCompatibility/ PHPCompatibility
Create List of Directories to Process¶
You'll want to limit you analysis to a subset of folders. Here are the folders to check:
1 2 3 4 5
public/app/code/community/ public/app/code/local/ public/app/design/frontend/rwd/<your theme>/template/ public/app/design/frontend/base/default/template/ public/shell/
You'll want to add these to a text file named
Run your analysis¶
You can use the following command to run your analysis:
phpcs --standard=PHPCompatibility --runtime-set testVersion 7.0 --file-list=<path to>/directories.txt -p
This will give you a summary as the analysis is completed.
Once the analysis is completed you'll be given a list of errors and warnings for you to address.
Default timezone is required since PHP 5.4¶
I've found that the analysis spits out a huge number of
Default timezone is required since PHP 5.4
errors. These don't seem to effect the functioning of code and make the output hard to use.
In order to prevent these being output you can remove the sniff:
cd /home/ec/PHPCompatibility/Sniffs/PHP/ mv DefaultTimezoneRequiredSniff.php DefaultTimezoneRequiredSniff.php.disabled
Enjoy your usable output :)