src/ClassHelper.php
public static function getReflectionProperty(ReflectionClass $class, string $propertyName): ReflectionProperty
    {
        try {
            return $class->getProperty($propertyName);
        } catch (ReflectionException $e) {
            $parentClass = $class->getParentClass();
            if ($parentClass === false) {
                throw $e;
            }

            return self::getReflectionProperty($parentClass, $propertyName);
        }
    }
public static function getReflectionProperty(ReflectionClass $class, string $propertyName): ReflectionProperty
    {
        try {
            return $class->getProperty($propertyName);
        } catch (ReflectionException $e) {
            $parentClass = $class->getParentClass();
            if ($parentClass === false) {
                throw $e;
            }

            return self::getReflectionProperty($parentClass, $propertyName);
        }
    }
public static function getReflectionProperty ( ReflectionClass $ class , string $ propertyName ) : ReflectionProperty { try { return $ class -> getProperty ( $ propertyName ) ; } catch ( ReflectionException $ e ) { $ parentClass = $ class -> getParentClass ( ) ; if ( $ parentClass === false ) { throw $ e ; } return self :: getReflectionProperty ( $ parentClass , $ propertyName ) ; } }
Gets the property from the current class, when not available will look on parent classes before failing

@throws ReflectionException

@return ReflectionProperty
Gets the property from the current class when not available will look on parent classes before failing