diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index ee58034713b0b..d5d827af80aaf 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -51,8 +51,8 @@ class Definition private static $defaultDeprecationTemplate = 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.'; /** - * @param string|null $class The service class - * @param array $arguments An array of arguments to pass to the service constructor + * @param string|Parameter|null $class The service class + * @param array $arguments An array of arguments to pass to the service constructor */ public function __construct($class = null, array $arguments = []) { @@ -157,7 +157,7 @@ public function getDecoratedService() /** * Sets the service class. * - * @param string $class The service class + * @param string|Parameter|null $class The service class * * @return $this */ @@ -173,7 +173,7 @@ public function setClass($class) /** * Gets the service class. * - * @return string|null The service class + * @return string|Parameter|null The service class */ public function getClass() { diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php index 3581fe855037e..1b24afbe7057f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Parameter; class DefinitionTest extends TestCase { @@ -45,6 +46,14 @@ public function testSetGetClass() $this->assertEquals('foo', $def->getClass(), '->getClass() returns the class name'); } + public function testSetGetClassWithParameter() + { + $def = new Definition('stdClass'); + $parameter = new Parameter('foo'); + $this->assertSame($def, $def->setClass($parameter), '->setClass() implements a fluent interface'); + $this->assertSame($parameter, $def->getClass(), '->getClass() returns the parameterized class name'); + } + public function testSetGetDecoratedService() { $def = new Definition('stdClass');
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: