src/Fixer/CastNotation/ShortScalarCastFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        static $castMap = [
            'boolean' => 'bool',
            'integer' => 'int',
            'double' => 'float',
            'real' => 'float',
            'binary' => 'string',
        ];

        for ($index = 0, $count = $tokens->count(); $index < $count; ++$index) {
            if (!$tokens[$index]->isCast()) {
                continue;
            }

            $castFrom = trim(substr($tokens[$index]->getContent(), 1, -1));
            $castFromLowered = strtolower($castFrom);

            if (!\array_key_exists($castFromLowered, $castMap)) {
                continue;
            }

            $tokens[$index] = new Token([
                $tokens[$index]->getId(),
                str_replace($castFrom, $castMap[$castFromLowered], $tokens[$index]->getContent()),
            ]);
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        static $castMap = [
            'boolean' => 'bool',
            'integer' => 'int',
            'double' => 'float',
            'real' => 'float',
            'binary' => 'string',
        ];

        for ($index = 0, $count = $tokens->count(); $index < $count; ++$index) {
            if (!$tokens[$index]->isCast()) {
                continue;
            }

            $castFrom = trim(substr($tokens[$index]->getContent(), 1, -1));
            $castFromLowered = strtolower($castFrom);

            if (!\array_key_exists($castFromLowered, $castMap)) {
                continue;
            }

            $tokens[$index] = new Token([
                $tokens[$index]->getId(),
                str_replace($castFrom, $castMap[$castFromLowered], $tokens[$index]->getContent()),
            ]);
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { static $ castMap = [ 'boolean' => 'bool' , 'integer' => 'int' , 'double' => 'float' , 'real' => 'float' , 'binary' => 'string' , ] ; for ( $ index = 0 , $ count = $ tokens -> count ( ) ; $ index < $ count ; ++ $ index ) { if ( ! $ tokens [ $ index ] -> isCast ( ) ) { continue ; } $ castFrom = trim ( substr ( $ tokens [ $ index ] -> getContent ( ) , 1 , - 1 ) ) ; $ castFromLowered = strtolower ( $ castFrom ) ; if ( ! \ array_key_exists ( $ castFromLowered , $ castMap ) ) { continue ; } $ tokens [ $ index ] = new Token ( [ $ tokens [ $ index ] -> getId ( ) , str_replace ( $ castFrom , $ castMap [ $ castFromLowered ] , $ tokens [ $ index ] -> getContent ( ) ) , ] ) ; } }
{@inheritdoc}
{