composer: `psalm/phar` broken on composer 2.2

My composer.json:

{
    "name": "acme/example",
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^8.0.2"
    },
    "require-dev": {
        "psalm/phar": "4.16.1"
    },
    "config": {
        "allow-plugins": {
            "composer/package-versions-deprecated": true
        },
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        }
    }
}

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.2.2
PHP version: 8.0.14
PHP binary path: /opt/homebrew/Cellar/php@8.0/8.0.14/bin/php
OpenSSL version: OpenSSL 1.1.1m  14 Dec 2021
cURL version: 7.80.0 libz 1.2.11 ssl (SecureTransport) OpenSSL/1.1.1m
zip: extension present, unzip present, 7-Zip not available

When I run this command:

./vendor/bin/psalm.phar

I get the following output (Composer 2.2.2):

Target PHP version: 8.0 (inferred from composer.json)
Scanning files...
Analyzing files...

░

ERROR: MissingFile - vendor/bin/psalm.phar:93:9 - Cannot find file composer-bin-proxy:/Users/acme/example/vendor/psalm/phar/psalm.phar to include (see https://psalm.dev/107)
        include("composer-bin-proxy://" . __DIR__ . '/..'.'/psalm/phar/psalm.phar');


------------------------------
1 errors found
------------------------------

And I expected this to happen (Composer 2.1.14):

Scanning files...
Analyzing files...

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

------------------------------
                              
       No errors found!       
                              
------------------------------

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (15 by maintainers)

Most upvoted comments

Thanks for your ping, I was not aware this issue had been opened here.

I believe the fix has been merged in Psalm already: https://github.com/vimeo/psalm/pull/7210

We’ll make a release soon

@herndlm The meat of the proxy file is virtually the same between Composer 2.1.14 and 2.2.2, and if stream wrappers are disabled then the composer-bin-proxy wrapper should not be used. In fact on PHP 8 none of this stuff should even get executed.

It would be useful to see the contents of the vendor/bin/psalm.phar that causes the issue.