Make singleton constructor private

This commit is contained in:
Sebastian Meyer 2023-09-29 21:50:16 +02:00
parent 0a449fbb4c
commit 424faf83a0
1 changed files with 5 additions and 5 deletions

View File

@ -31,12 +31,12 @@ trait Singleton
/** /**
* Holds the singleton instance. * Holds the singleton instance.
* *
* @access protected * @access private
* @static * @static
* *
* @var self * @var self
*/ */
protected static $singleton; private static ?self $singleton;
/** /**
* Get a singleton instance of this class. * Get a singleton instance of this class.
@ -57,13 +57,13 @@ trait Singleton
} }
/** /**
* This is a singleton class, thus the constructor is protected. * This is a singleton class, thus the constructor is private.
* (Get an instance of this class by calling self::getInstance()) * (Get an instance of this class by calling self::getInstance())
* *
* @access protected * @access private
* @abstract * @abstract
*/ */
abstract protected function __construct(); abstract private function __construct();
/** /**
* This is a singleton class, thus cloning is prohibited. * This is a singleton class, thus cloning is prohibited.