function CodeUnit::ensureUserDefinedClass
@psalm-param class-string $className
Throws
2 calls to CodeUnit::ensureUserDefinedClass()
- CodeUnit::forClass in vendor/
sebastian/ code-unit/ src/ CodeUnit.php - @psalm-param class-string $className
- CodeUnit::forClassMethod in vendor/
sebastian/ code-unit/ src/ CodeUnit.php - @psalm-param class-string $className
File
-
vendor/
sebastian/ code-unit/ src/ CodeUnit.php, line 301
Class
- CodeUnit
- @psalm-immutable
Namespace
SebastianBergmann\CodeUnitCode
private static function ensureUserDefinedClass(string $className) : void {
try {
$reflector = new ReflectionClass($className);
if ($reflector->isInterface()) {
throw new InvalidCodeUnitException(sprintf('"%s" is an interface and not a class', $className));
}
if ($reflector->isTrait()) {
throw new InvalidCodeUnitException(sprintf('"%s" is a trait and not a class', $className));
}
if (!$reflector->isUserDefined()) {
throw new InvalidCodeUnitException(sprintf('"%s" is not a user-defined class', $className));
}
// @codeCoverageIgnoreStart
} catch (\ReflectionException $e) {
throw new ReflectionException($e->getMessage(), $e->getCode(), $e);
}
// @codeCoverageIgnoreEnd
}