@@ -70,19 +70,29 @@ public class ParameterLanguageInjector implements MultiHostInjector {
70
70
new MethodParameterSignature ("\\ Psr\\ Log\\ Test\\ TestLogger" , "hasDebugThatMatches" , 0 ),
71
71
};
72
72
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
+
73
81
private final MethodLanguageInjection [] LANGUAGE_INJECTIONS = {
74
82
new MethodLanguageInjection (LANGUAGE_ID_CSS , "@media all { " , " }" , CSS_SELECTOR_SIGNATURES ),
75
83
new MethodLanguageInjection (LANGUAGE_ID_XPATH , null , null , XPATH_SIGNATURES ),
76
84
new MethodLanguageInjection (LANGUAGE_ID_JSON , null , null , JSON_SIGNATURES ),
77
85
new MethodLanguageInjection (LANGUAGE_ID_DQL , null , null , DQL_SIGNATURES ),
78
86
new MethodLanguageInjection (LANGUAGE_ID_PHPREGEXP , null , null , PHPREGEXP_SIGNATURES ),
87
+ new MethodLanguageInjection (LANGUAGE_ID_TEXT , null , null , RESET_INJECTION_SIGNATURES ),
79
88
};
80
89
81
90
public static final String LANGUAGE_ID_CSS = "CSS" ;
82
91
public static final String LANGUAGE_ID_XPATH = "XPath" ;
83
92
public static final String LANGUAGE_ID_JSON = "JSON" ;
84
93
public static final String LANGUAGE_ID_DQL = "DQL" ;
85
94
public static final String LANGUAGE_ID_PHPREGEXP = "PhpRegExp" ;
95
+ public static final String LANGUAGE_ID_TEXT = "TEXT" ;
86
96
87
97
private static final String DQL_VARIABLE_NAME = "dql" ;
88
98
@@ -138,6 +148,10 @@ public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull
138
148
MethodMatcher .CallToSignature callToSignature = new MethodMatcher .CallToSignature (signature .getClassName (), signature .getMethodName ());
139
149
MethodMatcher .MethodMatchParameter matchParameter = MethodMatcher .getMatchedSignatureWithDepth (psiNearestParameter , new MethodMatcher .CallToSignature []{callToSignature }, signature .getParameterIndex ());
140
150
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
+ }
141
155
injectLanguage (registrar , expr , language , languageInjection );
142
156
return ;
143
157
}
0 commit comments