[Announce] PHPLint 0.5 - PHP source validator and documentator

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

PHPLint is a validator and documentator for PHP programs.  PHPLint checks
the syntax of statements and expressions, check the proper usage of
data types and promote a clean programming style.  The programmer can
add to the source the PHPLint meta-code, that enhance the syntax of
the PHP language toward the paradigm of a strong-typed language and
safe programming (see the example below).


(This is only a summary of the main new features. For a complete list,
please check http://www.icosaedro.it/phplint/manual.html?p=changes ).

+ PHP 4: new meta-code attributes /*. public|protected|private static
  final .*/ for class variables and class functions.

+ PHP 5: abstract classes, interface classes now implemented.

+ PHP 5: track-down the propagation of the thrown exceptions and raise
  warning if not handled.

+ PHP 5, Documentator: now it reports thrown exceptions and inherited
  unhandled exceptions.

+ New concept of "package" where private constants, vars, funcs and classes
  can be made explicitly /*.private.*/. PHPLint raise an error if these
  private items are used outside their package:

       /*. private .*/ define('MAX_USERS', 100);
       /*. private .*/ $logged_users_count = 0;
       /*. private .*/ class UsersStuff { ... }

  Ok, the poor-man "namespace" feature, but effective.

+ Reports modules (aka "PHP extensions") required but not used.

+ Reports packages required but not used.

+ Track-down the propagation of the triggered errors and raise warning if not

+ Documentator:
    reports triggered errors and inherited unhandled errors
    reports items inherited from parent classes
    reports exceptions thrown by functions and methods

Dedicated to all the programmers that appreciate the PHP language for
fast program development, but regret the safety that a strong typed
language can give.


/*. require_module 'standard'; .*/

class Option
/*. DOC  Store an element of an OPTION.  .*/
    public /*. int .*/ $key;
    public /*. string .*/ $value;

    public /*. void .*/
    function __construct(/*. int .*/ $key, /*. string .*/ $value)
    {   $this->key = $key;    $this->value = $value;  }

/*. void .*/ function EchoOptions(/*. array[int]Option .*/ $opts)
/*. DOC  Displays a list of OPTIONs. .*/
    for($i = 0; $i < count($opts); $i++)
        echo "<OPTION value=", $opts[$i]->key, ">",
            htmlspecialchars($opts[$i]->value), "</OPTION>\n";

echo "Your preferred color: <SELECT name=color>\n";
$c = array( new Option(1, "red"),
    new Option(2, "green"),
    new Option(3, "blue") );
EchoOptions( $c );
echo "</SELECT>\n";
$_SESSION['color_table'] = $c;

PHPLint is available either as M2 source (it requires the M2 Development
System), as a pure-C source resulting from the M2-to-C cross compiler
(it requires a C compiler), and as an on-line WEB interface.



/_|_\  Umberto Salsi
\/_\/  www.icosaedro.it

Site Timeline