Search code examples
phpnamespacesphplint

PHPLint - some problems


I am using PHP 5.3. For syntax check, I am using a library which make some syntax check, called phplint

This library, for my opinion, is quite old, but it does the work. It is not quite simple compiling via phplint. I did lot of work and it is quite difficult learning a new one.

  1. How can I avoid semi-compile error message (just ignore some of the errors, i.e another 3rd party tool, such as PHPMAILER, which I don't want to check it's syntax).

  2. How can I add some classes to other library, but can still compile them (the class cannot find the path ./stdlib because the it's library not at the usual directory, and I should refer to library differently (maybe this is namespace, but I don't know much about namespaces. Any help will be appreciated.


Solution

    1. PHPLint already provides its own PhpMailer class, which is PHPLint-aware, that is it passes validation. In general, you can't use external tools that were not created with PHPLint in mind, so you must either rewrite them or switch to another tool.

    2. The "stdlib" directory that comes along with PHPLint is only an example of source tree. All the sources threin either use autoloading or use require_once with relative path, so it should be easy to integrate that source tree in your source tree. You may then add your own namespace "a\b\c", but this namespace must match the subtree "ROOT/a/b/c" of the source tree and the autoload.php be present in the root directory "ROOT/autoload.php".

    Hope this may help.