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

PHPStan Internal error #650

Closed
DavyDeCoster opened this issue Sep 3, 2020 · 10 comments
Closed

PHPStan Internal error #650

DavyDeCoster opened this issue Sep 3, 2020 · 10 comments

Comments

@DavyDeCoster
Copy link

DavyDeCoster commented Sep 3, 2020

  • Larastan Version: 0.6.4
  • --level used: 5

Description

When I run PHPStan, I get the following exception (flag -vvv used):

In StubPhpDocProvider.php line 150:
                                      
  [PHPStan\ShouldNotHappenException]  
  Internal error.                     

This config-file is used:

includes:
    - ./vendor/nunomaduro/larastan/extension.neon

parameters:
    paths:
        - app

    # The level 8 is the highest level
    level: 5                

Recently got this on 2 different codebases.

@canvural
Copy link
Collaborator

canvural commented Sep 3, 2020

Hi,

Maybe you can try running it with --debug to get more information.

That error looks like there is some issue within the stubs. But Larastan's stubs are ok. No errors in CI or in any of my personal projects. Do you have some stubs of your own?

@Jonatanmdez
Copy link

We had the same issue with our projects. Is not only @DavyDeCoster

And we don't have any stub, laravel 7 by default. In fact, is a new project with days of life

@szepeviktor
Copy link
Collaborator

@DavyDeCoster
Copy link
Author

  PHPStan\ShouldNotHappenException 

  Internal error.

  at phar://vendor/phpstan/phpstan/phpstan/src/PhpDoc/StubPhpDocProvider.php:150
    146|     }
    147|     private function initializeKnownElements() : void
    148|     {
    149|         if ($this->initializing) {
  > 150|             throw new \PHPStan\ShouldNotHappenException();
    151|         }
    152|         if ($this->initialized) {
    153|             return;
    154|         }

I think this may be a problem with PHPStan itself.

@canvural
Copy link
Collaborator

canvural commented Sep 4, 2020

I created new Laravel 7 project, installed Larastan. Scanned app directory. No errors. So I'm not sure what is the issue here.

Which Laravel version are you using? Also did --debug give you more information?

@DavyDeCoster
Copy link
Author

@canvural Laravel 7.27.0 is used in my current project. My previous comment was the output of the debug-flag.

@canvural
Copy link
Collaborator

canvural commented Sep 4, 2020

Can you try to analyze just one file? If it doesn't happen, can you try to find a file in which this error happens?

@DavyDeCoster
Copy link
Author

@canvural Something strange is happening. I've updated my dependencies through composer and now it's working again. For me updating zircote/swagger-php from 3.0.5 to 3.1.0 fixed the problem.

@canvural
Copy link
Collaborator

canvural commented Sep 4, 2020

Ah yes. I saw issues related to that in PHPStan repo. zircote/swagger-php#834 and zircote/swagger-php#841

If @Jonatanmdez can also confirm this is the issue, we can close this I think.

@canvural
Copy link
Collaborator

canvural commented Sep 8, 2020

Closing this one as it seems it's fixed. Please open a new issue if it continues.

@canvural canvural closed this as completed Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants