mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-09 23:45:05 +02:00
Self static accessor
Inside a final class or anonymous class self should be preferred to static.
This commit is contained in:
parent
7b24e1185a
commit
40a46455bd
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user