src/Fixer/ConstantNotation/NativeConstantInvocationFixer.php
protected function createConfigurationDefinition()
    {
        $constantChecker = static function ($value) {
            foreach ($value as $constantName) {
                if (!\is_string($constantName) || '' === trim($constantName) || trim($constantName) !== $constantName) {
                    throw new InvalidOptionsException(sprintf(
                        'Each element must be a non-empty, trimmed string, got "%s" instead.',
                        \is_object($constantName) ? \get_class($constantName) : \gettype($constantName)
                    ));
                }
            }

            return true;
        };

        return new FixerConfigurationResolver([
            (new FixerOptionBuilder('fix_built_in', 'Whether to fix constants returned by `get_defined_constants`. User constants are not accounted in this list and must be specified in the include one.'))
                ->setAllowedTypes(['bool'])
                ->setDefault(true)
                ->getOption(),
            (new FixerOptionBuilder('include', 'List of additional constants to fix.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([$constantChecker])
                ->setDefault([])
                ->getOption(),
            (new FixerOptionBuilder('exclude', 'List of constants to ignore.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([$constantChecker])
                ->setDefault(['null', 'false', 'true'])
                ->getOption(),
            (new FixerOptionBuilder('scope', 'Only fix constant invocations that are made within a namespace or fix all.'))
                ->setAllowedValues(['all', 'namespaced'])
                ->setDefault('all')
                ->getOption(),
        ]);
    }
protected function createConfigurationDefinition()
    {
        $constantChecker = static function ($value) {
            foreach ($value as $constantName) {
                if (!\is_string($constantName) || '' === trim($constantName) || trim($constantName) !== $constantName) {
                    throw new InvalidOptionsException(sprintf(
                        'Each element must be a non-empty, trimmed string, got "%s" instead.',
                        \is_object($constantName) ? \get_class($constantName) : \gettype($constantName)
                    ));
                }
            }

            return true;
        };

        return new FixerConfigurationResolver([
            (new FixerOptionBuilder('fix_built_in', 'Whether to fix constants returned by `get_defined_constants`. User constants are not accounted in this list and must be specified in the include one.'))
                ->setAllowedTypes(['bool'])
                ->setDefault(true)
                ->getOption(),
            (new FixerOptionBuilder('include', 'List of additional constants to fix.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([$constantChecker])
                ->setDefault([])
                ->getOption(),
            (new FixerOptionBuilder('exclude', 'List of constants to ignore.'))
                ->setAllowedTypes(['array'])
                ->setAllowedValues([$constantChecker])
                ->setDefault(['null', 'false', 'true'])
                ->getOption(),
            (new FixerOptionBuilder('scope', 'Only fix constant invocations that are made within a namespace or fix all.'))
                ->setAllowedValues(['all', 'namespaced'])
                ->setDefault('all')
                ->getOption(),
        ]);
    }
protected function createConfigurationDefinition ( ) { $ constantChecker = static function ( $ value ) { foreach ( $ value as $ constantName ) { if ( ! \ is_string ( $ constantName ) || '' === trim ( $ constantName ) || trim ( $ constantName ) !== $ constantName ) { throw new InvalidOptionsException ( sprintf ( 'Each element must be a non-empty, trimmed string, got "%s" instead.' , \ is_object ( $ constantName ) ? \ get_class ( $ constantName ) : \ gettype ( $ constantName ) ) ) ; } } return true ; } ; return new FixerConfigurationResolver ( [ ( new FixerOptionBuilder ( 'fix_built_in' , 'Whether to fix constants returned by `get_defined_constants`. User constants are not accounted in this list and must be specified in the include one.' ) ) -> setAllowedTypes ( [ 'bool' ] ) -> setDefault ( true ) -> getOption ( ) , ( new FixerOptionBuilder ( 'include' , 'List of additional constants to fix.' ) ) -> setAllowedTypes ( [ 'array' ] ) -> setAllowedValues ( [ $ constantChecker ] ) -> setDefault ( [ ] ) -> getOption ( ) , ( new FixerOptionBuilder ( 'exclude' , 'List of constants to ignore.' ) ) -> setAllowedTypes ( [ 'array' ] ) -> setAllowedValues ( [ $ constantChecker ] ) -> setDefault ( [ 'null' , 'false' , 'true' ] ) -> getOption ( ) , ( new FixerOptionBuilder ( 'scope' , 'Only fix constant invocations that are made within a namespace or fix all.' ) ) -> setAllowedValues ( [ 'all' , 'namespaced' ] ) -> setDefault ( 'all' ) -> getOption ( ) , ] ) ; }
{@inheritdoc}
{