当前位置: 首页>>代码示例>>PHP>>正文


PHP Tokens::isTokenKindFound方法代码示例

本文整理汇总了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));
 }
开发者ID:skillberto,项目名称:PHP-CS-Fixer,代码行数:12,代码来源:ElseifFixer.php

示例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));
     }
 }
开发者ID:rybakit,项目名称:PHP-CS-Fixer,代码行数:12,代码来源:AbstractFixerTestBase.php

示例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));
     }
 }
开发者ID:nazimodi,项目名称:PHP-CS-Fixer,代码行数:15,代码来源:AbstractFixerTestBase.php

示例4: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_DOC_COMMENT);
 }
开发者ID:vuthao,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:AbstractPhpdocTypesFixer.php

示例5: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_STRING);
 }
开发者ID:nazimodi,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:StrictParamFixer.php

示例6: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_DOUBLE_ARROW);
 }
开发者ID:skillberto,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:AlignDoubleArrowFixer.php

示例7: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_FUNCTION);
 }
开发者ID:cjq,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:MethodArgumentDefaultValueFixer.php

示例8: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_WHITESPACE);
 }
开发者ID:vuthao,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:ExtraEmptyLinesFixer.php

示例9: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_CLOSE_TAG);
 }
开发者ID:vuthao,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:PhpClosingTagFixer.php

示例10: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_CONSTANT_ENCAPSED_STRING);
 }
开发者ID:ntamvl,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:SingleQuoteFixer.php

示例11: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_OPEN_TAG_WITH_ECHO);
 }
开发者ID:rafwlaz,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:ShortEchoTagFixer.php

示例12: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_START_HEREDOC);
 }
开发者ID:athaller,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:HeredocToNowdocFixer.php

示例13: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_OBJECT_OPERATOR);
 }
开发者ID:skillberto,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:ObjectOperatorFixer.php

示例14: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(T_IS_NOT_EQUAL);
 }
开发者ID:rafwlaz,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:StandardizeNotEqualFixer.php

示例15: isCandidate

 /**
  * {@inheritdoc}
  */
 public function isCandidate(Tokens $tokens)
 {
     return $tokens->isTokenKindFound(CT_ARRAY_SQUARE_BRACE_OPEN);
 }
开发者ID:vuthao,项目名称:PHP-CS-Fixer,代码行数:7,代码来源:LongArraySyntaxFixer.php


注:本文中的Symfony\CS\Tokenizer\Tokens::isTokenKindFound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。