Req #64184 [Wfx]: Enhance the -l (Lint) command line option
| From: | andyearnshaw at gmail dot com | Date: | Mon, 11 Feb 2013 23:45:19 +0000 |
| Subject: | Req #64184 [Wfx]: Enhance the -l (Lint) command line option | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176570@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64184&edit=1
ID: 64184
User updated by: andyearnshaw at gmail dot com
Reported by: andyearnshaw at gmail dot com
Summary: Enhance the -l (Lint) command line option
Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
Operating System: Any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I could, but then there's the problem of reading a backlog of upgrading documents
when I don't religiously update PHP, and also the issue of remembering which
functions are deprecated and which aren't at the time of programming without
checking the docs :-)
However, I do understand that this is beyond the scope of the compiler and,
therefore, the -l command line option.
Previous Comments:
------------------------------------------------------------------------
[2013-02-11 23:41:37] rasmus@php.net
You could read the UPGRADING doc we provide with every new release.
------------------------------------------------------------------------
[2013-02-11 23:38:24] andyearnshaw at gmail dot com
That's a shame. One of the annoying things about not keeping up with every
single PHP release is that you don't know things are deprecated until you've
spent time developing and then check the error logs during the testing phase.
Then you have to either spend time rewriting the code or live with using
deprecated functions for a while.
------------------------------------------------------------------------
[2013-02-11 23:33:23] rasmus@php.net
That would require writing a static analyzer which is outside our scope at this
point. Right now it simply runs the compile-phase and none of the things you are
asking for can be done by the compiler. The executor can do some of this, but not
without actually executing the script, which you don't want. The closest thing to
a full static analyzer is Facebook's HipHop project if you run it in analyze-only
mode.
------------------------------------------------------------------------
[2013-02-10 13:27:23] andyearnshaw at gmail dot com
Description:
------------
It would be great if the command line -l option could be enhanced to do more than
just syntax checking. It would be infinitely more useful if it could also output
warnings for the following:
- Use of deprecated functions
- Correct number of function arguments
- Other useful warnings (creating default object from empty value, etc)
- Optionally, best practices
This would make it more akin to the JavaScript linters available, with the added
benefit of always being relevant to the version of PHP installed.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64184&edit=1