src/Fixer/ConstantNotation/NativeConstantInvocationFixer.php
public function configure(array $configuration = null)
    {
        parent::configure($configuration);

        $uniqueConfiguredExclude = array_unique($this->configuration['exclude']);

        // Case sensitive constants handling
        $constantsToEscape = array_values($this->configuration['include']);
        if (true === $this->configuration['fix_built_in']) {
            $getDefinedConstants = get_defined_constants(true);
            unset($getDefinedConstants['user']);
            foreach ($getDefinedConstants as $constants) {
                $constantsToEscape = array_merge($constantsToEscape, array_keys($constants));
            }
        }
        $constantsToEscape = array_diff(
            array_unique($constantsToEscape),
            $uniqueConfiguredExclude
        );

        // Case insensitive constants handling
        static $caseInsensitiveConstants = ['null', 'false', 'true'];
        $caseInsensitiveConstantsToEscape = [];
        foreach ($constantsToEscape as $constantIndex => $constant) {
            $loweredConstant = strtolower($constant);
            if (\in_array($loweredConstant, $caseInsensitiveConstants, true)) {
                $caseInsensitiveConstantsToEscape[] = $loweredConstant;
                unset($constantsToEscape[$constantIndex]);
            }
        }

        $caseInsensitiveConstantsToEscape = array_diff(
            array_unique($caseInsensitiveConstantsToEscape),
            array_map(function ($function) { return strtolower($function); }, $uniqueConfiguredExclude)
        );

        // Store the cache
        $this->constantsToEscape = array_fill_keys($constantsToEscape, true);
        ksort($this->constantsToEscape);

        $this->caseInsensitiveConstantsToEscape = array_fill_keys($caseInsensitiveConstantsToEscape, true);
        ksort($this->caseInsensitiveConstantsToEscape);
    }
public function configure(array $configuration = null)
    {
        parent::configure($configuration);

        $uniqueConfiguredExclude = array_unique($this->configuration['exclude']);

        // Case sensitive constants handling
        $constantsToEscape = array_values($this->configuration['include']);
        if (true === $this->configuration['fix_built_in']) {
            $getDefinedConstants = get_defined_constants(true);
            unset($getDefinedConstants['user']);
            foreach ($getDefinedConstants as $constants) {
                $constantsToEscape = array_merge($constantsToEscape, array_keys($constants));
            }
        }
        $constantsToEscape = array_diff(
            array_unique($constantsToEscape),
            $uniqueConfiguredExclude
        );

        // Case insensitive constants handling
        static $caseInsensitiveConstants = ['null', 'false', 'true'];
        $caseInsensitiveConstantsToEscape = [];
        foreach ($constantsToEscape as $constantIndex => $constant) {
            $loweredConstant = strtolower($constant);
            if (\in_array($loweredConstant, $caseInsensitiveConstants, true)) {
                $caseInsensitiveConstantsToEscape[] = $loweredConstant;
                unset($constantsToEscape[$constantIndex]);
            }
        }

        $caseInsensitiveConstantsToEscape = array_diff(
            array_unique($caseInsensitiveConstantsToEscape),
            array_map(function ($function) { return strtolower($function); }, $uniqueConfiguredExclude)
        );

        // Store the cache
        $this->constantsToEscape = array_fill_keys($constantsToEscape, true);
        ksort($this->constantsToEscape);

        $this->caseInsensitiveConstantsToEscape = array_fill_keys($caseInsensitiveConstantsToEscape, true);
        ksort($this->caseInsensitiveConstantsToEscape);
    }
public function configure ( array $ configuration = null ) { parent :: configure ( $ configuration ) ; $ uniqueConfiguredExclude = array_unique ( $ this -> configuration [ 'exclude' ] ) ; // Case sensitive constants handling $ constantsToEscape = array_values ( $ this -> configuration [ 'include' ] ) ; if ( true === $ this -> configuration [ 'fix_built_in' ] ) { $ getDefinedConstants = get_defined_constants ( true ) ; unset ( $ getDefinedConstants [ 'user' ] ) ; foreach ( $ getDefinedConstants as $ constants ) { $ constantsToEscape = array_merge ( $ constantsToEscape , array_keys ( $ constants ) ) ; } } $ constantsToEscape = array_diff ( array_unique ( $ constantsToEscape ) , $ uniqueConfiguredExclude ) ; // Case insensitive constants handling static $ caseInsensitiveConstants = [ 'null' , 'false' , 'true' ] ; $ caseInsensitiveConstantsToEscape = [ ] ; foreach ( $ constantsToEscape as $ constantIndex => $ constant ) { $ loweredConstant = strtolower ( $ constant ) ; if ( \ in_array ( $ loweredConstant , $ caseInsensitiveConstants , true ) ) { $ caseInsensitiveConstantsToEscape [ ] = $ loweredConstant ; unset ( $ constantsToEscape [ $ constantIndex ] ) ; } } $ caseInsensitiveConstantsToEscape = array_diff ( array_unique ( $ caseInsensitiveConstantsToEscape ) , array_map ( function ( $ function ) { return strtolower ( $ function ) ; } , $ uniqueConfiguredExclude ) ) ; // Store the cache $ this -> constantsToEscape = array_fill_keys ( $ constantsToEscape , true ) ; ksort ( $ this -> constantsToEscape ) ; $ this -> caseInsensitiveConstantsToEscape = array_fill_keys ( $ caseInsensitiveConstantsToEscape , true ) ; ksort ( $ this -> caseInsensitiveConstantsToEscape ) ; }
{@inheritdoc}
{