Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost parse errors persist due to incremental analysis #3056

Closed
dktapps opened this issue Mar 4, 2020 · 5 comments
Closed

Ghost parse errors persist due to incremental analysis #3056

dktapps opened this issue Mar 4, 2020 · 5 comments
Labels

Comments

@dktapps
Copy link
Contributor

dktapps commented Mar 4, 2020

Bug report

Code snippet that reproduces the problem

Given the following:

Class1.php

<?php

namespace test;

class Class1{

and Class2.php

<?php

namespace test;

class Class2 extends Class1{

}

produces the below errors (as expected):

------ ----------------------------------------
  Line   Class1.php
 ------ ----------------------------------------
  8      Syntax error, unexpected EOF on line 8
 ------ ----------------------------------------

 ------ ----------------------------------------------------------------------
  Line   Class2.php
 ------ ----------------------------------------------------------------------
         ParseError (syntax error, unexpected end of file, expecting function
         (T_FUNCTION) or const (T_CONST)) thrown while autoloading class
         test\Class2.
  5      ParseError (syntax error, unexpected end of file, expecting function
         (T_FUNCTION) or const (T_CONST)) thrown while autoloading class
         test\Class1.
 ------ ----------------------------------------------------------------------

However, after fixing the parse error in Class1.php, the following errors persist unless the result cache is destroyed manually:

------ ----------------------------------------------------------------------
  Line   Class2.php
 ------ ----------------------------------------------------------------------
         ParseError (syntax error, unexpected end of file, expecting function
         (T_FUNCTION) or const (T_CONST)) thrown while autoloading class
         test\Class2.
  5      ParseError (syntax error, unexpected end of file, expecting function
         (T_FUNCTION) or const (T_CONST)) thrown while autoloading class
         test\Class1.
 ------ ----------------------------------------------------------------------

Not able to reproduce on phpstan.org due to unable to provide multiple files.

Expected output

After fixing the parse error, no errors should be reported.

@mergeable
Copy link

mergeable bot commented Mar 4, 2020

This bug report is missing a link to reproduction on phpstan.org.
It will most likely be closed after manual review.

@ondrejmirtes
Copy link
Member

Yeah, this one is hard to crack, but I'll think about it, thanks.

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@762277e

@dktapps
Copy link
Contributor Author

dktapps commented Mar 16, 2020

great, thanks!

@lock
Copy link

lock bot commented Apr 17, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
BTW: Did you know that PHPStan now has a brand new website with a user guide, guide to writing analyser-friendly PHP code, and a guide to developing PHPStan extensions? Visit phpstan.org today!

@lock lock bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants