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.
Created attachment 152186 [details] The problem described above. Bad formatting. It would seem there are very similar problems to this, but I am using Yii2 framework, and in my most complicated Models, The Netbeans Formatter keeps getting it wrong and my last } is now almost to the absolute right. Here is a code example: $cartDiscounts = \common\models\Discounts::find()->innerJoinWith(['discountsConditions' => function($q) { $q->andOnCondition(['applied_type' => 'cart'])->andOnCondition('NOW() BETWEEN date_from AND date_to'); }])->all(); This is how it looks, if I format it. I wouldn't mind if the next line, went back to being aligned with $cartDiscounts, but it's not, and in a Model class, there are many relations like this. I have attached a screenshot, for example
The issue affects CakePHP 3 code, so it will affect more users as CakePHP 3 usage becomes more prevalent. An example: $query->contain([ 'Locations' => function ($q) { return $q->select(['location', 'sublocation']); }, 'Armors' => function ($q) { return $q->select(['armor', 'type']); }, 'Materials' => function ($q) { return $q->select(['material', 'manufacture', 'option']); } ]); $query->where([ 'Characterprotections.character_id' => $character_id, 'Characterprotections.active' => true ]); $armorinfo = $query->all()->toArray(); should look like: $query->contain([ 'Locations' => function ($q) { return $q->select(['location', 'sublocation']); }, 'Armors' => function ($q) { return $q->select(['armor', 'type']); }, 'Materials' => function ($q) { return $q->select(['material', 'manufacture', 'option']); } ]); $query->where([ 'Characterprotections.character_id' => $character_id, 'Characterprotections.active' => true ]); $armorinfo = $query->all()->toArray(); I don't think it's a defect (I'm using version 8.1), more like a feature request, but it makes the format function (which is otherwise awesome and I use it extensively) pretty much useless for CakePHP 3.
I tried the sample from comment #1 and it works for me. If the problem still exists, please provide a sample file. Thanks. Product Version: NetBeans IDE Dev (Build 20160610-49331e2a0591) Java: 1.8.0_91; Java HotSpot(TM) 64-Bit Server VM 25.91-b14 Runtime: Java(TM) SE Runtime Environment 1.8.0_91-b14 System: Linux version 4.2.0-38-generic running on amd64; UTF-8; cs_CZ (nb)
Created attachment 160031 [details] CakePHP file with the formatting issue. This is for https://netbeans.org/bugzilla/show_bug.cgi?id=250667, comment #3
Tomas, Thank you for looking in to the issue. I've done a full uninstall/reinstall of NetBeans IDE (PHP) 8.1 to make sure I didn't have any custom configuration/plugins/modules and I still have the same formatting issue. My configuration is: Product Version: NetBeans IDE 8.1 (Build 201510222201) Updates: NetBeans IDE is updated to version NetBeans 8.1 Patch 1 Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27 System: Windows 8.1 version 6.3 running on amd64; Cp1252; en_US (nb) User directory: C:\Users\Michael\AppData\Roaming\NetBeans\8.1 Cache directory: C:\Users\Michael\AppData\Local\NetBeans\Cache\8.1 I attached a sample file to comment #3. (Sorry, I didn't know that my comment from the main area wouldn't got with the file along with the file comments.) I've been really happy with the NetBeans IDE, and I appreciate all you folks do to make it so useful! Michael
(In reply to Tomas Mysik from comment #2) > Product Version: NetBeans IDE Dev (Build 20160610-49331e2a0591) > Java: 1.8.0_91; Java HotSpot(TM) 64-Bit Server VM 25.91-b14 > Runtime: Java(TM) SE Runtime Environment 1.8.0_91-b14 > System: Linux version 4.2.0-38-generic running on amd64; UTF-8; cs_CZ (nb) I used dev build - please, try it [1] and let us know. Thanks. [1] http://bits.netbeans.org/download/trunk/nightly/latest/
It's beautiful! Thanks again for getting this working. It makes my coding life a -lot- easier... M
Thanks for letting us know.
Adding Junichi to CC, he very likely fixed this issue. Thank you!