microsoft / tolerant-php-parser

An early-stage PHP parser designed for IDE usage scenarios.
MIT License
879 stars 80 forks source link

Expected ";" when you have a "use Object;" statement. #205

Open felixfbecker opened 6 years ago

felixfbecker commented 6 years ago

From @SilbinaryWolf on November 3, 2017 0:42

Silverstripe 3.6 uses the class name "Object" and runs fine in PHP 7.1.

I'm aware Object is a soft keyword and could stop working in future PHP versions, but until then, can this please be fixed.

Example code that gets an error: https://github.com/SilbinaryWolf/silverstripe-phpstan/blob/master/src/MethodClassReflectionExtension.php#L19

Test repo, should be able to just composer install and test with the language server: https://github.com/SilbinaryWolf/silverstripe-phpstan-testproject

Copied from original issue: felixfbecker/php-language-server#516

nesl247 commented 6 years ago

Also to be clear this is not allowed in PHP 7.2 and further according to https://wiki.php.net/rfc/object-typehint.

silbinarywolf commented 6 years ago

If it's still possible and fairly simple to support this kind of statement for PHP 7.1 and lower, that'd be fantastic.