src/Viserio/Component/OptionsResolver/Traits/OptionsResolverTrait.php
private static function checkDeprecatedOptions(string $configClass, array $deprecatedOptions, $config): void
    {
        foreach ($deprecatedOptions as $key => $deprecationMessage) {
            if (\is_array($deprecationMessage)) {
                self::checkDeprecatedOptions($configClass, $deprecationMessage, $config[$key]);

                continue;
            }

            if (\is_int($key)) {
                $key                = $deprecationMessage;
                $deprecationMessage = 'The option [%s] is deprecated.';
            }

            if (! \array_key_exists($key, (array) $config)) {
                throw new InvalidArgumentException(\sprintf(
                    'Option [%s] cant be deprecated, because it does not exist, in [%s].',
                    $key,
                    $configClass
                ));
            }

            if (! \is_string($deprecationMessage)) {
                throw new InvalidArgumentException(\sprintf(
                    'Invalid deprecation message value provided for [%s]; Expected [string], but got [%s], in [%s].',
                    $key,
                    (\is_object($deprecationMessage) ? \get_class($deprecationMessage) : \gettype($deprecationMessage)),
                    $configClass
                ));
            }

            if (empty($deprecationMessage)) {
                throw new InvalidArgumentException(\sprintf(
                    'Deprecation message cant be empty, for option [%s], in [%s].',
                    $key,
                    $configClass
                ));
            }

            @\trigger_error(\sprintf($deprecationMessage, $key), \E_USER_DEPRECATED);
        }
    }
private static function checkDeprecatedOptions(string $configClass, array $deprecatedOptions, $config): void
    {
        foreach ($deprecatedOptions as $key => $deprecationMessage) {
            if (\is_array($deprecationMessage)) {
                self::checkDeprecatedOptions($configClass, $deprecationMessage, $config[$key]);

                continue;
            }

            if (\is_int($key)) {
                $key                = $deprecationMessage;
                $deprecationMessage = 'The option [%s] is deprecated.';
            }

            if (! \array_key_exists($key, (array) $config)) {
                throw new InvalidArgumentException(\sprintf(
                    'Option [%s] cant be deprecated, because it does not exist, in [%s].',
                    $key,
                    $configClass
                ));
            }

            if (! \is_string($deprecationMessage)) {
                throw new InvalidArgumentException(\sprintf(
                    'Invalid deprecation message value provided for [%s]; Expected [string], but got [%s], in [%s].',
                    $key,
                    (\is_object($deprecationMessage) ? \get_class($deprecationMessage) : \gettype($deprecationMessage)),
                    $configClass
                ));
            }

            if (empty($deprecationMessage)) {
                throw new InvalidArgumentException(\sprintf(
                    'Deprecation message cant be empty, for option [%s], in [%s].',
                    $key,
                    $configClass
                ));
            }

            @\trigger_error(\sprintf($deprecationMessage, $key), \E_USER_DEPRECATED);
        }
    }
Checks if a deprecation exists and triggers a deprecation error.

@param string             $configClass
@param array              $deprecatedOptions
@param array|\ArrayAccess $config

@throws \Viserio\Component\Contract\OptionsResolver\Exception\InvalidArgumentException If deprecation message cant be found or
the key don't exists in the config array

@return void