From 88c8dc0bb1b81592d1af7a610131322cf5c32b28 Mon Sep 17 00:00:00 2001 From: Cedric Ziel Date: Fri, 27 Jul 2018 11:03:17 +0200 Subject: [PATCH 1/4] Update build environment to 2018.2 stable --- .travis.yml | 2 +- gradle.properties | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index fadc24589..4eb4e6ac9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_install: - "export ORG_GRADLE_PROJECT_annotationPluginVersion=${ANNOTATION_PLUGIN_VERSION}" env: - - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-182.2949.4" PHP_PLUGIN_VERSION="182.2949.27" TWIG_PLUGIN_VERSION="182.2757.22" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" + - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2018.2" PHP_PLUGIN_VERSION="182.3684.41" TWIG_PLUGIN_VERSION="182.3458.35" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2018.1" PHP_PLUGIN_VERSION="181.4203.565" TWIG_PLUGIN_VERSION="181.3741.23" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2017.3.5" PHP_PLUGIN_VERSION="173.4301.34" TWIG_PLUGIN_VERSION="173.4301.7" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.2.1" diff --git a/gradle.properties b/gradle.properties index 876a00976..c57813671 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ -ideaVersion = IU-182.2949.4 -phpPluginVersion = 182.2949.27 -twigPluginVersion = 182.2757.22 +ideaVersion = IU-2018.2 +phpPluginVersion = 182.3684.41 +twigPluginVersion = 182.3458.35 toolboxPluginVersion = 0.4.6 annotationPluginVersion = 5.3 From 1eb302b0c1e3d555d3389060faf0e428ae40adbe Mon Sep 17 00:00:00 2001 From: Cedric Ziel Date: Mon, 30 Jul 2018 11:22:16 +0200 Subject: [PATCH 2/4] Fix whitespace issues in fixtures Long-term, this should be refactored to use the built-in comparison methods. --- ...amlCreateServiceArgumentsCallbackTest.java | 29 +++++--- .../tests/util/yaml/YamlHelperLightTest.java | 67 +++++++++++++------ 2 files changed, 68 insertions(+), 28 deletions(-) diff --git a/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/intentions/yaml/dic/YamlCreateServiceArgumentsCallbackTest.java b/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/intentions/yaml/dic/YamlCreateServiceArgumentsCallbackTest.java index 4897ee260..2ee67bf87 100644 --- a/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/intentions/yaml/dic/YamlCreateServiceArgumentsCallbackTest.java +++ b/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/intentions/yaml/dic/YamlCreateServiceArgumentsCallbackTest.java @@ -1,5 +1,6 @@ package fr.adrienbrault.idea.symfony2plugin.tests.intentions.yaml.dic; +import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.CommandProcessor; import com.intellij.psi.util.PsiTreeUtil; @@ -47,14 +48,26 @@ public void run() { } }, null, null); - assertEquals("" + - "services:\n" + - " foo:\n" + - " class: Foo\\Foo\n" + - " arguments: ['@foo', '@?', '@?']\n", - yamlFile.getText() - ); - + ApplicationInfo instance = ApplicationInfo.getInstance(); + String minorVersion = instance.getMinorVersion(); + if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) { + assertEquals("" + + "services:\n" + + " foo:\n" + + " class: Foo\\Foo\n" + + " arguments:\n" + + " ['@foo', '@?', '@?']\n", + yamlFile.getText() + ); + } else { + assertEquals("" + + "services:\n" + + " foo:\n" + + " class: Foo\\Foo\n" + + " arguments: ['@foo', '@?', '@?']\n", + yamlFile.getText() + ); + } } } diff --git a/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/util/yaml/YamlHelperLightTest.java b/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/util/yaml/YamlHelperLightTest.java index 554344e67..a6c906762 100644 --- a/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/util/yaml/YamlHelperLightTest.java +++ b/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/util/yaml/YamlHelperLightTest.java @@ -1,5 +1,6 @@ package fr.adrienbrault.idea.symfony2plugin.tests.util.yaml; +import com.intellij.openapi.application.ApplicationInfo; import com.intellij.psi.PsiElement; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; @@ -16,10 +17,8 @@ import org.jetbrains.yaml.psi.YAMLFile; import org.jetbrains.yaml.psi.YAMLKeyValue; import org.jetbrains.yaml.psi.YAMLScalar; -import org.jetbrains.yaml.psi.impl.YAMLArrayImpl; import org.jetbrains.yaml.psi.impl.YAMLHashImpl; -import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -338,16 +337,31 @@ public void testInsertKeyWithArrayValue() { YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services"); - assertEquals("" + - "services:\n" + - " foo:\n" + - " car: test\n" + - " my_service:\n" + - " class: foo\n" + - " tag:\n" + - " - foo", - yamlFile.getText() - ); + ApplicationInfo instance = ApplicationInfo.getInstance(); + String minorVersion = instance.getMinorVersion(); + if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) { + assertEquals("" + + "services:\n" + + " foo:\n" + + " car: test\n" + + " my_service:\n" + + " class: foo\n" + + " tag:\n" + + " - foo", + yamlFile.getText() + ); + } else { + assertEquals("" + + "services:\n" + + " foo:\n" + + " car: test\n" + + " my_service:\n" + + " class: foo\n" + + " tag:\n" + + " - foo", + yamlFile.getText() + ); + } } /** @@ -366,14 +380,27 @@ public void testInsertKeyValueWithMissingMainKeyInRoot() { YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services"); - assertEquals("" + - "foo: foo\n" + - "services:\n" + - " my_service:\n" + - " class: foo\n" + - " tag: foo", - yamlFile.getText() - ); + ApplicationInfo instance = ApplicationInfo.getInstance(); + String minorVersion = instance.getMinorVersion(); + if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) { + assertEquals("" + + "foo: foo\n" + + "services:\n" + + " my_service:\n" + + " class: foo\n" + + " tag: foo", + yamlFile.getText() + ); + }else { + assertEquals("" + + "foo: foo\n" + + "services:\n" + + " my_service:\n" + + " class: foo\n" + + " tag: foo", + yamlFile.getText() + ); + } } /** From e8d51e2215ee0968ee0a6811418a247e3b25e849 Mon Sep 17 00:00:00 2001 From: Cedric Ziel Date: Mon, 30 Jul 2018 11:33:15 +0200 Subject: [PATCH 3/4] Adapt to changed YAML Psi to find the first KeyValue mapping --- .../doctrine/metadata/util/DoctrineMetadataUtil.java | 6 +++--- .../doctrine/metadata/util/DoctrineMetadataUtilTest.java | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/metadata/util/DoctrineMetadataUtil.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/metadata/util/DoctrineMetadataUtil.java index 70b09a68e..ee00f0883 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/metadata/util/DoctrineMetadataUtil.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/doctrine/metadata/util/DoctrineMetadataUtil.java @@ -316,9 +316,9 @@ public static String findModelNameInScope(@NotNull PsiElement psiElement) { if(yamlDocument != null) { YAMLValue topLevelValue = yamlDocument.getTopLevelValue(); if(topLevelValue instanceof YAMLMapping) { - PsiElement firstChild = topLevelValue.getFirstChild(); - if(firstChild instanceof YAMLKeyValue) { - String keyText = ((YAMLKeyValue) firstChild).getKeyText(); + YAMLKeyValue firstChild = PsiTreeUtil.findChildOfType(topLevelValue, YAMLKeyValue.class); + if(firstChild != null) { + String keyText = firstChild.getKeyText(); if(StringUtils.isNotBlank(keyText)) { return keyText; } diff --git a/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/doctrine/metadata/util/DoctrineMetadataUtilTest.java b/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/doctrine/metadata/util/DoctrineMetadataUtilTest.java index 0c4a83738..b42437892 100644 --- a/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/doctrine/metadata/util/DoctrineMetadataUtilTest.java +++ b/src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/doctrine/metadata/util/DoctrineMetadataUtilTest.java @@ -15,7 +15,6 @@ import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil; import org.jetbrains.yaml.YAMLFileType; -import java.io.File; import java.util.*; /** @@ -236,7 +235,7 @@ public void testYamlFindModelNameInScope() { }) { myFixture.configureByText(YAMLFileType.YML, s); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); - assertEquals("Foo\\Foo", DoctrineMetadataUtil.findModelNameInScope(psiElement)); + assertEquals(String.format("Fixture %s", s), "Foo\\Foo", DoctrineMetadataUtil.findModelNameInScope(psiElement)); } } } From 26e9e8b6d5e7750295d287700eb1370e10514f77 Mon Sep 17 00:00:00 2001 From: Cedric Ziel Date: Mon, 30 Jul 2018 11:34:38 +0200 Subject: [PATCH 4/4] Update PHP plugin version to 182.3684.42 in 2018.2 build --- .travis.yml | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4eb4e6ac9..4a6531d1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_install: - "export ORG_GRADLE_PROJECT_annotationPluginVersion=${ANNOTATION_PLUGIN_VERSION}" env: - - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2018.2" PHP_PLUGIN_VERSION="182.3684.41" TWIG_PLUGIN_VERSION="182.3458.35" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" + - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2018.2" PHP_PLUGIN_VERSION="182.3684.42" TWIG_PLUGIN_VERSION="182.3458.35" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2018.1" PHP_PLUGIN_VERSION="181.4203.565" TWIG_PLUGIN_VERSION="181.3741.23" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" - PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2017.3.5" PHP_PLUGIN_VERSION="173.4301.34" TWIG_PLUGIN_VERSION="173.4301.7" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.2.1" diff --git a/gradle.properties b/gradle.properties index c57813671..285e7a15f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ ideaVersion = IU-2018.2 -phpPluginVersion = 182.3684.41 +phpPluginVersion = 182.3684.42 twigPluginVersion = 182.3458.35 toolboxPluginVersion = 0.4.6 annotationPluginVersion = 5.3