Чётче синглтон.

This commit is contained in:
Ivor Barhansky 2023-07-11 02:23:49 +03:00
parent d2cf95ef55
commit 49a7f3a273

View File

@ -9,7 +9,7 @@ use User\ItemsModel;
class User
{
private static self $flag_one;
private static ?self $flag_one = null;
public int $pokol = 2; //Акктуальное поколение предметов
public array $aves = ['now' => 0, 'max' => 0];
public array $room = [];
@ -804,9 +804,9 @@ class User
/** Singletone.
* @return User
*/
public static function start(): User
public static function start(): self
{
if (!isset(self::$flag_one)) {
if (is_null(self::$flag_one)) {
self::$flag_one = new self();
}
return self::$flag_one;