| Summary: | Incorrectly formatting if clause with one instruction that has no { } | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | AntonioCS <antoniocs> | ||||||||||
| Component: | PDT | Assignee: | PHP Core <php.core-inbox> | ||||||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P1 | CC: | ganoro, kalin.a, zhaozhongwei | ||||||||||
| Version: | unspecified | ||||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Linux | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
Created attachment 180741 [details]
patch v1
It does not work for the code below
<?php
if(true)
if(true)
echo a;
but works for
<?php
if(true)
echo a;
Can anyone give me some advise?
Created attachment 181701 [details]
patch v2
some small changes.
still does not work for
if(true)
if(true)
echo $a;
Created attachment 181702 [details]
patch v3
Created attachment 182127 [details]
patch
Changes a lot for indentation. So there may be some regressions.
We need more tests.
Can you please suggest a way to deliver unit tests along with this patch? As you said this may yield regression issues and it will be nice to start unit tests it now. 10x! the last patch fails in some cases. So I think I need to rethink about this bug. fixed in head Verified. Closing... |
Build Identifier: 20100617-1415 Eclipse format code option doesn't properly format code in if's. I have the following lines of code: $cfile = sha1($keyname); $cpath = $this->_cache_dir; if (isset($options['subdir'])) $cpath .= $options['subdir']; return $cpath . $cfile; The line after the if statement doesn't get the tab it should have. It becomes like this: if (isset($options['subdir'])) $cpath .= $options['subdir']; Reproducible: Always Steps to Reproduce: 1. Have code that has if clause with only one instruction and no { } 2. Click Source > Format 3. See how it's not correctly tabbed