PHP-front Quality

Static analysis for PHP

Syntax Definition

PHP-Front has an extensive test suite that is run on every build. The grammar is tested by over six hunderd unit-tests that cover at least every construct in the Yacc-file of the distribution. The parse-unit test suites in the source distribution give an overview of these tests. A test suite that ends with a 5 is tested with the SDF for version 5, a 4 indicates a test with the SDF for version 4.

Pretty Printer

The pretty-printer has a separate test-suites which is also run on every build. The parser and the pretty printer are also tested together using the test-files of the source-distribution of PHP. Each test-file is parsed, pretty-printed, parsed and pretty-printed again. The correctness of this round-trip is tested by performing a diff between the two parsed and the two pretty-printed files. You can see the results of this round-trip in the parsing and pretty-printing tests page. Notice that there are two sad smileys on that page. Both versions contain a file with a switch that closes the cases with the ';' character. This is parsed correctly, but pretty-printed as a ':'. This causes the diff to fail, notice that the pretty-printed versions are completely the same.


Both versions of PHP have sections in the test-suites for reflection. PHP5 has some more sections because of the reflection over interfaces. There is a special testsuite for the inclusion of files. This test-suites contains tests that checks the usage of the current- and working-directory related to the inclusion of files.

Useful Strategies

The other useful strategies that are available within PHP-Front are tested with separate test-suites. There are special test-suites for the printing of included files, the constant-propagation and the php-specific simple strategies.