Giter Site home page Giter Site logo

php-reference-checker's Introduction

php-reference-checker

This tool aims to find assignments of method return values by reference in cases where the result is a value instead of a reference.

Example:

function foo() // does not return a reference
{
    return 'x';
}

$x = &foo(); // expects a reference return value, which will trigger a notice in PHP 7.0+

Installation

Download or clone the repository.

Usage

Open a shell and navigate to the directory to check, then execute this line:

/path/to/php-reference-checker/bin/console reference-checker:check . .

Note the two dots at the end.

The first argument denotes the file or directory to check for reference assignments. Directories are checked recursively.

The second argument denotes the root class path. This is needed so that a repository of all methods can be built in order to check if assignments of returned references are indeed references or simple values.

License

The tool is MIT-licensed (see LICENSE file).

Contributions

Contributions are highly welcome. Please follow these guidelines when contributing:

  • you accept that anyone can use your code by the terms of the MIT license.
  • please add unit tests.
  • please use the PHP-CS-Fixer with the following command to ensure a common styling:
php-cs-fixer fix --config=".php_cs.dist" src tests

php-reference-checker's People

Contributors

umulmrum avatar bestform 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.