File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
src/Symfony/Component/DependencyInjection Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1226,7 +1226,7 @@ private function addDeprecatedAliases(): string
1226
1226
$ methodNameAlias = $ this ->generateMethodName ($ alias );
1227
1227
$ idExported = $ this ->export ($ id );
1228
1228
$ messageExported = $ this ->export ($ definition ->getDeprecationMessage ($ alias ));
1229
- $ code = <<<EOF
1229
+ $ code . = <<<EOF
1230
1230
1231
1231
/* {$ this ->docStar }
1232
1232
* Gets the $ public ' $ alias' alias.
Original file line number Diff line number Diff line change @@ -1283,6 +1283,30 @@ public function testWither()
1283
1283
$ wither = $ container ->get ('wither ' );
1284
1284
$ this ->assertInstanceOf (Foo::class, $ wither ->foo );
1285
1285
}
1286
+
1287
+ /**
1288
+ * @group legacy
1289
+ * @expectedDeprecation The "deprecated1" service alias is deprecated. You should stop using it, as it will be removed in the future.
1290
+ * @expectedDeprecation The "deprecated2" service alias is deprecated. You should stop using it, as it will be removed in the future.
1291
+ */
1292
+ public function testMultipleDeprecatedAliasesWorking ()
1293
+ {
1294
+ $ container = new ContainerBuilder ();
1295
+ $ container ->setDefinition ('bar ' , new Definition ('stdClass ' ))->setPublic (true );
1296
+ $ container ->setAlias ('deprecated1 ' , 'bar ' )->setPublic (true )->setDeprecated ('%alias_id% is deprecated ' );
1297
+ $ container ->setAlias ('deprecated2 ' , 'bar ' )->setPublic (true )->setDeprecated ('%alias_id% is deprecated ' );
1298
+ $ container ->compile ();
1299
+
1300
+ $ dumper = new PhpDumper ($ container );
1301
+ $ dump = $ dumper ->dump (['class ' => $ class = __FUNCTION__ ]);
1302
+
1303
+ eval ('?> ' .$ dump );
1304
+ $ container = new $ class ();
1305
+
1306
+ $ this ->assertInstanceOf (\stdClass::class, $ container ->get ('bar ' ));
1307
+ $ this ->assertInstanceOf (\stdClass::class, $ container ->get ('deprecated1 ' ));
1308
+ $ this ->assertInstanceOf (\stdClass::class, $ container ->get ('deprecated2 ' ));
1309
+ }
1286
1310
}
1287
1311
1288
1312
class Rot13EnvVarProcessor implements EnvVarProcessorInterface
You can’t perform that action at this time.
0 commit comments