/** * @dataProvider provideTestLexNewFeatures */ public function testLeaveStuffAloneInStrings($code) { $stringifiedToken = '"' . addcslashes($code, '"\\') . '"'; $this->lexer->startLexing('<?php ' . $stringifiedToken); $this->assertEquals(PHPParser_Parser::T_CONSTANT_ENCAPSED_STRING, $this->lexer->getNextToken($text)); $this->assertEquals($stringifiedToken, $text); $this->assertEquals(0, $this->lexer->getNextToken()); }
public function getNextToken(&$value = NULL, &$startAttributes = NULL, &$endAttributes = NULL) { $tokenId = parent::getNextToken($value, $startAttributes, $endAttributes); if ($tokenId == \PHPParser_Parser::T_CONSTANT_ENCAPSED_STRING || $tokenId == \PHPParser_Parser::T_LNUMBER || $tokenId == \PHPParser_Parser::T_DNUMBER) { $endAttributes['originalValue'] = $value; } return $tokenId; }