From 1b448b723c87b28fc811bf12ac98773534af50ea Mon Sep 17 00:00:00 2001 From: spiralbot Date: Thu, 11 Jan 2024 13:31:30 +0000 Subject: [PATCH] Merge pull request #1056 from spiral/singleton-interface --- src/BootloadManager/AbstractBootloadManager.php | 5 +++-- src/BootloadManager/ClassesRegistry.php | 5 +++-- src/BootloadManager/Initializer.php | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/BootloadManager/AbstractBootloadManager.php b/src/BootloadManager/AbstractBootloadManager.php index d419f96..b8fe714 100644 --- a/src/BootloadManager/AbstractBootloadManager.php +++ b/src/BootloadManager/AbstractBootloadManager.php @@ -5,13 +5,14 @@ namespace Spiral\Boot\BootloadManager; use Spiral\Boot\BootloadManagerInterface; -use Spiral\Core\Container; +use Spiral\Core\Attribute\Singleton; use Spiral\Core\ScopeInterface; /** * Provides ability to bootload service providers. */ -abstract class AbstractBootloadManager implements BootloadManagerInterface, Container\SingletonInterface +#[Singleton] +abstract class AbstractBootloadManager implements BootloadManagerInterface { public function __construct( private readonly ScopeInterface $scope, diff --git a/src/BootloadManager/ClassesRegistry.php b/src/BootloadManager/ClassesRegistry.php index a318ebf..4c168bf 100644 --- a/src/BootloadManager/ClassesRegistry.php +++ b/src/BootloadManager/ClassesRegistry.php @@ -6,13 +6,14 @@ use Spiral\Boot\BootloadManagerInterface; use Spiral\Boot\Exception\BootloaderAlreadyBootedException; -use Spiral\Core\Container; +use Spiral\Core\Attribute\Singleton; /** * @internal * @psalm-import-type TClass from BootloadManagerInterface */ -final class ClassesRegistry implements Container\SingletonInterface +#[Singleton] +final class ClassesRegistry { /** @var TClass[] */ private array $classes = []; diff --git a/src/BootloadManager/Initializer.php b/src/BootloadManager/Initializer.php index 54ea55d..791e8d1 100644 --- a/src/BootloadManager/Initializer.php +++ b/src/BootloadManager/Initializer.php @@ -15,8 +15,8 @@ use Spiral\Boot\BootloadManager\Checker\ClassExistsChecker; use Spiral\Boot\BootloadManager\Checker\ConfigChecker; use Spiral\Boot\BootloadManagerInterface; +use Spiral\Core\Attribute\Singleton; use Spiral\Core\BinderInterface; -use Spiral\Core\Container; use Spiral\Core\ResolverInterface; /** @@ -24,7 +24,8 @@ * @psalm-import-type TClass from BootloadManagerInterface * @psalm-import-type TFullBinding from BootloaderInterface */ -class Initializer implements InitializerInterface, Container\SingletonInterface +#[Singleton] +class Initializer implements InitializerInterface { protected ?BootloaderCheckerInterface $checker = null;