protected function isClassOrNullInSerializedObjectAfterField($serializedObject, $fieldName, $className)
    {
        $fieldAndClassPattern = '/'. preg_quote($fieldName, '/') . '";((?P<null>N);|O:\d+:"(?P<class>[\w\\\\]+)":)/';
        $matchFound = preg_match($fieldAndClassPattern, $serializedObject, $matches) === 1;

        return $matchFound &&
            (
                (isset($matches['class']) && $matches['class'] === $className) ||
                (isset($matches['null']) && $matches['null'] === 'N')
            );
    }