BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
PHP_CodeSniffer\Fixer Class Reference

Public Member Functions

 startFile (File $phpcsFile)
 
 fixFile ()
 
 generateDiff ($filePath=null, $colors=true)
 
 getFixCount ()
 
 getContents ()
 
 getTokenContent ($stackPtr)
 
 beginChangeset ()
 
 endChangeset ()
 
 rollbackChangeset ()
 
 replaceToken ($stackPtr, $content)
 
 revertToken ($stackPtr)
 
 substrToken ($stackPtr, $start, $length=null)
 
 addNewline ($stackPtr)
 
 addNewlineBefore ($stackPtr)
 
 addContent ($stackPtr, $content)
 
 addContentBefore ($stackPtr, $content)
 

Public Attributes

 $enabled = false
 
 $loops = 0
 

Member Function Documentation

PHP_CodeSniffer\Fixer::addContent (   $stackPtr,
  $content 
)

Adds content to the end of a token's current content.

Parameters
int$stackPtrThe position of the token in the token stack.
string$contentThe content to add.
Returns
bool If the change was accepted.
PHP_CodeSniffer\Fixer::addContentBefore (   $stackPtr,
  $content 
)

Adds content to the start of a token's current content.

Parameters
int$stackPtrThe position of the token in the token stack.
string$contentThe content to add.
Returns
bool If the change was accepted.
PHP_CodeSniffer\Fixer::addNewline (   $stackPtr)

Adds a newline to end of a token's content.

Parameters
int$stackPtrThe position of the token in the token stack.
Returns
bool If the change was accepted.
PHP_CodeSniffer\Fixer::addNewlineBefore (   $stackPtr)

Adds a newline to the start of a token's content.

Parameters
int$stackPtrThe position of the token in the token stack.
Returns
bool If the change was accepted.
PHP_CodeSniffer\Fixer::beginChangeset ( )

Start recording actions for a changeset.

Returns
void
PHP_CodeSniffer\Fixer::endChangeset ( )

Stop recording actions for a changeset, and apply logged changes.

Returns
boolean
PHP_CodeSniffer\Fixer::fixFile ( )

Attempt to fix the file by processing it until no fixes are made.

Returns
boolean
PHP_CodeSniffer\Fixer::generateDiff (   $filePath = null,
  $colors = true 
)

Generates a text diff of the original file and the new content.

Parameters
string$filePathOptional file path to diff the file against. If not specified, the original version of the file will be used.
boolean$colorsPrint colored output or not.
Returns
string
PHP_CodeSniffer\Fixer::getContents ( )

Get the current content of the file, as a string.

Returns
string
PHP_CodeSniffer\Fixer::getFixCount ( )

Get a count of fixes that have been performed on the file.

This value is reset every time a new file is started, or an existing file is restarted.

Returns
int
PHP_CodeSniffer\Fixer::getTokenContent (   $stackPtr)

Get the current fixed content of a token.

This function takes changesets into account so should be used instead of directly accessing the token array.

Parameters
int$stackPtrThe position of the token in the token stack.
Returns
string
PHP_CodeSniffer\Fixer::replaceToken (   $stackPtr,
  $content 
)

Replace the entire contents of a token.

Parameters
int$stackPtrThe position of the token in the token stack.
string$contentThe new content of the token.
Returns
bool If the change was accepted.
PHP_CodeSniffer\Fixer::revertToken (   $stackPtr)

Reverts the previous fix made to a token.

Parameters
int$stackPtrThe position of the token in the token stack.
Returns
bool If a change was reverted.
PHP_CodeSniffer\Fixer::rollbackChangeset ( )

Stop recording actions for a changeset, and discard logged changes.

Returns
void
PHP_CodeSniffer\Fixer::startFile ( File  $phpcsFile)

Starts fixing a new file.

Parameters
\PHP_CodeSniffer\Files\File$phpcsFileThe file being fixed.
Returns
void
PHP_CodeSniffer\Fixer::substrToken (   $stackPtr,
  $start,
  $length = null 
)

Replace the content of a token with a part of its current content.

Parameters
int$stackPtrThe position of the token in the token stack.
int$startThe first character to keep.
int$lengthThe number of chacters to keep. If NULL, the content of the token from $start to the end of the content is kept.
Returns
bool If the change was accepted.

The documentation for this class was generated from the following file: