phpstan icon indicating copy to clipboard operation
phpstan copied to clipboard

composer version doesn't respect custom bin directory

Open splatEric opened this issue 1 year ago • 2 comments

A project I work on is using this action, and began failing with the switch to the composer being the version used by default. It transpires that this is because the composer config contains:

  "config": {
    "bin-dir": "bin"
  }

and the action bash script has a hardcoded expectation that the bin directory is in vendor

I understand that this is an edge case you may not want to support. But wanted to flag it up for anyone else hitting the same issue (your docs very clearly point out that it's looking for vendor/bin, but apparently not clearly enough for me!!) We've configured to using latest

splatEric avatar May 02 '23 09:05 splatEric

Hi @splatEric

Sorry for causing this issue - I should have been more rigorous on the release messaging. Thanks for bringing this to my attention.

I'm glad you've got a solution here, but it's something I should take note of. I'll keep this issue open for when I have some time to implement.

g105b avatar May 02 '23 09:05 g105b

Hi @g105b just got into this problem with a project that as an alternate vendor binary location. So I might give it a shot to contribute a PR for fixing this. Do you have already some ideas about how you wanted to solve this?

There are two ways to define an alternate vendor binary location (see https://getcomposer.org/doc/articles/vendor-binaries.md#can-vendor-binaries-be-installed-somewhere-other-than-vendor-bin-):

  1. Setting the bin-dir configuration setting in composer.json
  2. Setting the environment variable COMPOSER_BIN_DIR

Was thinking to look for bin-dir in composer.json with jq/awk/whatever and start from there to see if there's anything or eventually fallback to vendor/bin/phpstan as VENDOR_BIN. Would that make sense?

dlondero avatar Dec 15 '23 11:12 dlondero