Open k3vl4rAtWork opened 1 month ago
Hey @k3vl4rAtWork, can you reproduce the issue on https://psalm.dev? These will be used as phpunit tests when implementing the feature or fixing this bug.
Hey @k3vl4rAtWork, I was getting the same error, then realized that a very old Psalm have been installed when I ran composer require --dev vimeo/psalm
. Psalm 0.13.14 was installed. The ProjectChecker.php
file does not even exist in the newer version which got me confused for a second.
The old Psalm version was installed because I had installed nikic/php-parser 5.1 as well, and seems Psalm requires 4.19.
You can see if your Psalm is outdated with composer outdated
.
And if it is, you can see why by running composer why-not vimeo/psalm:^5.15
for example.
You can then install Psalm by upgrading/downgrading dependencies with
composer require --dev vimeo/psalm --with-all-dependencies
Or by installing the phar version.
Hope that helps, let me know.
Yep, that should fix the issue. I wonder if it's possible to remove those old versions from packagist (ideally keeping the tags).
You can @weirdan, in the Packagist web UI, click the ❌ icons next to the version you want to drop from Composer (see pic), the git/GitHub tag will stay. I have just tried that with one of my abandoned packages, there's no 0.1.0 which I have deleted in Packagist a minute ago, but the tag still exists.
Then we need to remove all versions between 0.1.2 and 0.3.14 (both ends inclusive), as all of them had unbounded constraint (>=
to be exact) on nikic/php-parser
dependency.
Unfortunately, I can't do that myself as I'm not listed as Psalm's maintainer on Packagist, but I contacted Psalm's original author with a request to do this.
Unfortunately, I can't do that myself
I can now. The versions with unbounded constraints have been retracted.
Nice, thanks @weirdan! This saves me some head scratching the next time it would happen :-)
@k3vl4rAtWork would you mind checking with the latest version?
Hey @k3vl4rAtWork, I was getting the same error, then realized that a very old Psalm have been installed when I ran
composer require --dev vimeo/psalm
. Psalm 0.13.14 was installed. TheProjectChecker.php
file does not even exist in the newer version which got me confused for a second.The old Psalm version was installed because I had installed nikic/php-parser 5.1 as well, and seems Psalm requires 4.19. You can see if your Psalm is outdated with
composer outdated
.And if it is, you can see why by running
composer why-not vimeo/psalm:^5.15
for example.You can then install Psalm by upgrading/downgrading dependencies with
composer require --dev vimeo/psalm --with-all-dependencies
Or by installing the phar version.
Hope that helps, let me know.
Yeah, your trick is very helpful @spaze . Thank alot!
In my case, by running composer why-not vimeo/psalm 5.26
showed that it needs nikic/php-parser (^4.17)
Just getting started here with attempting to use PSALM on a small codebase and cant get the configuration generated. Any help is appreciated.
All I've done is the composer require, and then attempted to run the psalm init to create the configuration:
`$ ./vendor/bin/psalm --init PHP Fatal error: Uncaught Psalm\Exception\ConfigException: Config not found for path C:\Users\project\vendor\bin\psalm in C:\Users\project\vendor\vimeo\psalm\src\Psalm\Checker\ProjectChecker.php:767 Stack trace:
0 C:\Users\project\vendor\vimeo\psalm\src\Psalm\Checker\ProjectChecker.php(448): Psalm\Checker\ProjectChecker->getConfigForPath()
1 C:\Users\project\vendor\vimeo\psalm\bin\psalm(172): Psalm\Checker\ProjectChecker->checkFile()
2 C:\Users\project\vendor\bin\psalm(119): include('...')
3 {main}
thrown in C:\Users\project\vendor\vimeo\psalm\src\Psalm\Checker\ProjectChecker.php on line 767
Fatal error: Uncaught Psalm\Exception\ConfigException: Config not found for path C:\Users\project\vendor\bin\psalm in C:\Users\project\vendor\vimeo\psalm\src\Psalm\Checker\ProjectChecker.php:767 Stack trace:
0 C:\Users\project\vendor\vimeo\psalm\src\Psalm\Checker\ProjectChecker.php(448): Psalm\Checker\ProjectChecker->getConfigForPath()
1 C:\Users\project\vendor\vimeo\psalm\bin\psalm(172): Psalm\Checker\ProjectChecker->checkFile()
2 C:\Users\project\vendor\bin\psalm(119): include('...')
3 {main}
thrown in C:\Users\project\vendor\vimeo\psalm\src\Psalm\Checker\ProjectChecker.php on line 767 `