File tree 1 file changed +10
-8
lines changed
src/Symfony/Component/DependencyInjection/Dumper
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ class PhpDumper extends Dumper
58
58
private $ targetDirRegex ;
59
59
private $ targetDirMaxMatches ;
60
60
private $ docStar ;
61
- private $ existingNames = array ();
61
+ private $ serviceIdToMethodNameMap = array ();
62
+ private $ usedMethodNames = array ();
62
63
63
64
/**
64
65
* @var \Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface
@@ -1350,19 +1351,20 @@ private function getServiceCall($id, Reference $reference = null)
1350
1351
*/
1351
1352
private function camelize ($ id )
1352
1353
{
1353
- if (isset ($ this ->existingNames [$ id ])) {
1354
- return $ this ->existingNames [$ id ];
1354
+ if (isset ($ this ->serviceIdToMethodNameMap [$ id ])) {
1355
+ return $ this ->serviceIdToMethodNameMap [$ id ];
1355
1356
}
1356
1357
1357
1358
$ name = Container::camelize ($ id );
1358
1359
$ uniqueName = $ name = preg_replace ('/[^a-zA-Z0-9_\x7f-\xff]/ ' , '' , $ name );
1359
- $ prefix = 1 ;
1360
+ $ suffix = 1 ;
1360
1361
1361
- while (in_array ( $ uniqueName , $ this ->existingNames )) {
1362
- ++$ prefix ;
1363
- $ uniqueName = $ name .$ prefix ;
1362
+ while (isset ( $ this ->usedMethodNames [ $ uniqueName ] )) {
1363
+ ++$ suffix ;
1364
+ $ uniqueName = $ name .$ suffix ;
1364
1365
}
1365
- $ this ->existingNames [$ id ] = $ uniqueName ;
1366
+ $ this ->serviceIdToMethodNameMap [$ id ] = $ uniqueName ;
1367
+ $ this ->usedMethodNames [$ uniqueName ] = true ;
1366
1368
1367
1369
return $ uniqueName ;
1368
1370
}
You can’t perform that action at this time.
0 commit comments