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 248659 - Results of array wrapping is different when always or if long.
Summary: Results of array wrapping is different when always or if long.
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-14 18:44 UTC by brettprofitt
Modified: 2016-11-28 07:47 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brettprofitt 2014-11-14 18:44:57 UTC
The following code is wrapped differently depending on the always / if long setting. 

// a single line
$array = array(A\Long\ClassName::CONSTANT, A\Long\ClassName::CONSTANT2, A\Long\ClassName::CONSTANT3, A\Long\ClassName::CONSTANT4, A\Long\ClassName::CONSTANT5);


With if long:
$array = array(A\Long\ClassName::CONSTANT, A\Long\ClassName::CONSTANT2, A\Long\ClassName::CONSTANT3,
	A\Long\ClassName::CONSTANT4, A\Long\ClassName::CONSTANT5);


With always:

$array = array(
	A\Long\ClassName::CONSTANT,
	A\Long\ClassName::CONSTANT2,
	A\Long\ClassName::CONSTANT3,
	A\Long\ClassName::CONSTANT4,
	A\Long\ClassName::CONSTANT5);


To me, the "if long" option results in much less readable code. Also, note that with "if long," the length of the lines still exceed the length specific in prefs.
Comment 1 Tomas Mysik 2016-08-12 10:36:07 UTC
IMHO the curent behavior is correct, "always" is not "if long" and NetBeans respects it. Or what is your expected result?

(In reply to brettprofitt from comment #0)
> Also, note
> that with "if long," the length of the lines still exceed the length
> specific in prefs.

Yes, this is a valid bug.

Thanks.
Comment 2 brettprofitt 2016-08-12 13:45:29 UTC
To be honest, it's been so long that I don't remember the specific case or know if it's still a bug. From my comments, it sounds like the config option should only change _when_ wrapping happens and not _how_ it happens.

The first option ("wrap if long") is a true wrapping, while the second option is closer to "reformat array declaration" and not actual wrapping.
Comment 3 PowerKiKi 2016-11-28 07:47:39 UTC
The current behavior (still identical in 8.2) is consistent with other behavior such as "Method Parameters". While I agree it may be a bit surprising, I don't think it should be changed. Or alternatively, a new wrapping option should be added. But IMHO, this should be closed as WONTFIX.