public static function getClassesToRead(\ReflectionObject $reflectionObject)
    {
        $cacheId = md5("classesToRead:" . $reflectionObject->getName());
        $objectClasses = self::getFromCache($cacheId);
        if ($objectClasses !== null) {
            return $objectClasses;
        }

        $objectClasses = array($reflectionObject);
        $objectTraits = $reflectionObject->getTraits();
        if (!empty($objectTraits)) {
            foreach ($objectTraits as $trait) {
                $objectClasses[] = $trait;
            }
        }

        $parentClass = $reflectionObject->getParentClass();
        while ($parentClass) {
            $objectClasses[] = $parentClass;

            $parentTraits = $parentClass->getTraits();
            if (!empty($parentTraits)) {
                foreach ($parentTraits as $trait) {
                    $objectClasses[] = $trait;
                }
            }

            $parentClass = $parentClass->getParentClass();
        }

        self::saveToCache($cacheId, $objectClasses);

        return $objectClasses;
    }