HandlerListManager: make resolveNearestHandleableParent() a little easier to follow

and also sidestep phpstan complaining about using loop vars outside of loop
This commit is contained in:
Dylan K. Taylor 2020-02-07 22:07:36 +00:00
parent fd675449e9
commit 85f3dca11b

View File

@ -71,10 +71,13 @@ class HandlerListManager{
* @phpstan-return \ReflectionClass<Event>|null
*/
private static function resolveNearestHandleableParent(\ReflectionClass $class) : ?\ReflectionClass{
for($parent = $class->getParentClass(); $parent !== false && !self::isValidClass($parent); $parent = $parent->getParentClass()){
for($parent = $class->getParentClass(); $parent !== false; $parent = $parent->getParentClass()){
if(self::isValidClass($parent)){
return $parent;
}
//NOOP
}
return $parent ?: null;
return null;
}
/**