bug #11756 [DependencyInjection] fix @return anno created by PhpDumper (jakubkulhan)

This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #11756).

Discussion
----------

[DependencyInjection] fix @return anno created by PhpDumper

| Q             | A
| ------------- | ---
| Fixed tickets | ---
| License       | MIT

If a generated container is inside namespace, generated @return annos are not valid.

Commits
-------

39c4cc3 [DependencyInjection] fix @return anno created by PhpDumper
This commit is contained in:
Fabien Potencier 2014-08-26 15:05:17 +02:00
commit 0c44306d34
5 changed files with 20 additions and 20 deletions

View File

@ -508,7 +508,7 @@ class PhpDumper extends Dumper
if ($definition->isSynthetic()) { if ($definition->isSynthetic()) {
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically'; $return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
} elseif ($class = $definition->getClass()) { } elseif ($class = $definition->getClass()) {
$return[] = sprintf("@return %s A %s instance.", 0 === strpos($class, '%') ? 'object' : $class, $class); $return[] = sprintf("@return %s A %s instance.", 0 === strpos($class, '%') ? 'object' : "\\".$class, $class);
} elseif ($definition->getFactoryClass()) { } elseif ($definition->getFactoryClass()) {
$return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(), $definition->getFactoryMethod()); $return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(), $definition->getFactoryMethod());
} elseif ($definition->getFactoryService()) { } elseif ($definition->getFactoryService()) {

View File

@ -44,7 +44,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return stdClass A stdClass instance. * @return \stdClass A stdClass instance.
*/ */
protected function getTestService() protected function getTestService()
{ {

View File

@ -42,7 +42,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return stdClass A stdClass instance. * @return \stdClass A stdClass instance.
*/ */
protected function getFooService() protected function getFooService()
{ {

View File

@ -47,7 +47,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return FooClass A FooClass instance. * @return \FooClass A FooClass instance.
*/ */
protected function getBarService() protected function getBarService()
{ {
@ -64,7 +64,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return Baz A Baz instance. * @return \Baz A Baz instance.
*/ */
protected function getBazService() protected function getBazService()
{ {
@ -81,7 +81,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return stdClass A stdClass instance. * @return \stdClass A stdClass instance.
*/ */
protected function getDependsOnRequestService() protected function getDependsOnRequestService()
{ {
@ -98,7 +98,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return Bar A Bar instance. * @return \Bar A Bar instance.
*/ */
protected function getFactoryServiceService() protected function getFactoryServiceService()
{ {
@ -111,7 +111,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return FooClass A FooClass instance. * @return \FooClass A FooClass instance.
*/ */
protected function getFooService() protected function getFooService()
{ {
@ -164,7 +164,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return Foo A Foo instance. * @return \Foo A Foo instance.
*/ */
protected function getFooWithInlineService() protected function getFooWithInlineService()
{ {
@ -181,7 +181,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return FooClass A FooClass instance. * @return \FooClass A FooClass instance.
*/ */
protected function getMethodCall1Service() protected function getMethodCall1Service()
{ {
@ -234,7 +234,7 @@ class ProjectServiceContainer extends Container
* If you want to be able to request this service from the container directly, * If you want to be able to request this service from the container directly,
* make it public, otherwise you might end up with broken code. * make it public, otherwise you might end up with broken code.
* *
* @return Bar A Bar instance. * @return \Bar A Bar instance.
*/ */
protected function getInlinedService() protected function getInlinedService()
{ {

View File

@ -55,7 +55,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return FooClass A FooClass instance. * @return \FooClass A FooClass instance.
*/ */
protected function getBarService() protected function getBarService()
{ {
@ -72,7 +72,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return Baz A Baz instance. * @return \Baz A Baz instance.
*/ */
protected function getBazService() protected function getBazService()
{ {
@ -89,7 +89,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return stdClass A stdClass instance. * @return \stdClass A stdClass instance.
*/ */
protected function getDependsOnRequestService() protected function getDependsOnRequestService()
{ {
@ -106,7 +106,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return Bar A Bar instance. * @return \Bar A Bar instance.
*/ */
protected function getFactoryServiceService() protected function getFactoryServiceService()
{ {
@ -119,7 +119,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return FooClass A FooClass instance. * @return \FooClass A FooClass instance.
*/ */
protected function getFooService() protected function getFooService()
{ {
@ -143,7 +143,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return BazClass A BazClass instance. * @return \BazClass A BazClass instance.
*/ */
protected function getFoo_BazService() protected function getFoo_BazService()
{ {
@ -157,7 +157,7 @@ class ProjectServiceContainer extends Container
/** /**
* Gets the 'foo_bar' service. * Gets the 'foo_bar' service.
* *
* @return FooClass A FooClass instance. * @return \FooClass A FooClass instance.
*/ */
protected function getFooBarService() protected function getFooBarService()
{ {
@ -170,7 +170,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return Foo A Foo instance. * @return \Foo A Foo instance.
*/ */
protected function getFooWithInlineService() protected function getFooWithInlineService()
{ {
@ -192,7 +192,7 @@ class ProjectServiceContainer extends Container
* This service is shared. * This service is shared.
* This method always returns the same instance of the service. * This method always returns the same instance of the service.
* *
* @return FooClass A FooClass instance. * @return \FooClass A FooClass instance.
*/ */
protected function getMethodCall1Service() protected function getMethodCall1Service()
{ {