public static function loadPropertyReflection($object, $property, $searchInParents = true)
    {
        $reflection = self::loadClassReflection($object);

        if (!$searchInParents) {
            return $reflection->getProperty($property);
        }

        $exception = null;

        do {
            try {
                $reflectionProperty = $reflection->getProperty($property);

                return $reflectionProperty;
            } catch (\ReflectionException $e) {
                if (!$exception) {
                    $exception = $e;
                }
            }
        } while ($reflection = $reflection->getParentClass());

        throw $exception;
    }
public static function loadPropertyReflection($object, $property, $searchInParents = true)
    {
        $reflection = self::loadClassReflection($object);

        if (!$searchInParents) {
            return $reflection->getProperty($property);
        }

        $exception = null;

        do {
            try {
                $reflectionProperty = $reflection->getProperty($property);

                return $reflectionProperty;
            } catch (\ReflectionException $e) {
                if (!$exception) {
                    $exception = $e;
                }
            }
        } while ($reflection = $reflection->getParentClass());

        throw $exception;
    }
public static function loadPropertyReflection ( $ object , $ property , $ searchInParents = true ) { $ reflection = self :: loadClassReflection ( $ object ) ; if ( ! $ searchInParents ) { return $ reflection -> getProperty ( $ property ) ; } $ exception = null ; do { try { $ reflectionProperty = $ reflection -> getProperty ( $ property ) ; return $ reflectionProperty ; } catch ( \ ReflectionException $ e ) { if ( ! $ exception ) { $ exception = $ e ; } } } while ( $ reflection = $ reflection -> getParentClass ( ) ) ; throw $ exception ; }
Load property reflection

@param object $object
@param string $property
@param bool   $searchInParents

@return \ReflectionProperty

@throws \ReflectionException
Load property reflection