8000 Merge branch '3.4' · symfony/symfony@3ea90b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ea90b4

Browse files
Merge branch '3.4'
* 3.4: minor fix [DI] Make dumped docblocks less verbose [VarDumper] Dont use Stub objects for arrays [Form] Allow pass filter callback to delete_empty option.
2 parents 643c54c + 6bbb391 commit 3ea90b4

23 files changed

+333
-613
lines changed

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

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

585585
if ($class = $definition->getClass()) {
586586
$class = $this->container->resolveEnvPlaceholders($class);
587-
$return[] = sprintf('@return %s A %s instance', 0 === strpos($class, '%') ? 'object' : '\\'.ltrim($class, '\\'), ltrim($class, '\\'));
587+
$return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\'));
588588
} elseif ($definition->getFactory()) {
589589
$factory = $definition->getFactory();
590590
if (is_string($factory)) {
@@ -609,40 +609,14 @@ private function addService($id, Definition $definition)
609609
$return = str_replace("\n * \n", "\n *\n", implode("\n * ", $return));
610610
$return = $this->container->resolveEnvPlaceholders($return);
611611

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

640616
if ($definition->isLazy()) {
641617
$lazyInitialization = '$lazyLoad = true';
642-
$lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy\n *";
643618
} else {
644619
$lazyInitialization = '';
645-
$lazyInitializationDoc = '';
646620
}
647621

648622
// with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer
@@ -652,8 +626,8 @@ private function addService($id, Definition $definition)
652626
$code = <<<EOF
653627
654628
/*{$this->docStar}
655-
* Gets the '$id' service.$doc
656-
*$lazyInitializationDoc
629+
* Gets the $public '$id'$shared$autowired service.
630+
*
657631
* $return
658632
*/
659633
{$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 isCompiled()
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 isCompiled()
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 isCompiled()
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 isCompiled()
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 isCompiled()
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 isCompiled()
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
@@ -61,12 +61,9 @@ public function isCompiled()
6161
}
6262

6363
/**
64-
* Gets the 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo' service.
64+
* Gets the public 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo' shared service.
6565
*
66-
* This service is shared.
67-
* This method always returns the same instance of the service.
68-
*
69-
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo A Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo instance
66+
* @return \Symfony\Component\DependencyInjection\Tests\Fixtures\Container33\Foo
7067
*/
7168
protected function getSymfony_Component_DependencyInjection_Tests_Fixtures_Container33_FooService()
7269
{

0 commit comments

Comments
 (0)
0