php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #71701 Misleading indentation warning
Submitted: 2016-03-02 12:13 UTC Modified: 2016-03-02 23:45 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: daniel dot nagy at mirror dot hu Assigned:
Status: Wont fix Package: Compile Warning
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: daniel dot nagy at mirror dot hu
New email:
PHP Version: OS:

 

 [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();


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-02 23:45 UTC] requinix@php.net
-Status: Open +Status: Wont fix
 [2016-03-02 23:45 UTC] requinix@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 20:01:32 2024 UTC