问题
I use PhpStorm for a while now, and it's code inspection and syntax highlighting is great! To further extend this feature, I am looking for a way to alert myself of 'debug functions'. I frequently use functions like var_dump()
, exit()
or echo '<pre>',print($var),'</pre>'
. Unfortunately, I also frequently forget these when deploying some code.
Is it possible to add custom highlighting in PhpStorm for some defined functions with the Inspection-feature, so I am visually notified that some debugging-code is still present? Or a plugin or other feature to accomplish something like that?
回答1:
Install and use Php Inspections (EA Extended) plugin
Once installed --
Settings/Preferences | Editor | Inspections
One of the inspections this plugin provides called
Forgotten debug statements
-- find it there (hint: there is a search field -- use it)This inspection will highlight some standard debug related functions + you can add your own function names.
P.S.
This inspection works with PHP functions only -- it will not find constructions like echo '<pre>',print($var),'</pre>'
.
BTW -- why don't you try Xdebug/Zend Debugger for a proper debug experience?
来源:https://stackoverflow.com/questions/37800409/highlight-debug-functions