private static function checkType($class, $name, $type, $container = NULL)
{
$rc = PhpReflection::getDeclaringClass(new \ReflectionProperty($class, $name));
$fullname = $rc->getName() . '::$' . $name;
if (!$type) {
throw new Nette\InvalidStateException("Property {$fullname} has no @var annotation.");
} elseif (!class_exists($type) && !interface_exists($type)) {
throw new Nette\InvalidStateException("Class or interface '{$type}' used in @var annotation at {$fullname} not found. Check annotation and 'use' statements.");
} elseif ($container && !$container->getByType($type, FALSE)) {
throw new Nette\InvalidStateException("Service of type {$type} used in @var annotation at {$fullname} not found. Did you register it in configuration file?");
}
}