File tree 2 files changed +25
-1
lines changed
src/Symfony/Component/DependencyInjection 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1298,7 +1298,7 @@ private function addDeprecatedAliases(): string
1298
1298
$ methodNameAlias = $ this ->generateMethodName ($ alias );
1299
1299
$ idExported = $ this ->export ($ id );
1300
1300
$ messageExported = $ this ->export ($ definition ->getDeprecationMessage ($ alias ));
1301
- $ code = <<<EOF
1301
+ $ code . = <<<EOF
1302
1302
1303
1303
/* {$ this ->docStar }
1304
1304
* Gets the $ public ' $ alias' alias.
Original file line number Diff line number Diff line change @@ -1339,6 +1339,30 @@ public function testWither()
1339
1339
$ wither = $ container ->get ('wither ' );
1340
1340
$ this ->assertInstanceOf (Foo::class, $ wither ->foo );
1341
1341
}
1342
+
1343
+ /**
1344
+ * @group legacy
1345
+ * @expectedDeprecation The "deprecated1" service alias is deprecated. You should stop using it, as it will be removed in the future.
1346
+ * @expectedDeprecation The "deprecated2" service alias is deprecated. You should stop using it, as it will be removed in the future.
1347
+ */
1348
+ public function testMultipleDeprecatedAliasesWorking ()
1349
+ {
1350
+ $ container = new ContainerBuilder ();
1351
+ $ container ->setDefinition ('bar ' , new Definition ('stdClass ' ))->setPublic (true );
1352
+ $ container ->setAlias ('deprecated1 ' , 'bar ' )->setPublic (true )->setDeprecated ('%alias_id% is deprecated ' );
1353
+ $ container ->setAlias ('deprecated2 ' , 'bar ' )->setPublic (true )->setDeprecated ('%alias_id% is deprecated ' );
1354
+ $ container ->compile ();
1355
+
1356
+ $ dumper = new PhpDumper ($ container );
1357
+ $ dump = $ dumper ->dump (['class ' => $ class = __FUNCTION__ ]);
1358
+
1359
+ eval ('?> ' .$ dump );
1360
+ $ container = new $ class ();
1361
+
1362
+ $ this ->assertInstanceOf (\stdClass::class, $ container ->get ('bar ' ));
1363
+ $ this ->assertInstanceOf (\stdClass::class, $ container ->get ('deprecated1 ' ));
1364
+ $ this ->assertInstanceOf (\stdClass::class, $ container ->get ('deprecated2 ' ));
1365
+ }
1342
1366
}
1343
1367
1344
1368
class Rot13EnvVarProcessor implements EnvVarProcessorInterface
You can’t perform that action at this time.
0 commit comments