protected function checkSpacingAfterParamType(PHP_CodeSniffer_File $phpcsFile, $param, $maxType, $spacing = 1)
    {
        // Check number of spaces after the type.
        $spaces = ($maxType - strlen($param['type']) + $spacing);
        if ($param['type_space'] !== $spaces) {
            $error = 'Expected %s spaces after parameter type; %s found';
            $data  = array(
                      $spaces,
                      $param['type_space'],
                     );

            $fix = $phpcsFile->addFixableError($error, $param['tag'], 'SpacingAfterParamType', $data);
            if ($fix === true) {
                $phpcsFile->fixer->beginChangeset();

                $content  = $param['type'];
                $content .= str_repeat(' ', $spaces);
                $content .= $param['var'];
                $content .= str_repeat(' ', $param['var_space']);
                $content .= $param['commentLines'][0]['comment'];
                $phpcsFile->fixer->replaceToken(($param['tag'] + 2), $content);

                // Fix up the indent of additional comment lines.
                foreach ($param['commentLines'] as $lineNum => $line) {
                    if ($lineNum === 0
                        || $param['commentLines'][$lineNum]['indent'] === 0
                    ) {
                        continue;
                    }

                    $diff      = ($param['type_space'] - $spaces);
                    $newIndent = ($param['commentLines'][$lineNum]['indent'] - $diff);
                    $phpcsFile->fixer->replaceToken(
                        ($param['commentLines'][$lineNum]['token'] - 1),
                        str_repeat(' ', $newIndent)
                    );
                }

                $phpcsFile->fixer->endChangeset();
            }//end if
        }//end if

    }
protected function checkSpacingAfterParamType(PHP_CodeSniffer_File $phpcsFile, $param, $maxType, $spacing = 1)
    {
        // Check number of spaces after the type.
        $spaces = ($maxType - strlen($param['type']) + $spacing);
        if ($param['type_space'] !== $spaces) {
            $error = 'Expected %s spaces after parameter type; %s found';
            $data  = array(
                      $spaces,
                      $param['type_space'],
                     );

            $fix = $phpcsFile->addFixableError($error, $param['tag'], 'SpacingAfterParamType', $data);
            if ($fix === true) {
                $phpcsFile->fixer->beginChangeset();

                $content  = $param['type'];
                $content .= str_repeat(' ', $spaces);
                $content .= $param['var'];
                $content .= str_repeat(' ', $param['var_space']);
                $content .= $param['commentLines'][0]['comment'];
                $phpcsFile->fixer->replaceToken(($param['tag'] + 2), $content);

                // Fix up the indent of additional comment lines.
                foreach ($param['commentLines'] as $lineNum => $line) {
                    if ($lineNum === 0
                        || $param['commentLines'][$lineNum]['indent'] === 0
                    ) {
                        continue;
                    }

                    $diff      = ($param['type_space'] - $spaces);
                    $newIndent = ($param['commentLines'][$lineNum]['indent'] - $diff);
                    $phpcsFile->fixer->replaceToken(
                        ($param['commentLines'][$lineNum]['token'] - 1),
                        str_repeat(' ', $newIndent)
                    );
                }

                $phpcsFile->fixer->endChangeset();
            }//end if
        }//end if

    }
protected function checkSpacingAfterParamType ( PHP_CodeSniffer_File $ phpcsFile , $ param , $ maxType , $ spacing = 1 ) { // Check number of spaces after the type. $ spaces = ( $ maxType - strlen ( $ param [ 'type' ] ) + $ spacing ) ; if ( $ param [ 'type_space' ] !== $ spaces ) { $ error = 'Expected %s spaces after parameter type; %s found' ; $ data = array ( $ spaces , $ param [ 'type_space' ] , ) ; $ fix = $ phpcsFile -> addFixableError ( $ error , $ param [ 'tag' ] , 'SpacingAfterParamType' , $ data ) ; if ( $ fix === true ) { $ phpcsFile -> fixer -> beginChangeset ( ) ; $ content = $ param [ 'type' ] ; $ content .= str_repeat ( ' ' , $ spaces ) ; $ content .= $ param [ 'var' ] ; $ content .= str_repeat ( ' ' , $ param [ 'var_space' ] ) ; $ content .= $ param [ 'commentLines' ] [ 0 ] [ 'comment' ] ; $ phpcsFile -> fixer -> replaceToken ( ( $ param [ 'tag' ] + 2 ) , $ content ) ; // Fix up the indent of additional comment lines. foreach ( $ param [ 'commentLines' ] as $ lineNum => $ line ) { if ( $ lineNum === 0 || $ param [ 'commentLines' ] [ $ lineNum ] [ 'indent' ] === 0 ) { continue ; } $ diff = ( $ param [ 'type_space' ] - $ spaces ) ; $ newIndent = ( $ param [ 'commentLines' ] [ $ lineNum ] [ 'indent' ] - $ diff ) ; $ phpcsFile -> fixer -> replaceToken ( ( $ param [ 'commentLines' ] [ $ lineNum ] [ 'token' ] - 1 ) , str_repeat ( ' ' , $ newIndent ) ) ; } $ phpcsFile -> fixer -> endChangeset ( ) ; } //end if } //end if }
Check the spacing after the type of a parameter.

@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param array                $param     The parameter to be checked.
@param int                  $maxType   The maxlength of the longest parameter type.
@param int                  $spacing   The number of spaces to add after the type.

@return void
Check the spacing after the type of a parameter .