Fix for late static binding
This commit is contained in:
parent
b5ddbab61f
commit
2006073f94
|
@ -43,12 +43,12 @@ trait Getter
|
|||
{
|
||||
$method = '_get' . ucfirst($property);
|
||||
if (
|
||||
property_exists(__CLASS__, $property)
|
||||
&& method_exists(__CLASS__, $method)
|
||||
property_exists(get_called_class(), $property)
|
||||
&& method_exists(get_called_class(), $method)
|
||||
) {
|
||||
return $this->$method();
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Invalid property or missing getter method for property "' . __CLASS__ . '->' . $property . '".');
|
||||
throw new \InvalidArgumentException('Invalid property or missing getter method for property "' . get_called_class() . '->' . $property . '".');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,12 +44,12 @@ trait Setter
|
|||
{
|
||||
$method = '_set' . ucfirst($property);
|
||||
if (
|
||||
property_exists(__CLASS__, $property)
|
||||
&& method_exists(__CLASS__, $method)
|
||||
property_exists(get_called_class(), $property)
|
||||
&& method_exists(get_called_class(), $method)
|
||||
) {
|
||||
$this->$method($value);
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Invalid property or missing setter method for property "' . __CLASS__ . '->' . $property . '".');
|
||||
throw new \InvalidArgumentException('Invalid property or missing setter method for property "' . get_called_class() . '->' . $property . '".');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,11 @@ trait Singleton
|
|||
*/
|
||||
final public static function getInstance(): self
|
||||
{
|
||||
if (!isset(self::$singleton)) {
|
||||
$reflectionClass = new \ReflectionClass(__CLASS__);
|
||||
self::$instance = $reflectionClass->newInstanceArgs(func_get_args());
|
||||
if (!isset(static::$singleton)) {
|
||||
$reflectionClass = new \ReflectionClass(get_called_class());
|
||||
static::$singleton = $reflectionClass->newInstanceArgs(func_get_args());
|
||||
}
|
||||
return self::$singleton;
|
||||
return static::$singleton;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue