2017 © Pedro Peláez
 

library phint

image

anlutro/phint

  • Wednesday, October 11, 2017
  • by anlutro
  • Repository
  • 3 Watchers
  • 23 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 9 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Phint

Build Status Latest Stable Version Latest Unstable Version License, (*1)

Phint is a static code analysis tool for PHP. Very much a work in progress. Currently checks for:, (*2)

  • Undefined variables
  • Properties/methods being called exist
  • Classes being used in your code exist (instantiation, type-hinting, instanceof)
  • Exception being caught actually exist and are exceptions (catch (stdClass $e) will error, for example)
  • Functions being called actually exist
  • Methods and functions are called with the correct number of arguments

More features to come. Check the Github issues., (*3)

Installation

On a per-project basis:, (*4)

composer require --dev anlutro/phint:dev-master@dev
./vendor/bin/phint /path/to/src

Globally:, (*5)

wget https://files.lutro.me/phint.phar
chmod +x phint.phar
sudo mv phint.phar /usr/local/bin
phint /path/to/src

Usage

Note that you must be in your project's root for Phint to run. You also need a composer autoloader to be present in vendor/autoload.php., (*6)

Example output from a simple command run:, (*7)

, (*8)

You can pass --strict or -s as an arugment to get more errors. The errors marked as strict are more prone to be wrong, but should be more accurate as time goes on., (*9)

You can also pass --debug or -d to get some debug information. Currently this isn't much, unless you hit a fatal error, in which case you might get some more info., (*10)

By default, if you pass a directory or multiple file paths to the command, Phint will analyze all of them and spit out the errors as it goes along. If you pass --exit-early or -e, Phint will exit as soon as it finds a file with errors., (*11)

Notes

This tool makes some very heavy assumptions about how you're using it and your application., (*12)

Your project must have some sort of autoloader register script present in vendor/autoload.php. This autoloader must make every class and function in your project available., (*13)

The checker works best if all the files being checked are classes with methods, nothing more., (*14)

Contributing

See the CONTRIBUTING.md file for information on contributing., (*15)

License

The contents of this repository is released under the GPL v3 license. See the LICENSE file included for more information., (*16)

The Versions

11/10 2017

dev-master

9999999-dev

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Andreas Lutro