4
votes

I've followed all the steps from the official git page for installing and configure PHPCompatibility for checking the compatibility of my code with PHP7 as described bellow:

  1. Installation of PHP_CodeSniffer using pear.
  2. Download and extraction of the most recent release (PHP 7.1 Sniffs - update 2016-12-14) on https://github.com/wimg/PHPCompatibility/releases to directory /Applications/MAMP/bin/php/php7.0.12/lib/php/PHP/CodeSniffer/Standards/PHPCompatibility/

After that I additionally did the following commands on terminal

  1. Add PHPCompatibility to the standards

    $ phpcs --config-set installed_paths /Applications/MAMP/bin/php/php7.0.12/lib/php/PHP/CodeSniffer/Standards/PHPCompatibility/

  2. Test if the PHPCompatibility was added as a standard

    $ phpcs -i

my output is:

The installed coding standards are MySource, PEAR, PHPCompatibility, PHPCS, PSR1, PSR2, Squiz and Zend

  1. Set testVersion to PHP 7

    $ phpcs --runtime-set testVersion 7.0 test.php which correctly prints a report for test.php

But When I try to set PHPCompatibility as a standard anything happens and the terminal jumps to a new line for typing the next command.

`$ phpcs --standard=PHPCompatibility test.php`
`Natalis-MacBook-Air:bin natalisilverio$ `

Could anyone advise what I am missing or doing wrong while trying to set PHPCompatibility as my standard? I tested phpcs --standard=Zend and it works correctly.

I am running MAMP 4.0.6 set to PHP 7.0.12 Thank you very much

1
Please, the original post was unreadable. Try to format better your questions and answers next time. - Marcos Pérez Gude
I was doing this now @MarcosPérezGude, thanks for your collaboration anyway. - natali
Ok, sorry because I can't help you with this question. But you'll get answers soon I wish. - Marcos Pérez Gude
The --runtime-set arg sets the testVersion value for that single run only, so you'll need to specify that each time. Or you can use phpcs --config-set testVersion 7.0 to set it for all future runs. - Greg Sherwood
Can you use composer? What PHP version are you running? - Tomas Votruba

1 Answers

0
votes

Try running with -p. This will show the progress of the run.

Rather than showing nothing for a good result, it will show something like this:

.....SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS........................  60 / 181 (33%)
.S.......................................................... 120 / 181 (66%)
....................................S......S.S.............. 180 / 181 (99%)
.                                                            181 / 181 (100%)