@@ -565,7 +565,7 @@ private function addService($id, Definition $definition)
565
565
if ($ definition ->isSynthetic ()) {
566
566
$ return [] = '@throws RuntimeException always since this service is expected to be injected dynamically ' ;
567
567
} elseif ($ class = $ definition ->getClass ()) {
568
- $ return [] = sprintf (' @return %s A %s instance ' , 0 === strpos ($ class , '% ' ) ? 'object ' : '\\' . ltrim ( $ class , '\\' ) , ltrim ($ class , '\\' ));
568
+ $ return [] = sprintf (0 === strpos ($ class , '% ' ) ? '@return object A %1$s instance ' : '@return \%s ' , ltrim ($ class , '\\' ));
569
569
} elseif ($ definition ->getFactory ()) {
570
570
$ factory = $ definition ->getFactory ();
571
571
if (is_string ($ factory )) {
@@ -593,32 +593,13 @@ private function addService($id, Definition $definition)
593
593
594
594
$ return = implode ("\n * " , $ return );
595
595
596
- $ doc = '' ;
597
- if (ContainerInterface::SCOPE_PROTOTYPE !== $ scope ) {
598
- $ doc .= <<<'EOF'
599
-
600
- *
601
- * This service is shared.
602
- * This method always returns the same instance of the service.
603
- EOF;
604
- }
605
-
606
- if (!$ definition ->isPublic ()) {
607
- $ doc .= <<<'EOF'
608
-
609
- *
610
- * This service is private.
611
- * If you want to be able to request this service from the container directly,
612
- * make it public, otherwise you might end up with broken code.
613
- EOF;
614
- }
596
+ $ shared = ContainerInterface::SCOPE_PROTOTYPE !== $ scope ? ' shared ' : '' ;
597
+ $ public = $ definition ->isPublic () ? 'public ' : 'private ' ;
615
598
616
599
if ($ definition ->isLazy ()) {
617
600
$ lazyInitialization = '$lazyLoad = true ' ;
618
- $ lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy \n * " ;
619
601
} else {
620
602
$ lazyInitialization = '' ;
621
- $ lazyInitializationDoc = '' ;
622
603
}
623
604
624
605
// with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer
@@ -627,8 +608,8 @@ private function addService($id, Definition $definition)
627
608
$ code = <<<EOF
628
609
629
610
/* {$ this ->docStar }
630
- * Gets the ' $ id' service. $ doc
631
- * $ lazyInitializationDoc
611
+ * Gets the $ public '$ id' $ shared service.
612
+ *
632
613
* $ return
633
614
*/
634
615
{$ visibility } function get {$ this ->camelize ($ id )}Service( $ lazyInitialization)
0 commit comments