/** * @param ReflectionClass $originalClass * * @return void * * @throws InvalidProxiedClassException */ private static function hasNoAbstractProtectedMethods(ReflectionClass $originalClass) { $protectedAbstract = array_filter($originalClass->getMethods(), function (ReflectionMethod $method) : bool { return $method->isAbstract() && $method->isProtected(); }); if ($protectedAbstract) { throw InvalidProxiedClassException::abstractProtectedMethodsNotSupported($originalClass); } }
public function testAbstractProtectedMethodsNotSupported() { $this->assertSame('Provided class "ProxyManagerTestAsset\\ClassWithAbstractProtectedMethod" has following protected abstract' . ' methods, and therefore cannot be proxied:' . "\n" . 'ProxyManagerTestAsset\\ClassWithAbstractProtectedMethod::protectedAbstractMethod', InvalidProxiedClassException::abstractProtectedMethodsNotSupported(new ReflectionClass('ProxyManagerTestAsset\\ClassWithAbstractProtectedMethod'))->getMessage()); }