Block usage of <? as a PHP start tag
PhpStorm and - some - web-servers will accept <? as an open tag for PHP code. However this often causes hard to diagnose bugs if the code is run on a web-server without this support. Is there anyway to get PhpStorm to flag these tags as an error?
I never use this style deliberately myself but I just spent a few hours trying to debug the issue on code written by someone else when moving the code to a new server - a line of PHP buried in the middle of the code was using this style, no other errors, so it would be great if I can get PHP to flag this and save me a lot of time!
Please sign in to leave a comment.
If you search for short open in Settings you'll find an inspection you can enable. You'll see a visual notification if you open the file and, if you run the Inspect Code or Run Inspection by Name commands you'll get it reported.
You can also change the inspection severity to Error but I think that only has a cosmetic effect.
The Php Inspections (EA Extended) third-party plug-in has a similar inspection (no idea if it does something different).
Thanks Alvaro that works great - setting the severity to error does raise a live error flag and is listed under PHP Errors on inspection, as well as an implicit syntax error (expecting semi-colon) !