File tree Expand file tree Collapse file tree 3 files changed +41
-2
lines changed
src/com/magento/idea/magento2plugin/actions/generation/generator/util
testData/actions/generation/generator/PluginClassGenerator/generatePluginClassFile
tests/com/magento/idea/magento2plugin/actions/generation/generator Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright © Magento, Inc. All rights reserved.
3+ * See COPYING.txt for license details.
4+ */
5+
6+ package com .magento .idea .magento2plugin .actions .generation .generator .util ;
7+
8+ import com .intellij .openapi .project .Project ;
9+ import com .intellij .psi .codeStyle .CodeStyleSettings ;
10+ import com .intellij .psi .codeStyle .CodeStyleSettingsManager ;
11+ import com .intellij .psi .codeStyle .CommonCodeStyleSettings ;
12+ import org .jetbrains .annotations .NotNull ;
13+
14+ public final class DefaultCodeStyleSettingsAdjustmentsUtil {
15+
16+ private DefaultCodeStyleSettingsAdjustmentsUtil () {
17+ }
18+
19+ /**
20+ * Adjust default code style settings for project.
21+ *
22+ * @param project Project
23+ */
24+ public static void execute (final @ NotNull Project project ) {
25+ final CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager
26+ .getInstance (project )
27+ .getTemporarySettings ();
28+
29+ if (codeStyleSettings == null ) {
30+ return ;
31+ }
32+ final CommonCodeStyleSettings commonPhpSettings = codeStyleSettings
33+ .getCommonSettings ("PHP" );
34+ // This value has changed to TRUE by default in the latest releases.
35+ // This is necessary to return the value by default to the previous one.
36+ commonPhpSettings .ALIGN_MULTILINE_PARAMETERS = false ;
37+ }
38+ }
Original file line number Diff line number Diff line change 11<?php
22
3-
43namespace Foo \Bar \Plugin ;
54
6-
75use Foo \Bar \Service \SimpleService ;
86
97class TestPlugin
Original file line number Diff line number Diff line change 99import com .intellij .psi .PsiFile ;
1010import com .intellij .testFramework .LightPlatformTestCase ;
1111import com .magento .idea .magento2plugin .BaseProjectTestCase ;
12+ import com .magento .idea .magento2plugin .actions .generation .generator .util .DefaultCodeStyleSettingsAdjustmentsUtil ;
1213import com .magento .idea .magento2plugin .magento .packages .File ;
1314import com .magento .idea .magento2plugin .project .util .GetProjectBasePath ;
1415import org .junit .After ;
@@ -25,6 +26,8 @@ public abstract class BaseGeneratorTestCase extends BaseProjectTestCase {
2526 protected void setUp () throws Exception {
2627 super .setUp ();
2728 myFixture .setTestDataPath (TEST_DATA_FOLDER_PATH );
29+ // Reset changed default code style settings to the previous default settings.
30+ DefaultCodeStyleSettingsAdjustmentsUtil .execute (myFixture .getProject ());
2831 }
2932
3033 @ Override
You can’t perform that action at this time.
0 commit comments