From 74e18eb4f62e38d5004381bbc8f16d57c15bdbe3 Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Fri, 29 Sep 2023 19:29:16 +0200 Subject: [PATCH] Update Singleton.php --- src/Traits/Singleton.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Traits/Singleton.php b/src/Traits/Singleton.php index 417456b..ee2b7c0 100644 --- a/src/Traits/Singleton.php +++ b/src/Traits/Singleton.php @@ -29,14 +29,14 @@ namespace OCC\Traits; trait Singleton { /** - * Holds the singleton instances. + * Holds the singleton instance. * * @access protected * @static * - * @var array + * @var self */ - protected static $singleton = []; + protected static $singleton; /** * Get a singleton instance of this class. @@ -49,11 +49,11 @@ trait Singleton */ final public static function getInstance(): self { - if (!isset(self::$singleton[__CLASS__])) { + if (!isset(self::$singleton)) { $reflectionClass = new \ReflectionClass(__CLASS__); - self::$instance[__CLASS__] = $reflectionClass->newInstanceArgs(func_get_args()); + self::$instance = $reflectionClass->newInstanceArgs(func_get_args()); } - return self::$singleton[__CLASS__]; + return self::$singleton; } /** @@ -68,9 +68,9 @@ trait Singleton /** * This is a singleton class, thus cloning is prohibited. * - * @access protected + * @access private */ - final protected function __clone() + final private function __clone() { } }