From c3525ccfc12b43c074f2fd942d4937510d481c20 Mon Sep 17 00:00:00 2001 From: nourpups <120077426+nourpups@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:07:10 +0500 Subject: [PATCH] Update old 'share' method to 'addShared' While reading the "Definitions" page in the 4.x documentation, I noticed that the old "share" method, which has been replaced by "addShared", is still there. The replacement of the old method is mentioned in upgrade-guide 3.x to 4.x --- docs/4.x/definitions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/4.x/definitions.md b/docs/4.x/definitions.md index 9cfa117..80cddcc 100644 --- a/docs/4.x/definitions.md +++ b/docs/4.x/definitions.md @@ -193,7 +193,7 @@ declare(strict_types=1); $container = new League\Container\Container(); -$container->share(Acme\Foo::class); +$container->addShared(Acme\Foo::class); ~~~ If you would like to make all your definitions to default to shared, you can define that on Container, meaning that the `add` method will default to setting your definitions as shared and multiple calls to `get` will return the same instance. Only definitions after this is set will default to shared.