isFinal()) { throw InvalidProxiedClassException::finalClassNotSupported($originalClass); } } /** * @throws InvalidProxiedClassException */ private static function hasNoAbstractProtectedMethods(ReflectionClass $originalClass): void { $protectedAbstract = array_filter( $originalClass->getMethods(), static function (ReflectionMethod $method): bool { return $method->isAbstract() && $method->isProtected(); } ); if ($protectedAbstract) { throw InvalidProxiedClassException::abstractProtectedMethodsNotSupported($originalClass); } } /** * @throws InvalidProxiedClassException */ private static function isNotInterface(ReflectionClass $originalClass): void { if ($originalClass->isInterface()) { throw InvalidProxiedClassException::interfaceNotSupported($originalClass); } } }