PHPLint - Features
Main features of PHPLint
PHPLint is an analyzer of PHP sources that implements its own, independent
scanner and parser. All the informations collected from the sources are
also used to generate the documentation. PHPLint ensures these documents
reflect the actual content of the sources from which they were derived.
Among its main features:
- Supports both PHP 5 and PHP 7.
- Enforces safety through strong-typed data programming (more) and optional
runtime checked typecast through the magic function cast(T,V) (more). No need to declare the type of every variable, as PHPLint
obtains the correct type from the assignment:
$imInt = 123;
$imFloat = sin(1.0);
$imString = "hello";
$imArrayOfStrings = array("one", "two", "three");
$imDateTime = new DateTime(...);
$imMyClass = new MyClass();
- Reports PHP extension modules actually used, useful information
for the final deployment of the application on the target system.
- Detects syntactic errors,
unassigned/misspelled variables,
unused items.
Usually programmers use the command line version of PHPLint, suitable to be
included in scripts to be executed automatically. The distributed package also
includes phplint.tk (phplint.tcl in the Windows version), a program that
provides a practical graphical user interface to the numerous options of
PHPLint. Click for a larger view.
|
-
Performs flow analysis with detection of variables not definitely
assigned and unreacheable code (more).
- Checks proper usage of the signature for functions and methods
(more).
- Checks OOP inheritance and overriding rules, including signature and
inherited exceptions (more).
- Class templates, also known as "generics" (more).
-
Supports class autoloading (more).
- Supports checked and unchecked exceptions
(more).
- Provides optional error mapping into exceptions
(more).
- General enforcement of safety and security.
- Supports for phpDocumentor DocBlocks
(more).
- Generates HTML documentation from the sources.
...and much more. Please read the tutorial to learn more about
how PHPLint works and can be used, and try the examples with the PHPLint on-line interface to PHPLint and
experiment there with your code.
The reference manual is the definitive guide to PHPLint.
Features of PHP that are missing in PHPLint
- Variable complex syntax:
${a}
.
- Closured, also known as anonymous functions.
- Traits.
- Generators.
- Variable-variables $$v, variable functions $f(), variable classes
new $classname(), variable methods $obj->$methodname().
- Binary numbers 0b1110101.
- Alternative syntax for control structures, that is
endif endwhile endfor
etc.
- Labels of the
case
branches must be static
expressions.
- goto.
- list(...) is not supported. You may replace
list($x,$y)=f() with normal arrays like in $a=f();
$x=$a[0]; $y=$a[1]; or you may use pass-by-reference
parameters like in function f(/*. return int .*/ &
$x,/*. return int .*/ & $y){...}.
- include* and require* are statements under PHPLint,
so external packages cannot return values though these statements and cannot
contain the return statement at global scope.
As a consequence of the above missing features, the following keywords are
not supported and PHPLint will raise an error if it encounters any of them:
callable
enddeclare
endfor
endforeach
endif
endswitch
endwhile
goto
insteadof
trait
yield
The __TRAIT__ magic constant is not implemented (it is undefined).
There is no plan to implement the features above.
Still no comments to this page. Use the Comments link above to add your contribute.