Issues (1369)

classes/Common/Traits/TSingleton.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Created by Gorlum 03.09.2019 1:26
4
 */
5
6
namespace Common\Traits;
7
8
9
trait TSingleton {
10
11
  private static $_me = null;
12
13
  /**
14
   * @return static|null
15
   */
16
  public static function me() {
17
    if (empty(static::$_me)) {
0 ignored issues
show
Since $_me is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $_me to at least protected.
Loading history...
18
      static::$_me = new static();
19
    }
20
21
    return static::$_me;
22
  }
23
24
}
25