File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -858,9 +858,12 @@ This is mostly useful when you want to fetch services lazily::
858858 // ...
859859 }
860860
861- As a best practice, you should only create *private * services, which will happen
862- automatically. And also, you should *not * use the ``$container->get() `` method to
863- fetch private services.
861+ As a best practice, you should only create *private * services. This allows for
862+ safe container optimizations, e.g. removing unused services. You should not use
863+ ``$container->get() `` to fetch public services, as it will make it harder to
864+ make those services private later. Instead consider
865+ :ref: `injecting services <services-constructor-injection >` or using
866+ :doc: `Service Subscribers or Locators </service_container/service_subscribers_locators >`.
864867
865868But, if you *do * need to make a service public, override the ``public `` setting:
866869
You can’t perform that action at this time.
0 commit comments