1 year ago
#358377
Lehren
PHP Classname not seen as callable
<?php
class StorageMapper
{
public function __invoke(string $entity, array $storageServices): StorageServiceInterface
{
$globalEntities = [
'Customer::class',
'CustomerSetting::class',
'UserSetting::class',
];
return \in_array($entity, $globalEntities, true) ?
$storageServices['db1'] :
$storageServices['db2'];
}
public function __call($name, $args) {
// Hello
}
public static function __callStatic($name, $arguments)
{
// Note: value of $name is case sensitive.
echo "Calling static method '$name' "
. implode(', ', $arguments). "\n";
}
}
echo(is_callable(StorageMapper::class) ? 'true' : 'false');
It should see this class as callable, since it has __invoke, and even has __callStatic methods. Why doesn't it? How should this be fixed?
php
class
methods
static
callable
0 Answers
Your Answer