Coder Social home page Coder Social logo

arch-aur-phpdcd's Introduction

This project is no longer maintained and its repository is only kept for archival purposes.

Latest Stable Version Build Status

PHP Dead Code Detector (PHPDCD)

phpdcd is a Dead Code Detector (DCD) for PHP code. It scans a PHP project for all declared functions and methods and reports those as being "dead code" that are not called at least once.

Limitations

As PHP is a very dynamic programming language, the static analysis performed by phpdcd does not recognize function or method calls that are performed using one of the following language features:

  • Reflection API
  • call_user_func() and call_user_func_array()
  • Usage of the new operator with variable class names
  • Variable class names for static method calls such as $class::method()
  • Variable function or method names such as $function() or $object->$method()
  • Automatic calls to methods such as __toString() or Iterator::*()

Also note that infering the type of a variable is limited to type-hinted arguments (function foo(Bar $bar) {}) and direct object creation ($object = new Clazz)

Installation

PHP Archive (PHAR)

The easiest way to obtain PHPDCD is to download a PHP Archive (PHAR) that has all required dependencies of PHPDCD bundled in a single file:

wget https://phar.phpunit.de/phpdcd.phar
chmod +x phpdcd.phar
mv phpdcd.phar /usr/local/bin/phpdcd

You can also immediately use the PHAR after you have downloaded it, of course:

wget https://phar.phpunit.de/phpdcd.phar
php phpdcd.phar

Composer

Simply add a dependency on sebastian/phpdcd to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a development-time dependency on PHPDCD:

{
    "require-dev": {
        "sebastian/phpdcd": "*"
    }
}

For a system-wide installation via Composer, you can run:

composer global require 'sebastian/phpdcd=*'

Make sure you have ~/.composer/vendor/bin/ in your path.

arch-aur-phpdcd's People

Contributors

sebastianbergmann avatar grahamcampbell avatar keradus avatar henriquemoody avatar kukulich avatar

Watchers

Stefan Auditor avatar James Cloos 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.