mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-30 04:29:15 +01:00
Allow both '{' and T_CURLY_OPEN as curly bracket (#732)
This commit is contained in:
parent
bc7a9bf9c2
commit
c64986fa55
@ -46,7 +46,8 @@ class TokenStream
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function haveBraces(int $startPos, int $endPos) : bool {
|
public function haveBraces(int $startPos, int $endPos) : bool {
|
||||||
return $this->haveTokenImmediatelyBefore($startPos, '{')
|
return ($this->haveTokenImmediatelyBefore($startPos, '{')
|
||||||
|
|| $this->haveTokenImmediatelyBefore($startPos, T_CURLY_OPEN))
|
||||||
&& $this->haveTokenImmediatelyAfter($endPos, '}');
|
&& $this->haveTokenImmediatelyAfter($endPos, '}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +202,7 @@ class TokenStream
|
|||||||
|
|
||||||
public function haveBracesInRange(int $startPos, int $endPos) {
|
public function haveBracesInRange(int $startPos, int $endPos) {
|
||||||
return $this->haveTokenInRange($startPos, $endPos, '{')
|
return $this->haveTokenInRange($startPos, $endPos, '{')
|
||||||
|
|| $this->haveTokenInRange($startPos, $endPos, T_CURLY_OPEN)
|
||||||
|| $this->haveTokenInRange($startPos, $endPos, '}');
|
|| $this->haveTokenInRange($startPos, $endPos, '}');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
Rewrite string with variable interpolation
|
||||||
|
-----
|
||||||
|
<?php
|
||||||
|
"{$e}";
|
||||||
|
-----
|
||||||
|
$stmts[0]->expr->parts[0]->setAttribute('origNode', null);
|
||||||
|
-----
|
||||||
|
<?php
|
||||||
|
"{$e}";
|
Loading…
Reference in New Issue
Block a user