From 40a46455bdbf01a1a75bf126437d7b71c88a6329 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Thu, 16 Jun 2022 21:10:57 +0200 Subject: [PATCH] Self static accessor Inside a final class or anonymous class self should be preferred to static. --- Creational/Singleton/Singleton.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Creational/Singleton/Singleton.php b/Creational/Singleton/Singleton.php index 6215040..75f60aa 100644 --- a/Creational/Singleton/Singleton.php +++ b/Creational/Singleton/Singleton.php @@ -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; } /**