CuyZ / Valinor

PHP library that helps to map any input into a strongly-typed value object structure.

Home Page:https://valinor.cuyz.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Psalm plugin failed to load

rubenrubiob opened this issue · comments

Hello,

When trying to use the Psalm plugin as stated in the documentation, I get the following error:

Uncaught UnexpectedValueException: CuyZ\Valinor\QA\Psalm\ValinorPsalmPlugin is not a known class in /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Config.php:1637
Stack trace:
#0 /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Config.php(1518): Psalm\Config->loadPlugin()
#1 /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(244): Psalm\Config->processPluginFileExtensions()
#2 /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(335): Psalm\Internal\Analyzer\ProjectAnalyzer->__construct()
#3 /var/www/valinor-sample/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run()
#4 /var/www/valinor-sample/vendor/bin/psalm(120): include('...')
#5 {main}

Next Psalm\Exception\ConfigException: Failed to load plugin CuyZ\Valinor\QA\Psalm\ValinorPsalmPlugin in /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Config.php:1647
Stack trace:
#0 /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Config.php(1518): Psalm\Config->loadPlugin()
#1 /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(244): Psalm\Config->processPluginFileExtensions()
#2 /var/www/valinor-sample/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(335): Psalm\Internal\Analyzer\ProjectAnalyzer->__construct()
#3 /var/www/valinor-sample/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run()
#4 /var/www/valinor-sample/vendor/bin/psalm(120): include('...')
#5 {main}
(Psalm 5.11.0@c9b192ab8400fdaf04b2b13d110575adc879aa90 crashed due to an uncaught Throwable)

That happens even in an empty project, with no source code. You can check it out in this repository: https://github.com/rubenrubiob/valinor-sample by doing:

composer install
vendor/bin/psalm

I am using Psalm and Valinor's latest versions

Am I missing something? I did not find any related issue in this repository nor in Psalm's.

Thank you!

Not a real solution but I found that adding this to my composer.json resolved the issue.

    "autoload-dev": {
        "psr-4": {
            "CuyZ\\Valinor\\QA\\": "vendor\\cuyz\\valinor\\qa"
        }
    },

Hey there, thanks for the report.

A way to (temporarily?) fix this issue is to add the following to your project's composer.json:

"autoload-dev": {
    "files": [
        "vendor/cuyz/valinor/qa/Psalm/ValinorPsalmPlugin.php"
    ]
}

In the meantime, I've submitted vimeo/psalm#9847 to try to find a better way to do this.

Thanks to both of you! In the meantime, I can get by using that concrete autoload.