|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-03-02 12:13 UTC] daniel dot nagy at mirror dot hu
Description: ------------ GCC 6 recently introduced a new compiler warning for misleading indentation in codes. It would be really great if PHP would also include this warning (maybe disabled by default?). See more here: http://developerblog.redhat.com/2016/02/26/gcc-6-wmisleading-indentation-vs-goto-fail/ Test script: --------------- if (some_condition()) do_foo(); do_bar(); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 07:00:01 2025 UTC |
This is the kind of thing that would be best suited by a sort of code analysis tool - not baked into the PHP engine. Those kinds of tools could also detect other sorts of code "errors", such as not following some defined coding style. It's not like we're Python :D There are a bunch out there. Find one (or more) you like, see if it supports checking indentation levels, and if not then you should suggest the feature to the maintainer. IDEs that support PHP are worth a check too as that'd be the best place for a programmer to find out about mistakes. I personally use NetBeans and its PHP addon supports many different inline warnings ("hints") as well as a few third-party analysis tools.