@@ -70,19 +70,29 @@ public class ParameterLanguageInjector implements MultiHostInjector {
7070 new MethodParameterSignature ("\\ Psr\\ Log\\ Test\\ TestLogger" , "hasDebugThatMatches" , 0 ),
7171 };
7272
73+ private static final MethodParameterSignature [] RESET_INJECTION_SIGNATURES = {
74+ new MethodParameterSignature ("\\ Symfony\\ Component\\ Console\\ Output\\ OutputInterface" , "write" , 0 ),
75+ new MethodParameterSignature ("\\ Symfony\\ Component\\ Console\\ Output\\ OutputInterface" , "writeln" , 0 ),
76+ new MethodParameterSignature ("\\ Symfony\\ Component\\ Console\\ Formatter\\ OutputFormatter" , "escape" , 0 ),
77+ new MethodParameterSignature ("\\ Symfony\\ Component\\ Console\\ Formatter\\ OutputFormatter" , "escapeTrailingBackslash" , 0 ),
78+ new MethodParameterSignature ("\\ Symfony\\ Component\\ Console\\ Formatter\\ OutputFormatterInterface" , "format" , 0 ),
79+ };
80+
7381 private final MethodLanguageInjection [] LANGUAGE_INJECTIONS = {
7482 new MethodLanguageInjection (LANGUAGE_ID_CSS , "@media all { " , " }" , CSS_SELECTOR_SIGNATURES ),
7583 new MethodLanguageInjection (LANGUAGE_ID_XPATH , null , null , XPATH_SIGNATURES ),
7684 new MethodLanguageInjection (LANGUAGE_ID_JSON , null , null , JSON_SIGNATURES ),
7785 new MethodLanguageInjection (LANGUAGE_ID_DQL , null , null , DQL_SIGNATURES ),
7886 new MethodLanguageInjection (LANGUAGE_ID_PHPREGEXP , null , null , PHPREGEXP_SIGNATURES ),
87+ new MethodLanguageInjection (LANGUAGE_ID_TEXT , null , null , RESET_INJECTION_SIGNATURES ),
7988 };
8089
8190 public static final String LANGUAGE_ID_CSS = "CSS" ;
8291 public static final String LANGUAGE_ID_XPATH = "XPath" ;
8392 public static final String LANGUAGE_ID_JSON = "JSON" ;
8493 public static final String LANGUAGE_ID_DQL = "DQL" ;
8594 public static final String LANGUAGE_ID_PHPREGEXP = "PhpRegExp" ;
95+ public static final String LANGUAGE_ID_TEXT = "TEXT" ;
8696
8797 private static final String DQL_VARIABLE_NAME = "dql" ;
8898
@@ -138,6 +148,10 @@ public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull
138148 MethodMatcher .CallToSignature callToSignature = new MethodMatcher .CallToSignature (signature .getClassName (), signature .getMethodName ());
139149 MethodMatcher .MethodMatchParameter matchParameter = MethodMatcher .getMatchedSignatureWithDepth (psiNearestParameter , new MethodMatcher .CallToSignature []{callToSignature }, signature .getParameterIndex ());
140150 if (matchParameter != null ) {
151+ // Only "overwrite" language injection to "TEXT" when XML-like characters in literal
152+ if (LANGUAGE_ID_TEXT .equals (language .getID ()) && !expr .getContents ().contains ("<" )) {
153+ return ;
154+ }
141155 injectLanguage (registrar , expr , language , languageInjection );
142156 return ;
143157 }
0 commit comments