mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
Replace another Scalar\String occurance
Also canonicalize NameResover tests to avoid those pesky CRLF issues.
This commit is contained in:
parent
1a627872f0
commit
7ec277e1e1
@ -747,7 +747,7 @@ ctor_arguments:
|
||||
common_scalar:
|
||||
T_LNUMBER { $$ = Scalar\LNumber[Scalar\LNumber::parse($1)]; }
|
||||
| T_DNUMBER { $$ = Scalar\DNumber[Scalar\DNumber::parse($1)]; }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = Scalar\String[Scalar\String_::parse($1)]; }
|
||||
| T_CONSTANT_ENCAPSED_STRING { $$ = Scalar\String_[Scalar\String_::parse($1)]; }
|
||||
| T_LINE { $$ = Scalar\MagicConst\Line[]; }
|
||||
| T_FILE { $$ = Scalar\MagicConst\File[]; }
|
||||
| T_DIR { $$ = Scalar\MagicConst\Dir[]; }
|
||||
|
@ -2309,7 +2309,7 @@ class Parser extends ParserAbstract
|
||||
}
|
||||
|
||||
protected function reduceRule320($attributes) {
|
||||
$this->semValue = new Node\Scalar\String(Node\Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)]), $attributes);
|
||||
$this->semValue = new Node\Scalar\String_(Node\Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)]), $attributes);
|
||||
}
|
||||
|
||||
protected function reduceRule321($attributes) {
|
||||
|
@ -10,6 +10,10 @@ use PhpParser\Node\Expr;
|
||||
|
||||
class NameResolverTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private function canonicalize($string) {
|
||||
return str_replace("\r\n", "\n", $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PhpParser\NodeVisitor\NameResolver
|
||||
*/
|
||||
@ -133,7 +137,10 @@ EOC;
|
||||
$stmts = $parser->parse($code);
|
||||
$stmts = $traverser->traverse($stmts);
|
||||
|
||||
$this->assertSame($expectedCode, $prettyPrinter->prettyPrint($stmts));
|
||||
$this->assertSame(
|
||||
$this->canonicalize($expectedCode),
|
||||
$prettyPrinter->prettyPrint($stmts)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -220,7 +227,10 @@ EOC;
|
||||
$stmts = $parser->parse($code);
|
||||
$stmts = $traverser->traverse($stmts);
|
||||
|
||||
$this->assertSame($expectedCode, $prettyPrinter->prettyPrint($stmts));
|
||||
$this->assertSame(
|
||||
$this->canonicalize($expectedCode),
|
||||
$prettyPrinter->prettyPrint($stmts)
|
||||
);
|
||||
}
|
||||
|
||||
public function testNoResolveSpecialName() {
|
||||
|
Loading…
Reference in New Issue
Block a user