mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-17 13:21:17 +02:00
Merge pull request #478 from MathiasReker/0-self-static-accessor
Self static accessor
This commit is contained in:
@@ -15,11 +15,11 @@ final class Singleton
|
||||
*/
|
||||
public static function getInstance(): Singleton
|
||||
{
|
||||
if (static::$instance === null) {
|
||||
static::$instance = new static();
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return static::$instance;
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user