@@ -565,7 +565,7 @@ private function addService($id, Definition $definition)
565565 if ($ definition ->isSynthetic ()) {
566566 $ return [] = '@throws RuntimeException always since this service is expected to be injected dynamically ' ;
567567 } 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 , '\\' ));
569569 } elseif ($ definition ->getFactory ()) {
570570 $ factory = $ definition ->getFactory ();
571571 if (is_string ($ factory )) {
@@ -601,40 +601,14 @@ private function addService($id, Definition $definition)
601601
602602 $ return = str_replace ("\n * \n" , "\n * \n" , implode ("\n * " , $ return ));
603603
604- $ doc = '' ;
605- if ($ definition ->isShared () && ContainerInterface::SCOPE_PROTOTYPE !== $ scope ) {
606- $ doc .= <<<'EOF'
607-
608- *
609- * This service is shared.
610- * This method always returns the same instance of the service.
611- EOF;
612- }
613-
614- if (!$ definition ->isPublic ()) {
615- $ doc .= <<<'EOF'
616-
617- *
618- * This service is private.
619- * If you want to be able to request this service from the container directly,
620- * make it public, otherwise you might end up with broken code.
621- EOF;
622- }
623-
624- if ($ definition ->isAutowired ()) {
625- $ doc .= <<<EOF
626-
627- *
628- * This service is autowired.
629- EOF ;
630- }
604+ $ shared = $ definition ->isShared () && ContainerInterface::SCOPE_PROTOTYPE !== $ scope ? ' shared ' : '' ;
605+ $ public = $ definition ->isPublic () ? 'public ' : 'private ' ;
606+ $ autowired = $ definition ->isAutowired () ? ' autowired ' : '' ;
631607
632608 if ($ definition ->isLazy ()) {
633609 $ lazyInitialization = '$lazyLoad = true ' ;
634- $ lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy \n * " ;
635610 } else {
636611 $ lazyInitialization = '' ;
637- $ lazyInitializationDoc = '' ;
638612 }
639613
640614 // with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer
@@ -643,8 +617,8 @@ private function addService($id, Definition $definition)
643617 $ code = <<<EOF
644618
645619 /* {$ this ->docStar }
646- * Gets the ' $ id' service. $ doc
647- * $ lazyInitializationDoc
620+ * Gets the $ public '$ id' $ shared $ autowired service.
621+ *
648622 * $ return
649623 */
650624 {$ visibility } function get {$ this ->camelize ($ id )}Service( $ lazyInitialization)
0 commit comments