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.
Dev Build 201304102301 Menu->Options->Editor->Formatting->php->Wrapping->Ternary=Always <?php /* WITH middle part */ $b = $a ? $b : $c; // As expected. ? Always forced to second line $b = $a ? $b : $c; // Not on same line as operators not moved. Bug? IMHO yes. $b = $a ? $b : $c; // Testing just second part. Ditto above. $b = $a ? $b : $c; // Testing just second part. Ditto above. /* WITHOUT middle part */ $b = $a ? : $c; // kind of expected ... /* * or should it be .. * $b = $a * ? : $c // Personally I prefer this but then what do I know?! * */ $b = $a ? : $c; // The ? is left on the first line, unlike with middle part $b = $a? : $c; // ? not spaced $b = $a? : $c; // Combining ?>
*** Bug 238449 has been marked as a duplicate of this bug. ***
Case from duplicate issue #238449 When you omit the value between the ? and : of the ternary operator, formatting the code should combine them into a single operator without any space between. $color = $color ?: "blue"; // combine, good rather than $color = $color ? : "blue"; // split, bad
My 2c... If Wrapping->Ternary is set to always then cannot agree, as 'always' is absolute. The idea has merit, but to make sense there would have to be an additional options setting eg always unless no space ?? Or something.
There were some changes in this area in the current release - could you please try the dev version of NetBeans [1]? Simply reopen this issue and let us know. Thanks. [1] http://bits.netbeans.org/download/trunk/nightly/latest/