private function removePatternPropertiesFromSubject(array $subject, array $schema): array
    {
        if (isset($schema['patternProperties']) && \is_array($schema['patternProperties'])) {
            $patterns = \array_keys($schema['patternProperties']);
            $propertyNames = \array_keys($subject);

            foreach ($patterns as $pattern) {
                foreach ($propertyNames as $propertyName) {
                    if (\preg_match(sprintf('/%s/', $pattern), $propertyName)) {
                        unset($subject[$propertyName]);
                    }
                }
            }
        }
        return $subject;
    }