Skip to content

Commit 03de0ae

Browse files
committed
Fix #202 - suppress warnings from token_get_all -
It can produce lots of unnecessary warnings when parsing invalid php syntax
1 parent 69ea4ed commit 03de0ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PhpTokenizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Microsoft\PhpParser;
88

99
/**
10-
* Tokenizes content using PHP's built-in `tokens_get_all`, and converts to "lightweight" Token representation.
10+
* Tokenizes content using PHP's built-in `token_get_all`, and converts to "lightweight" Token representation.
1111
*
1212
* Initially we tried hand-spinning the lexer (see `experiments/Lexer.php`), but we had difficulties optimizing
1313
* performance (especially when working with Unicode characters.)
@@ -58,7 +58,7 @@ public static function getTokensArrayFromContent(
5858
$passedPrefix = false;
5959
}
6060

61-
$tokens = \token_get_all($content);
61+
$tokens = @\token_get_all($content);
6262

6363
$arr = array();
6464
$fullStart = $start = $pos = $initialPos;

0 commit comments

Comments
 (0)