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

Random ClassNotFoundError PhpStanExtractor.php line 67 #163

Open
fliespl opened this issue Nov 14, 2022 · 5 comments
Open

Random ClassNotFoundError PhpStanExtractor.php line 67 #163

fliespl opened this issue Nov 14, 2022 · 5 comments

Comments

@fliespl
Copy link

fliespl commented Nov 14, 2022

A few times a day, I am getting following exception in symfony project. Clearing symfony cache fixes it - any ideas what could be the issue since it's random?

Uncaught Error: Class "PHPStan\PhpDocParser\Parser\PhpDocParser" not found

Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\ClassNotFoundError: "Attempted to load class "PhpDocParser" from namespace "PHPStan\PhpDocParser\Parser". Did you forget a "use" statement for another namespace?" at /home/flies/workspace/sf5/homologacja/vendor/symfony/property-info/Extractor/PhpStanExtractor.php line 67
@ondrejmirtes
Copy link
Member

A few times a day, I am getting following exception in symfony project

Please tell us more. What are you running when you get this exception? Is phpstan/phpdoc-parser dependency of your own project?

@fliespl
Copy link
Author

fliespl commented Dec 20, 2022

Some additional details.

Using phpstorm with inspections enabled. After doing some code changes and going back to browser I get this error:
homologacja sf5 wsl_

It will stay that way until I do cache clear in symfony.

Packages used:

       "phpstan/extension-installer": "^1.1",
        "phpstan/phpstan": "^1.7",
        "phpstan/phpstan-deprecation-rules": "^1.0",
        "phpstan/phpstan-doctrine": "^1.3",
        "phpstan/phpstan-phpunit": "^1.1",
        "phpstan/phpstan-strict-rules": "^1.2",
        "phpstan/phpstan-symfony": "^1.2",
        "phpstan/phpstan-webmozart-assert": "^1.2",

phpstan config:

includes:
    - tests/phpstan/custom-parameters.php

parameters:
    scanFiles:
      - src/Kernel.php
    level: max
    paths:
        - migrations
        - src
        - tests
    symfony:
        console_application_loader: tests/phpstan/console-application.php
    doctrine:
        objectManagerLoader: tests/phpstan/object-manager.php
    reportUnmatchedIgnoredErrors: false
    checkGenericClassInNonGenericObjectType: false
    typeAliases:
         SerializerSubscribedEvents: 'array<array{event: string, method: string, class?: class-string, priority?: int, format?: string}>'

@fabienlem
Copy link

Same here.

@fliespl
Copy link
Author

fliespl commented Dec 20, 2022

I am testing right now with adding phpstan/phpdoc-parser as direct dev requirement - seems promising for now.

@olijzenga
Copy link

I am testing right now with adding phpstan/phpdoc-parser as direct dev requirement - seems promising for now.

Same issue here, this workaround also works for me.

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