5

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

Marcos Pérez Gude
  • 21,869
  • 4
  • 38
  • 69
natali
  • 125
  • 2
  • 9
  • Please, the original post was unreadable. Try to format better your questions and answers next time. – Marcos Pérez Gude Dec 14 '16 at 17:16
  • 2
    I was doing this now @MarcosPérezGude, thanks for your collaboration anyway. – natali Dec 14 '16 at 17:19
  • Ok, sorry because I can't help you with this question. But you'll get answers soon I wish. – Marcos Pérez Gude Dec 14 '16 at 17:21
  • 1
    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 Dec 14 '16 at 23:16
  • Can you use composer? What PHP version are you running? – Tomas Votruba May 03 '17 at 08:38
  • Can you show the contents of `test.php`, I suspect it doesn't have anything wrong with it according to the standard. Try using a class with the old style constructor or using a deprecated function like the old mysql functions – Harry May 22 '19 at 13:12

1 Answers1

-1

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%)
mbomb007
  • 3,788
  • 3
  • 39
  • 68