Since $instance 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 $instance to at least protected.
Loading history...
33
}
34
35
/**
36
* Instantiate the class.
37
*
38
*/
39
1
private function __construct()
40
{
41
1
$this->setTokensMap();
42
}
43
44
/**
45
* Set the tokens map
46
*
47
* @return void
48
*/
49
1
private function setTokensMap(): void
50
{
51
1
$instances = [];
52
53
1
foreach (Tokens::MAP as $type => $class) {
54
1
$this->tokensMap[$type] = $instances[$class] ??= new $class();