microsoft / microsoft/tolerant-php-parser

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

Open
#205 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
894
Forks
85
Avg merge
2d 13h
Merged PRs (30d)
3

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the example in src/MethodClassReflectionExtension.php at line 19 and reproduce the error using the linked test project after composer install. Trace how the parser handles a use Object; statement and find the relevant parser or error tests. Done means the statement parses without the unexpected semicolon error and has regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.