$namespace =
substr($namespace, 0,
$i);
if ($this->container->
hasDefinition($namespace) &&
$tag =
$this->container->
getDefinition($namespace)->
getTag('container.excluded'
)) { return sprintf('Cannot autowire service "%s": %s needs an instance of "%s" but this type has been excluded %s.',
$currentId,
$label,
$type,
$tag[0
]['source'
] ?? 'from autowiring'
);
} } while (false !==
$i =
strrpos($namespace, '\\'
));
if (!
$r =
$this->container->
getReflectionClass($type, false
)) { // either $type does not exist or a parent class does not exist
try { if (class_exists(ClassExistenceResource::
class)) { $resource =
new ClassExistenceResource($type, false
);
// isFresh() will explode ONLY if a parent class/trait does not exist
$resource->
isFresh(0
);
$parentMsg = false;
} else { $parentMsg = "couldn't be loaded. Either it was not found or it is missing a parent class or a trait";
} } catch (\ReflectionException
$e) { $parentMsg =
sprintf('is missing a parent class (%s)',
$e->
getMessage());
} $message =
sprintf('has type "%s" but this class %s.',
$type,
$parentMsg ?: 'was not found'
);
}