Giter VIP home page Giter VIP logo

phpcompatibility's Introduction

PHP Compatibility Coding Standard for PHP_CodeSniffer

Flattr this git repo Build Status

This is a set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.

Installation

  • Install PHP_CodeSniffer with pear install PHP_CodeSniffer (PHP_CodeSniffer 1.47 or later is required for full support, notices may be thrown on older versions).
  • Checkout this repository as PHPCompatibility into the PHP/CodeSniffer/Standards directory.
  • Use the coding standard with phpcs --standard=PHPCompatibility
  • You can specify which PHP version you want to test against by specifying --runtime-set testVersion 5.5 - note that this requires PHP_CodeSniffer from the Github master branch. This feature will be in the next official PHP_CodeSniffer release.

More information can be found on Wim Godden's blog.

Running the Sniff Tests

All the sniffs are fully tested with PHPUnit tests. In order to run the tests on the sniffs, the following installation steps are required.

  1. Install the master branch of PHP_CodeSniffer [https://github.com/squizlabs/PHP_CodeSniffer.git].

    This can be done with composer by adding the following into ~/.composer/composer.json:

     {
         "require": {
             "phpunit/phpunit": "3.7.*",
             "squizlabs/php_codesniffer": "dev-master"
         }
     }
    
  2. Run the following command to compose in the versions indicated in the above global composer.json file:

     $ composer.phar global install
    
  3. Update your system $PATH to include the globally composed files:

     $ export PATH=~/.composer/vendor/bin:$PATH
    
  4. Be sure that the PHPCompatibility directory is symlinked into PHP_Codesniffer's standards directory:

     $ ln -s /path/to/PHPCompatibility ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility
    
  5. Verify standard is available with phpcs -i. The output should include PHPCompatibility

  6. Run the tests by running phpunit in the root directory of PHPCompatibility. It will read the phpunit.xml file and execute the tests

License

This code is released under the GNU Lesser General Public License (LGPL). For more information, visit http://www.gnu.org/copyleft/lesser.html

phpcompatibility's People

Contributors

wimg avatar sumpygump avatar benmatselby avatar glensc avatar stronk7 avatar baschny avatar garyr avatar jakeasmith avatar ynaoto avatar shimonenator avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.