<commit_before><?php

namespace Oro\Bundle\FormBundle\Validator;

use Symfony\Component\Validator\Constraint;

class ConstraintFactory
{
    /**
     * Creates a validation constraint.
     *
     * @param string $name    The name of standard constraint or FQCN of a custom constraint
     * @param mixed  $options The constraint options (as associative array)
     *                        or the value for the default option (any other type)
     *
     * @return Constraint
     *
     * @throws \InvalidArgumentException if unknown constraint detected
     */
    public function create($name, $options = null)
    {
        if (strpos($name, '\\') !== false && class_exists($name)) {
            $className = (string)$name;
        } else {
            $className = 'Symfony\\Component\\Validator\\Constraints\\' . $name;
        }

        if (!class_exists($className)) {
            throw new \InvalidArgumentException(
                sprintf('The "%s" class does not exist.', $className)
            );
        }
<commit_msg>BAP-946: Provide compatibility with PHP7 - Fixed issue with array pointer<commit_after><?php

namespace Oro\Bundle\FormBundle\Validator;

use Symfony\Component\Validator\Constraint;

class ConstraintFactory
{
    /**
     * Creates a validation constraint.
     *
     * @param string $name    The name of standard constraint or FQCN of a custom constraint
     * @param mixed  $options The constraint options (as associative array)
     *                        or the value for the default option (any other type)
     *
     * @return Constraint
     *
     * @throws \InvalidArgumentException if unknown constraint detected
     */
    public function create($name, $options = null)
    {
        if (strpos($name, '\\') !== false && class_exists($name)) {
            $className = (string)$name;
        } else {
            $className = 'Symfony\\Component\\Validator\\Constraints\\' . $name;
        }

        if (!class_exists($className)) {
            throw new \InvalidArgumentException(
                sprintf('The "%s" class does not exist.', $className)
            );
        }

        /**
         * Fixed issue with array pointer on php7
         */
        if (is_array($options)) {
            reset($options);
        }

{'fraction_non_alphanumeric': 0.10711150131694469, 'fraction_numerical': 0.0021949078138718174, 'mean_word_length': 2.0922659430122117, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7147780', 'n_tokens_mistral': 586, 'n_tokens_neox': 572, 'n_words': 177}