tokens[ $stackPtr ]['code']; $typecast = str_replace( ' ', '', $this->tokens[ $stackPtr ]['content'] ); $typecast_lc = strtolower( $typecast ); switch ( $token_code ) { case \T_DOUBLE_CAST: if ( '(float)' !== $typecast_lc ) { $fix = $this->phpcsFile->addFixableError( 'Normalized type keywords must be used; expected "(float)" but found "%s"', $stackPtr, 'DoubleRealFound', array( $typecast ) ); if ( true === $fix ) { $this->phpcsFile->fixer->replaceToken( $stackPtr, '(float)' ); } } break; case \T_UNSET_CAST: $this->phpcsFile->addWarning( 'Using the "(unset)" cast is strongly discouraged. Use the "unset()" language construct or assign "null" as the value to the variable instead.', $stackPtr, 'UnsetFound' ); break; case \T_STRING_CAST: case \T_BINARY_CAST: if ( \T_STRING_CAST === $token_code && '(binary)' !== $typecast_lc ) { break; } $this->phpcsFile->addWarning( 'Using binary casting is strongly discouraged. Found: "%s"', $stackPtr, 'BinaryFound', array( $typecast ) ); break; } } }