本文整理匯總了PHP中Symfony\CS\Tokenizer\Tokens::isTokenKindFound方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tokens::isTokenKindFound方法的具體用法?PHP Tokens::isTokenKindFound怎麽用?PHP Tokens::isTokenKindFound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\CS\Tokenizer\Tokens
的用法示例。
在下文中一共展示了Tokens::isTokenKindFound方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
# handle `T_ELSE T_WHITESPACE T_IF` treated as single `T_ELSEIF` by HHVM
# see https://github.com/facebook/hhvm/issues/4796
if (defined('HHVM_VERSION') && $tokens->isTokenKindFound(T_ELSEIF)) {
return true;
}
return $tokens->isAllTokenKindsFound(array(T_IF, T_ELSE));
}
示例2: assertTokens
private function assertTokens(Tokens $expectedTokens, Tokens $inputTokens)
{
foreach ($expectedTokens as $index => $expectedToken) {
$inputToken = $inputTokens[$index];
$this->assertTrue($expectedToken->equals($inputToken), sprintf('The token at index %d must be %s, got %s', $index, $expectedToken->toJson(), $inputToken->toJson()));
}
$this->assertSame($expectedTokens->count(), $inputTokens->count(), 'The collection must have the same length than the expected one.');
$foundTokenKinds = array_keys(AccessibleObject::create($expectedTokens)->foundTokenKinds);
foreach ($foundTokenKinds as $tokenKind) {
$this->assertTrue($inputTokens->isTokenKindFound($tokenKind), sprintf('The token kind %s must be found in fixed tokens collection.', $tokenKind));
}
}
示例3: assertTokens
private function assertTokens(Tokens $expectedTokens, Tokens $inputTokens)
{
foreach ($expectedTokens as $index => $expectedToken) {
$inputToken = $inputTokens[$index];
$this->assertTrue($expectedToken->equals($inputToken), sprintf('The token at index %d must be %s, got %s', $index, $expectedToken->toJson(), $inputToken->toJson()));
}
$this->assertSame($expectedTokens->count(), $inputTokens->count(), 'The collection must have the same length than the expected one.');
$tokensReflection = new \ReflectionClass($expectedTokens);
$propertyReflection = $tokensReflection->getProperty('foundTokenKinds');
$propertyReflection->setAccessible(true);
$foundTokenKinds = array_keys($propertyReflection->getValue($expectedTokens));
foreach ($foundTokenKinds as $tokenKind) {
$this->assertTrue($inputTokens->isTokenKindFound($tokenKind), sprintf('The token kind %s must be found in fixed tokens collection.', $tokenKind));
}
}
示例4: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_DOC_COMMENT);
}
示例5: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_STRING);
}
示例6: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_DOUBLE_ARROW);
}
示例7: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_FUNCTION);
}
示例8: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_WHITESPACE);
}
示例9: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_CLOSE_TAG);
}
示例10: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_CONSTANT_ENCAPSED_STRING);
}
示例11: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_OPEN_TAG_WITH_ECHO);
}
示例12: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_START_HEREDOC);
}
示例13: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_OBJECT_OPERATOR);
}
示例14: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(T_IS_NOT_EQUAL);
}
示例15: isCandidate
/**
* {@inheritdoc}
*/
public function isCandidate(Tokens $tokens)
{
return $tokens->isTokenKindFound(CT_ARRAY_SQUARE_BRACE_OPEN);
}