tolerant-php-parser icon indicating copy to clipboard operation
tolerant-php-parser copied to clipboard

match is a valid method name

Open tstarling opened this issue 1 year ago • 0 comments

match can still be used as a method name and as a class constant name in PHP 8.0, but tolerant-php-parser gives an error.

$parser = new Microsoft\PhpParser\Parser;
$ast = $parser->parseSourceFile('<?php class C { function match() {} }');
var_dump(Microsoft\PhpParser\DiagnosticsProvider::getDiagnostics($ast));
array(7) {
  [0]=>
  object(Microsoft\PhpParser\Diagnostic)#480 (4) {
    ["kind"]=>
    int(0)
    ["message"]=>
    string(16) "'Name' expected."
    ["start"]=>
    int(24)
    ["length"]=>
    int(0)
  }
...

tstarling avatar Oct 18 '22 07:10 tstarling