File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
main/java/fr/adrienbrault/idea/symfony2plugin/dic/container
test/java/fr/adrienbrault/idea/symfony2plugin/tests/dic Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,25 @@ public static XmlService createFromXml(@NotNull Element node) {
9595 return null ;
9696 }
9797
98+ // <service id="Psr\Log\LoggerInterface $securityLogger" alias="monolog.logger.security"/>
99+ if (id .contains (" $" ) && id .matches ("^.*\\ s\\ $.*$" )) {
100+ return null ;
101+ }
102+
103+ if (id .startsWith ("." )) {
104+ // <service id=".service_locator.XSes1R5" class="Symfony\Component\DependencyInjection\ServiceLocator" public="false">
105+ // <service id=".service_locator.tHpW6v3" alias=".service_locator.Y7gDuDN" public="false"/>
106+ if (id .startsWith (".service_locator" ) && id .matches ("^\\ .service_locator.*\\ .[\\ w_]+$" )) {
107+ return null ;
108+ }
109+
110+ // <service id=".1_ArrayCache~kSL.YwK" class="Doctrine\Common\Cache\ArrayCache" public="false"/>
111+ // <service id=".2_~NpzP6Xn" public="false">
112+ if (id .matches ("^\\ .[\\ w]+_.*\\ .[\\ w_]+$" ) || id .matches ("^\\ .[\\ w]+_~[\\ w_]+$" )) {
113+ return null ;
114+ }
115+ }
116+
98117 XmlService xmlService = new XmlService (id );
99118
100119 String aClass = node .getAttribute ("class" );
@@ -103,7 +122,7 @@ public static XmlService createFromXml(@NotNull Element node) {
103122 }
104123
105124 String isPublic = node .getAttribute ("public" );
106- if (isPublic != null && "false" .equalsIgnoreCase (isPublic )) {
125+ if ("false" .equalsIgnoreCase (isPublic )) {
107126 xmlService .isPublic = false ;
108127 }
109128
Original file line number Diff line number Diff line change @@ -22,8 +22,13 @@ public void testParse() throws Exception {
2222 "<container>" +
2323 "<service id=\" adrienbrault\" class=\" AdrienBrault\\ Awesome\" />" +
2424 "<service id=\" secret\" class=\" AdrienBrault\\ Secret\" public=\" false\" />" +
25+ "<service id=\" .secret.test\" class=\" AdrienBrault\\ Secret\" public=\" false\" />" +
2526 "<service id=\" translator\" alias=\" adrienbrault\" />" +
2627 "<service id=\" translator_private\" alias=\" adrienbrault\" public=\" false\" />" +
28+ "<service id=\" .service_locator.SFX6J7Y\" class=\" Symfony\\ Component\\ DependencyInjection\\ ServiceLocator\" public=\" false\" />" +
29+ "<service id=\" Psr\\ Log\\ LoggerInterface $securityLogger\" alias=\" monolog.logger.security\" />" +
30+ "<service id=\" .1_~NpzP6Xn\" public=\" false\" />" +
31+ "<service id=\" .2_PhpArrayAdapter~kSL.YwK\" class=\" Symfony\\ Component\\ Cache\\ Adapter\\ PhpArrayAdapter\" public=\" false\" />" +
2732 "</container>" ;
2833
2934 ServiceMap serviceMap = serviceMapParser .parse (new ByteArrayInputStream (xmlString .getBytes ()));
@@ -44,5 +49,12 @@ public void testParse() throws Exception {
4449 assertFalse (
4550 serviceMap .getServices ().stream ().filter (s -> "secret" .equals (s .getId ())).findFirst ().get ().isPublic ()
4651 );
52+
53+ assertEquals (1 , serviceMap .getServices ().stream ().filter (s -> ".secret.test" .equals (s .getId ())).count ());
54+
55+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".service_locator.SFX6J7Y" .equals (s .getId ())).count ());
56+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".service_locator.SFX6J7Y" .equals (s .getId ())).count ());
57+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".1_~NpzP6Xn" .equals (s .getId ())).count ());
58+ assertEquals (0 , serviceMap .getServices ().stream ().filter (s -> ".2_PhpArrayAdapter~kSL.YwK" .equals (s .getId ())).count ());
4759 }
4860}
You can’t perform that action at this time.
0 commit comments