public function getClassnameForToken(Token $token) { $type = $token->getType(); $value = $token->getValue(); $classname = null; switch ($type) { case T_STRING: // case of operators if (isset(self::$OPERATOR_MAP[$value])) { $classname = self::$OPERATOR_MAP[$value]; } break; default: $classname = token_name($type); break; } // camelcase $classname = strtolower($classname); $classname = preg_replace_callback('/_(.?)/', function ($matches) { return strtoupper($matches[1]); }, $classname); $classname = preg_replace('!(^t)!', '', $classname); if (null !== $classname) { $classname = '\\Hal\\MutaTesting\\Mutater\\Mutater' . $classname; } return $classname; }
/** * @dataProvider providesTokens */ public function testICanWorkWithDifferentKindOfTokens($data) { $token = new Token($data); $this->assertNotNull($token->getType()); }