8000 Merge branch '2.8' into 3.2 · symfony/symfony@ceb4393 · GitHub
[go: up one dir, main page]

Skip to content

Commit ceb4393

Browse files
Merge branch '2.8' into 3.2
* 2.8: [DI] Make dumped docblocks less verbose
2 parents a280e81 + 57bf748 commit ceb4393

11 files changed

+105
-311
lines changed

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

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ private function addService($id, Definition $definition)
580580
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
581581
} elseif ($class = $definition->getClass()) {
582582
$class = $this->container->resolveEnvPlaceholders($class);
583-
$return[] = sprintf('@return %s A %s instance', 0 === strpos($class, '%') ? 'object' : '\\'.ltrim($class, '\\'), ltrim($class, '\\'));
583+
$return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\'));
584584
} elseif ($definition->getFactory()) {
585585
$factory = $definition->getFactory();
586586
if (is_string($factory)) {
@@ -605,40 +605,14 @@ private function addService($id, Definition $definition)
605605
$return = str_replace("\n * \n", "\n *\n", implode("\n * ", $return));
606606
$return = $this->container->resolveEnvPlaceholders($return);
607607

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

636612
if ($definition->isLazy()) {
637613
$lazyInitialization = '$lazyLoad = true';
638-
$lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy\n *";
639614
} else {
640615
$lazyInitialization = '';
641-
$lazyInitializationDoc = '';
642616
}
643617

644618
// with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer
@@ -648,8 +622,8 @@ private function addService($id, Definition $definition)
648622
$code = <<<EOF
649623
650624
/*{$this->docStar}
651-
* Gets the '$id' service.$doc
652-
*$lazyInitializationDoc
625+
* Gets the $public '$id'$shared$autowired service.
626+
*
653627
* $return
654628
*/
655629
{$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
@@ -50,12 +50,9 @@ public function isFrozen()
5050
}
5151

5252
/**
53-
* Gets the 'test' service.
53+
* Gets the public 'test' shared service.
5454
*
55-
* This service is shared.
56-
* This method always returns the same instance of the service.
57-
*
58-
* @return \stdClass A stdClass instance
55+
* @return \stdClass
5956
*/
6057
protected function getTestService()
6158
{

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

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

5656
/**
57-
* Gets the 'test' service.
57+
* Gets the public 'test' shared service.
5858
*
59-
* This service is shared.
60-
* This method always returns the same instance of the service.
61-
*
62-
* @return \stdClass A stdClass instance
59+
* @return \stdClass
6360
*/
6461
protected function getTestService()
6562
{

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

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

5050
/**
51-
* Gets the 'bar' service.
51+
* Gets the public 'bar' shared service.
5252
*
53-
* This service is shared.
54-
* This method always returns the same instance of the service.
55-
*
56-
* @return \stdClass A stdClass instance
53+
* @return \stdClass
5754
*/
5855
protected function getBarService()
5956
{

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,19 @@ public function __construct()
3131
}
3232

3333
/**
34-
* Gets the 'service_from_anonymous_factory' service.
34+
* Gets the public 'service_from_anonymous_factory' shared service.
3535
*
36-
* This service is shared.
37-
* This method always returns the same instance of the service.
38-
*
39-
* @return \Bar\FooClass A Bar\FooClass instance
36+
* @return \Bar\FooClass
4037
*/
4138
protected function getServiceFromAnonymousFactoryService()
4239
{
4340
return $this->services['service_from_anonymous_factory'] = (new \Bar\FooClass())->getInstance();
4441
}
4542

4643
/**
47-
* Gets the 'service_with_method_call_and_factory' service.
48-
*
49-
* This service is shared.
50-
* This method always returns the same instance of the service.
44+
* Gets the public 'service_with_method_call_and_factory' shared service.
5145
*
52-
* @return \Bar\FooClass A Bar\FooClass instance
46+
* @return \Bar\FooClass
5347
*/
5448
protected function getServiceWithMethodCallAndFactoryService()
5549
{

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,9 @@ public function __construct()
3030
}
3131

3232
/**
33-
* Gets the 'foo' service.
33+
* Gets the public 'foo' shared autowired service.
3434
*
35-
* This service is shared.
36-
* This method always returns the same instance of the service.
37-
*
38-
* This service is autowired.
39-
*
40-
* @return \Foo A Foo instance
35+
* @return \Foo
4136
*/
4237
protected function getFooService()
4338
{

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

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

5252
/**
53-
* Gets the 'test' service.
54-
*
55-
* This service is shared.
56-
* This method always returns the same instance of the service.
53+
* Gets the public 'test' shared service.
5754
*
5855
* @return object A %env(FOO)% instance
5956
*/

0 commit comments

Comments
 (0)
0