protected function checkSpecificObject(array $acceptedTypes, $value)
    {
        if (is_object($value)) {
            foreach ($acceptedTypes as $type) {
                $c = get_class($value);
                if ($c == ltrim($type, '\\') || is_subclass_of($c, $type)) {
                    return $value;
                }
            }
        }

        return null;
    }