PHP Класс PHP_CodeSniffer_Tokens, PHP_CodeSniffer

The less the chance of a high occurrence of an arbitrary token, the higher the weighting.
Автор: Greg Sherwood ([email protected])
Автор: Marc McIntyre ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$arithmeticTokens array(int) Tokens that represent arithmetic operators.
$assignmentTokens array(int) Tokens that represent assignments.
$blockOpeners array(int) Tokens that open code blocks.
$booleanOperators array(int) Tokens that perform boolean operations.
$bracketTokens array(int) Tokens that represent brackets and parenthesis.
$castTokens array(int) Tokens that represent casting.
$commentTokens array(int) Tokens that are comments.
$comparisonTokens array(int) Tokens that represent comparison operator.
$emptyTokens array(int) Tokens that don't represent code.
$equalityTokens array(int) Tokens that represent equality comparisons.
$functionNameTokens array(int) Mostly, these are just strings. But PHP tokeizes some language constructs and functions using their own tokens.
$heredocTokens array(int) Tokens that make up a heredoc string.
$includeTokens array(int) Tokens that include files.
$knownLengths The token weightings.
$methodPrefixes array(int) Tokens that can prefix a method name
$operators array(int) Tokens that perform operations.
$parenthesisOpeners array(int) Token types that open parenthesis.
$scopeModifiers array(int) Tokens that represent scope modifiers.
$scopeOpeners array(int) Tokens that are allowed to open scopes.
$stringTokens array(int) Note that T_STRINGS are NOT represented in this list.
$weightings The token weightings.

Открытые методы

Метод Описание
getHighestWeightedToken ( array $tokens ) : integer Returns the highest weighted token type.

Приватные методы

Метод Описание
__construct ( ) A PHP_CodeSniffer_Tokens class cannot be constructed.

Описание методов

getHighestWeightedToken() публичный статический Метод

Tokens are weighted by their approximate frequency of appearance in code - the less frequently they appear in the code, the higher the weighting. For example T_CLASS tokens appear very infrequently in a file, and therefore have a high weighting. Returns false if there are no weightings for any of the specified tokens.
public static getHighestWeightedToken ( array $tokens ) : integer
$tokens array
Результат integer The highest weighted token.

Описание свойств

$arithmeticTokens публичное статическое свойство

Tokens that represent arithmetic operators.
public static array(int) $arithmeticTokens
Результат array(int)

$assignmentTokens публичное статическое свойство

Tokens that represent assignments.
public static array(int) $assignmentTokens
Результат array(int)

$blockOpeners публичное статическое свойство

Tokens that open code blocks.
public static array(int) $blockOpeners
Результат array(int)

$booleanOperators публичное статическое свойство

Tokens that perform boolean operations.
public static array(int) $booleanOperators
Результат array(int)

$bracketTokens публичное статическое свойство

Tokens that represent brackets and parenthesis.
public static array(int) $bracketTokens
Результат array(int)

$castTokens публичное статическое свойство

Tokens that represent casting.
public static array(int) $castTokens
Результат array(int)

$commentTokens публичное статическое свойство

Tokens that are comments.
public static array(int) $commentTokens
Результат array(int)

$comparisonTokens публичное статическое свойство

Tokens that represent comparison operator.
public static array(int) $comparisonTokens
Результат array(int)

$emptyTokens публичное статическое свойство

Tokens that don't represent code.
public static array(int) $emptyTokens
Результат array(int)

$equalityTokens публичное статическое свойство

Tokens that represent equality comparisons.
public static array(int) $equalityTokens
Результат array(int)

$functionNameTokens публичное статическое свойство

Mostly, these are just strings. But PHP tokeizes some language constructs and functions using their own tokens.
public static array(int) $functionNameTokens
Результат array(int)

$heredocTokens публичное статическое свойство

Tokens that make up a heredoc string.
public static array(int) $heredocTokens
Результат array(int)

$includeTokens публичное статическое свойство

Tokens that include files.
public static array(int) $includeTokens
Результат array(int)

$knownLengths публичное статическое свойство

The token weightings.
public static $knownLengths

$methodPrefixes публичное статическое свойство

Tokens that can prefix a method name
public static array(int) $methodPrefixes
Результат array(int)

$operators публичное статическое свойство

Tokens that perform operations.
public static array(int) $operators
Результат array(int)

$parenthesisOpeners публичное статическое свойство

Token types that open parenthesis.
public static array(int) $parenthesisOpeners
Результат array(int)

$scopeModifiers публичное статическое свойство

Tokens that represent scope modifiers.
public static array(int) $scopeModifiers
Результат array(int)

$scopeOpeners публичное статическое свойство

Tokens that are allowed to open scopes.
public static array(int) $scopeOpeners
Результат array(int)

$stringTokens публичное статическое свойство

Note that T_STRINGS are NOT represented in this list.
public static array(int) $stringTokens
Результат array(int)

$weightings публичное статическое свойство

The token weightings.
public static $weightings