This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257241 - const keyword not properly indented
Summary: const keyword not properly indented
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-21 10:32 UTC by pmaselkowski
Modified: 2016-03-31 01:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
File with wrong identation of const keyword (1.65 KB, application/x-php)
2015-12-21 10:32 UTC, pmaselkowski
Details
Formatting and editor settings (64.04 KB, application/zip)
2015-12-21 10:35 UTC, pmaselkowski
Details
const indent problem (75.46 KB, image/jpeg)
2016-03-17 15:34 UTC, lolka_bolka
Details
patch (2.89 KB, patch)
2016-03-30 03:14 UTC, junichi11
Details | Diff
patch-v2 (2.99 KB, patch)
2016-03-30 04:06 UTC, junichi11
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pmaselkowski 2015-12-21 10:32:04 UTC
Created attachment 157874 [details]
File with wrong identation of const keyword

In simple php file `const` keywords should be in first column when auto formatting:

Expected:
...
$addendum = new Addendum();
$addendum->namespaces[] = MetaOptionsHelper::Ns;
$addendum->namespaces[] = ValidatorAnnotation::Ns;
$addendum->init();

const ManganFirstDbName = 'ManganTest';
const ManganSecondDbName = 'ManganTestSecond';
const ManganThirdDbName = 'ManganTestThird';
const ManganCustomValidatorsDbName = 'ManganTestCustomValidators';
...

Actual:
...
$addendum = new Addendum();
$addendum->namespaces[] = MetaOptionsHelper::Ns;
$addendum->namespaces[] = ValidatorAnnotation::Ns;
$addendum->init();

		const ManganFirstDbName = 'ManganTest';
		const ManganSecondDbName = 'ManganTestSecond';
		const ManganThirdDbName = 'ManganTestThird';
		const ManganCustomValidatorsDbName = 'ManganTestCustomValidators';
...
Comment 1 pmaselkowski 2015-12-21 10:35:06 UTC
Created attachment 157875 [details]
Formatting and editor settings
Comment 2 lolka_bolka 2016-03-17 15:34:59 UTC
Created attachment 158911 [details]
const indent problem

I have exact the same problem. For some reason, netbeans use wrong indent for const keyword. The problem is worse when that is an array.
Comment 3 lolka_bolka 2016-03-17 15:36:00 UTC
(In reply to lolka_bolka from comment #2)
> Created attachment 158911 [details]
> const indent problem
> 
> I have exact the same problem. For some reason, netbeans use wrong indent
> for const keyword. The problem is worse when that is an array.

I forgot to mention, I am using Win10 64bit and netbeans 8.0.1
Comment 4 junichi11 2016-03-30 03:14:30 UTC
Created attachment 159044 [details]
patch
Comment 5 junichi11 2016-03-30 03:18:34 UTC
I've created a patch.

Tomas, Could you please review it when you can make time?

Thanks.
Comment 6 junichi11 2016-03-30 04:06:46 UTC
Created attachment 159046 [details]
patch-v2

Fixed the test file a bit. Thanks.
Comment 7 Tomas Mysik 2016-03-30 05:26:40 UTC
Patch applied, thanks a lot for it, Junichi!

http://hg.netbeans.org/web-main/rev/5b1cb91183c9
Comment 8 Quality Engineering 2016-03-31 01:42:45 UTC
Integrated into 'main-silver', will be available in build *201603310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5b1cb91183c9
User: Tomas Mysik <tmysik@netbeans.org>
Log: #257241 - const keyword not properly indented

Patch contributed by junichi11@netbeans.org.