Fixed classIsNotAValidEntity problem

I don't know how it works earlier, but after update symfony and all Doctrine packages I have a headache on my production server: AnnotationDriver throws exception classIsNotAValidEntityOrMappedSuperClass, because in this code
        // Compatibility with Doctrine Common 3.x
        if ($classAnnotations && is_int(key($classAnnotations))) {
            foreach ($classAnnotations as $annot) {
                $classAnnotations[get_class($annot)] = $annot;
            }
        }
key($classAnnotations) returns null, because annotations readed from cache and internal pointer is set to last element! In development all works fine, because annotations is readed from file, not from cache.
I resolve this problem adding code reset($data) to CachedReader, but has many ways for resolve that