File tree Expand file tree Collapse file tree 2 files changed +8
-14
lines changed
Expand file tree Collapse file tree 2 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ You can find and compare releases at the [GitHub release page](https://github.co
99
1010## Unreleased
1111
12+ ### Changed
13+
14+ - Optimize ` Lexer ` name tokenization https://github.com/webonyx/graphql-php/pull/1813
15+
1216## v15.27.2
1317
1418### Fixed
Original file line number Diff line number Diff line change @@ -269,21 +269,11 @@ private function unexpectedCharacterMessage(?int $code): string
269269 */
270270 private function readName (int $ line , int $ col , Token $ prev ): Token
271271 {
272- $ value = '' ;
273272 $ start = $ this ->position ;
274- [$ char , $ code ] = $ this ->readChar ();
275-
276- while (
277- $ code !== null && (
278- $ code === 95 // _
279- || ($ code >= 48 && $ code <= 57 ) // 0-9
280- || ($ code >= 65 && $ code <= 90 ) // A-Z
281- || ($ code >= 97 && $ code <= 122 ) // a-z
282- )
283- ) {
284- $ value .= $ char ;
285- [$ char , $ code ] = $ this ->moveStringCursor (1 , 1 )->readChar ();
286- }
273+ $ body = $ this ->source ->body ;
274+ $ length = strspn ($ body , 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ ' , $ this ->byteStreamPosition );
275+ $ value = substr ($ body , $ this ->byteStreamPosition , $ length );
276+ $ this ->moveStringCursor ($ length , $ length );
287277
288278 return new Token (
289279 Token::NAME ,
You can’t perform that action at this time.
0 commit comments