src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php
protected function createConfigurationDefinition()
    {
        return new FixerConfigurationResolver([
            (new FixerOptionBuilder('exclude', 'List of functions to ignore.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([static function (array $value) {
                    foreach ($value as $functionName) {
                        if (!\is_string($functionName) || '' === trim($functionName) || trim($functionName) !== $functionName) {
                            throw new InvalidOptionsException(sprintf(
                                'Each element must be a non-empty, trimmed string, got "%s" instead.',
                                \is_object($functionName) ? \get_class($functionName) : \gettype($functionName)
                            ));
                        }
                    }

                    return true;
                }])
                ->setDefault([])
                ->getOption(),
            (new FixerOptionBuilder('include', 'List of function names or sets to fix. Defined sets are `@internal` (all native functions), `@all` (all global functions) and `@compiler_optimized` (functions that are specially optimized by Zend).'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([static function (array $value) {
                    foreach ($value as $functionName) {
                        if (!\is_string($functionName) || '' === trim($functionName) || trim($functionName) !== $functionName) {
                            throw new InvalidOptionsException(sprintf(
                                'Each element must be a non-empty, trimmed string, got "%s" instead.',
                                \is_object($functionName) ? \get_class($functionName) : \gettype($functionName)
                            ));
                        }

                        $sets = [
                            self::SET_ALL,
                            self::SET_INTERNAL,
                            self::SET_COMPILER_OPTIMIZED,
                        ];

                        if ('@' === $functionName[0] && !\in_array($functionName, $sets, true)) {
                            throw new InvalidOptionsException(sprintf('Unknown set "%s", known sets are "%s".', $functionName, implode('", "', $sets)));
                        }
                    }

                    return true;
                }])
                ->setDefault([self::SET_INTERNAL])
                ->getOption(),
            (new FixerOptionBuilder('scope', 'Only fix function calls that are made within a namespace or fix all.'))
                ->setAllowedValues(['all', 'namespaced'])
                ->setDefault('all')
                ->getOption(),
            (new FixerOptionBuilder('strict', 'Whether leading `\` of function call not meant to have it should be removed.'))
                ->setAllowedTypes(['bool'])
                ->setDefault(false) // @TODO: 3.0 change to true as default
                ->getOption(),
        ]);
    }
protected function createConfigurationDefinition()
    {
        return new FixerConfigurationResolver([
            (new FixerOptionBuilder('exclude', 'List of functions to ignore.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([static function (array $value) {
                    foreach ($value as $functionName) {
                        if (!\is_string($functionName) || '' === trim($functionName) || trim($functionName) !== $functionName) {
                            throw new InvalidOptionsException(sprintf(
                                'Each element must be a non-empty, trimmed string, got "%s" instead.',
                                \is_object($functionName) ? \get_class($functionName) : \gettype($functionName)
                            ));
                        }
                    }

                    return true;
                }])
                ->setDefault([])
                ->getOption(),
            (new FixerOptionBuilder('include', 'List of function names or sets to fix. Defined sets are `@internal` (all native functions), `@all` (all global functions) and `@compiler_optimized` (functions that are specially optimized by Zend).'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([static function (array $value) {
                    foreach ($value as $functionName) {
                        if (!\is_string($functionName) || '' === trim($functionName) || trim($functionName) !== $functionName) {
                            throw new InvalidOptionsException(sprintf(
                                'Each element must be a non-empty, trimmed string, got "%s" instead.',
                                \is_object($functionName) ? \get_class($functionName) : \gettype($functionName)
                            ));
                        }

                        $sets = [
                            self::SET_ALL,
                            self::SET_INTERNAL,
                            self::SET_COMPILER_OPTIMIZED,
                        ];

                        if ('@' === $functionName[0] && !\in_array($functionName, $sets, true)) {
                            throw new InvalidOptionsException(sprintf('Unknown set "%s", known sets are "%s".', $functionName, implode('", "', $sets)));
                        }
                    }

                    return true;
                }])
                ->setDefault([self::SET_INTERNAL])
                ->getOption(),
            (new FixerOptionBuilder('scope', 'Only fix function calls that are made within a namespace or fix all.'))
                ->setAllowedValues(['all', 'namespaced'])
                ->setDefault('all')
                ->getOption(),
            (new FixerOptionBuilder('strict', 'Whether leading `\` of function call not meant to have it should be removed.'))
                ->setAllowedTypes(['bool'])
                ->setDefault(false) // @TODO: 3.0 change to true as default
                ->getOption(),
        ]);
    }
protected function createConfigurationDefinition ( ) { return new FixerConfigurationResolver ( [ ( new FixerOptionBuilder ( 'exclude' , 'List of functions to ignore.' ) ) -> setAllowedTypes ( [ 'array' ] ) -> setAllowedValues ( [ static function ( array $ value ) { foreach ( $ value as $ functionName ) { if ( ! \ is_string ( $ functionName ) || '' === trim ( $ functionName ) || trim ( $ functionName ) !== $ functionName ) { throw new InvalidOptionsException ( sprintf ( 'Each element must be a non-empty, trimmed string, got "%s" instead.' , \ is_object ( $ functionName ) ? \ get_class ( $ functionName ) : \ gettype ( $ functionName ) ) ) ; } } return true ; } ] ) -> setDefault ( [ ] ) -> getOption ( ) , ( new FixerOptionBuilder ( 'include' , 'List of function names or sets to fix. Defined sets are `@internal` (all native functions), `@all` (all global functions) and `@compiler_optimized` (functions that are specially optimized by Zend).' ) ) -> setAllowedTypes ( [ 'array' ] ) -> setAllowedValues ( [ static function ( array $ value ) { foreach ( $ value as $ functionName ) { if ( ! \ is_string ( $ functionName ) || '' === trim ( $ functionName ) || trim ( $ functionName ) !== $ functionName ) { throw new InvalidOptionsException ( sprintf ( 'Each element must be a non-empty, trimmed string, got "%s" instead.' , \ is_object ( $ functionName ) ? \ get_class ( $ functionName ) : \ gettype ( $ functionName ) ) ) ; } $ sets = [ self :: SET_ALL , self :: SET_INTERNAL , self :: SET_COMPILER_OPTIMIZED , ] ; if ( '@' === $ functionName [ 0 ] && ! \ in_array ( $ functionName , $ sets , true ) ) { throw new InvalidOptionsException ( sprintf ( 'Unknown set "%s", known sets are "%s".' , $ functionName , implode ( '", "' , $ sets ) ) ) ; } } return true ; } ] ) -> setDefault ( [ self :: SET_INTERNAL ] ) -> getOption ( ) , ( new FixerOptionBuilder ( 'scope' , 'Only fix function calls that are made within a namespace or fix all.' ) ) -> setAllowedValues ( [ 'all' , 'namespaced' ] ) -> setDefault ( 'all' ) -> getOption ( ) , ( new FixerOptionBuilder ( 'strict' , 'Whether leading `\` of function call not meant to have it should be removed.' ) ) -> setAllowedTypes ( [ 'bool' ] ) -> setDefault ( false ) // @TODO: 3.0 change to true as default -> getOption ( ) , ] ) ; }
{@inheritdoc}
{