Skip to content

Commit 34c68f9

Browse files
Merge branch '3.2' into 3.3
* 3.2: [DI] Make dumped docblocks less verbose
2 parents 21d98d4 + ceb4393 commit 34c68f9

14 files changed

+137
-400
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ private function addService($id, Definition $definition)
588588

589589
if ($class = $definition->getClass()) {
590590
$class = $this->container->resolveEnvPlaceholders($class);
591-
$return[] = sprintf('@return %s A %s instance', 0 === strpos($class, '%') ? 'object' : '\\'.ltrim($class, '\\'), ltrim($class, '\\'));
591+
$return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\'));
592592
} elseif ($definition->getFactory()) {
593593
$factory = $definition->getFactory();
594594
if (is_string($factory)) {
@@ -613,40 +613,14 @@ private function addService($id, Definition $definition)
613613
$return = str_replace("\n * \n", "\n *\n", implode("\n * ", $return));
614614
$return = $this->container->resolveEnvPlaceholders($return);
615615

616-
$doc = '';
617-
if ($definition->isShared()) {
618-
$doc .= <<<'EOF'
619-
620-
*
621-
* This service is shared.
622-
* This method always returns the same instance of the service.
623-
EOF;
624-
}
625-
626-
if (!$definition->isPublic()) {
627-
$doc .= <<<'EOF'
628-
629-
*
630-
* This service is private.
631-
* If you want to be able to request this service from the container directly,
632-
* make it public, otherwise you might end up with broken code.
633-
EOF;
634-
}
635-
636-
if ($definition->isAutowired()) {
637-
$doc .= <<<EOF
638-
639-
*
640-
* This service is autowired.
641-
EOF;
642-
}
616+
$shared = $definition->isShared() ? ' shared' : '';
617+
$public = $definition->isPublic() ? 'public' : 'private';
618+
$autowired = $definition->isAutowired() ? ' autowired' : '';
643619

644620
if ($definition->isLazy()) {
645621
$lazyInitialization = '$lazyLoad = true';
646-
$lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy\n *";
647622
} else {
648623
$lazyInitialization = '';
649-
$lazyInitializationDoc = '';
650624
}
651625

652626
// with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer
@@ -656,8 +630,8 @@ private function addService($id, Definition $definition)
656630
$code = <<<EOF
657631
658632
/*{$this->docStar}
659-
* Gets the '$id' service.$doc
660-
*$lazyInitializationDoc
633+
* Gets the $public '$id'$shared$autowired service.
634+
*
661635
* $return
662636
*/
663637
{$visibility} function {$methodName}($lazyInitialization)

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,9 @@ public function isFrozen()
6363
}
6464

6565
/**
66-
* Gets the 'test' service.
66+
* Gets the public 'test' shared service.
6767
*
68-
* This service is shared.
69-
* This method always returns the same instance of the service.
70-
*
71-
* @return \stdClass A stdClass instance
68+
* @return \stdClass
7269
*/
7370
protected function getTestService()
7471
{

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,9 @@ public function isFrozen()
6767
}
6868

6969
/**
70-
* Gets the 'test' service.
70+
* Gets the public 'test' shared service.
7171
*
72-
* This service is shared.
73-
* This method always returns the same instance of the service.
74-
*
75-
* @return \stdClass A stdClass instance
72+
* @return \stdClass
7673
*/
7774
protected function getTestService()
7875
{

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,9 @@ public function isFrozen()
6161
}
6262

6363
/**
64-
* Gets the 'bar' service.
64+
* Gets the public 'bar' shared service.
6565
*
66-
* This service is shared.
67-
* This method always returns the same instance of the service.
68-
*
69-
* @return \stdClass A stdClass instance
66+
* @return \stdClass
7067
*/
7168
protected function getBarService()
7269
{

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,19 @@ public function isFrozen()
6262
}
6363

6464
/**
65-
* Gets the 'service_from_anonymous_factory' service.
65+
* Gets the public 'service_from_anonymous_factory' shared service.
6666
*
67-
* This service is shared.
68-
* This method always returns the same instance of the service.
69-
*
70-
* @return \Bar\FooClass A Bar\FooClass instance
67+
* @return \Bar\FooClass
7168
*/
7269
protected function getServiceFromAnonymousFactoryService()
7370
{
7471
return $this->services['service_from_anonymous_factory'] = (new \Bar\FooClass())->getInstance();
7572
}
7673

7774
/**
78-
* Gets the 'service_with_method_call_and_factory' service.
79-
*
80-
* This service is shared.
81-
* This method always returns the same instance of the service.
75+
* Gets the public 'service_with_method_call_and_factory' shared service.
8276
*
83-
* @return \Bar\FooClass A Bar\FooClass instance
77+
* @return \Bar\FooClass
8478
*/
8579
protected function getServiceWithMethodCallAndFactoryService()
8680
{

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services24.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,9 @@ public function isFrozen()
6161
}
6262

6363
/**
64-
* Gets the 'foo' service.
64+
* Gets the public 'foo' shared autowired service.
6565
*
66-
* This service is shared.
67-
* This method always returns the same instance of the service.
68-
*
69-
* This service is autowired.
70-
*
71-
* @return \Foo A Foo instance
66+
* @return \Foo
7267
*/
7368
protected function getFooService()
7469
{

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ public function isFrozen()
6363
}
6464

6565
/**
66-
* Gets the 'test' service.
67-
*
68-
* This service is shared.
69-
* This method always returns the same instance of the service.
66+
* Gets the public 'test' shared service.
7067
*
7168
* @return object A %env(FOO)% instance
7269
*/

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services33.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,9 @@ public function isFrozen()
6464
}
6565

6666
/**
67-
* Gets the 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo' service.
67+
* Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo' shared service.
6868
*
69-
* This service is shared.
70-
* This method always returns the same instance of the service.
71-
*
72-
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo A Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo instance
69+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo
7370
*/
7471
protected function getSymfony_Component_DependencyInjection_Tests_Fixtures_Container33_FooService()
7572
{

0 commit comments

Comments
 (0)