src/Fixer/Alias/RandomApiMigrationFixer.php
protected function createConfigurationDefinition()
    {
        return new FixerConfigurationResolverRootless('replacements', [
            (new FixerOptionBuilder('replacements', 'Mapping between replaced functions with the new ones.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([static function ($value) {
                    foreach ($value as $functionName => $replacement) {
                        if (!\array_key_exists($functionName, self::$argumentCounts)) {
                            throw new InvalidOptionsException(sprintf(
                                'Function "%s" is not handled by the fixer.',
                                $functionName
                            ));
                        }

                        if (!\is_string($replacement)) {
                            throw new InvalidOptionsException(sprintf(
                                'Replacement for function "%s" must be a string, "%s" given.',
                                $functionName,
                                \is_object($replacement) ? \get_class($replacement) : \gettype($replacement)
                            ));
                        }
                    }

                    return true;
                }])
                ->setDefault([
                    'getrandmax' => 'mt_getrandmax',
                    'rand' => 'mt_rand',
                    'srand' => 'mt_srand',
                ])
                ->getOption(),
        ], $this->getName());
    }
protected function createConfigurationDefinition()
    {
        return new FixerConfigurationResolverRootless('replacements', [
            (new FixerOptionBuilder('replacements', 'Mapping between replaced functions with the new ones.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([static function ($value) {
                    foreach ($value as $functionName => $replacement) {
                        if (!\array_key_exists($functionName, self::$argumentCounts)) {
                            throw new InvalidOptionsException(sprintf(
                                'Function "%s" is not handled by the fixer.',
                                $functionName
                            ));
                        }

                        if (!\is_string($replacement)) {
                            throw new InvalidOptionsException(sprintf(
                                'Replacement for function "%s" must be a string, "%s" given.',
                                $functionName,
                                \is_object($replacement) ? \get_class($replacement) : \gettype($replacement)
                            ));
                        }
                    }

                    return true;
                }])
                ->setDefault([
                    'getrandmax' => 'mt_getrandmax',
                    'rand' => 'mt_rand',
                    'srand' => 'mt_srand',
                ])
                ->getOption(),
        ], $this->getName());
    }
protected function createConfigurationDefinition ( ) { return new FixerConfigurationResolverRootless ( 'replacements' , [ ( new FixerOptionBuilder ( 'replacements' , 'Mapping between replaced functions with the new ones.' ) ) -> setAllowedTypes ( [ 'array' ] ) -> setAllowedValues ( [ static function ( $ value ) { foreach ( $ value as $ functionName => $ replacement ) { if ( ! \ array_key_exists ( $ functionName , self :: $ argumentCounts ) ) { throw new InvalidOptionsException ( sprintf ( 'Function "%s" is not handled by the fixer.' , $ functionName ) ) ; } if ( ! \ is_string ( $ replacement ) ) { throw new InvalidOptionsException ( sprintf ( 'Replacement for function "%s" must be a string, "%s" given.' , $ functionName , \ is_object ( $ replacement ) ? \ get_class ( $ replacement ) : \ gettype ( $ replacement ) ) ) ; } } return true ; } ] ) -> setDefault ( [ 'getrandmax' => 'mt_getrandmax' , 'rand' => 'mt_rand' , 'srand' => 'mt_srand' , ] ) -> getOption ( ) , ] , $ this -> getName ( ) ) ; }
{@inheritdoc}
{