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

Read vendor-dir from composer.json #1612

Closed
olleharstedt opened this issue Mar 26, 2018 · 4 comments
Closed

Read vendor-dir from composer.json #1612

olleharstedt opened this issue Mar 26, 2018 · 4 comments
Labels
enhancement This improves the quality of Phan's analysis of a codebase help wanted Features where help is wanted (E.g. use plugins). Features marked as "probably easy" are easier.

Comments

@olleharstedt
Copy link

olleharstedt commented Mar 26, 2018

Our project is using folder third_party as vendor folder, which is set in our composer.json:

"config": {
    "vendor-dir": "third_party",
    "bin-dir": "third_party/bin"
},

This seems to be not read by phan when running

$ ./third_party/bin/phan --init --init-level=3

I get

phan --init assumes that 'composer.phar install' was run already (expected to find 'limesurvey/vendor')

Any way to set vendor folder by command line?

@TysonAndre TysonAndre added the enhancement This improves the quality of Phan's analysis of a codebase label Mar 26, 2018
@TysonAndre TysonAndre changed the title Phan is not reading vendor-dir from composer.json Read vendor-dir from composer.json Mar 26, 2018
@TysonAndre TysonAndre added the help wanted Features where help is wanted (E.g. use plugins). Features marked as "probably easy" are easier. label Apr 27, 2018
@maksimovic
Copy link
Contributor

Fixed by #1723

@olleharstedt
Copy link
Author

👍

@bryonbean
Copy link

We're having the same problem here and either the fix, #1723, is no longer working as a fix, or perhaps I'm not understanding exactly what the OP's problem was.

Prior to this I had a similar problem as noted in issue #2440. The issue is that our vendor directory is also non-conventionally named Vendor. And now, as I work on a different platform Ubuntu 18, vendor and Vendor are no longer the same directory; a problem easily overlooked when using OSX. Our precise problem is in Phan\Bootstrap.php as shown below:

phan/src/Phan/Bootstrap.php

Lines 115 to 116 in 8b7d7b4

dirname(__DIR__, 2) . '/vendor/autoload.php', // autoloader is in this project (we're in src/Phan and want vendor/autoload.php)
dirname(__DIR__, 5) . '/vendor/autoload.php', // autoloader is in parent project (we're in vendor/phan/phan/src/Phan/Bootstrap.php and want autoload.php

So I wonder if I should ask to have this issue re-opened or if I should create a new one?

@TysonAndre
Copy link
Member

The reported issue was for not respecting vendor-dir when creating a new .phan/config.php with phan --init

Your issue is with running Phan in a non-standard vendor layout. It's probably doable to keep traversing ancestor directories to look for a composer.json if neither of those directories exist - I'm not sure if this problem is common.

Possible solutions:

  1. Use alternative installation method for phan, e.g. separate composer.json and directory inside project
  2. Use phan.phar releases
  3. Work to change the vendor dir from Vendor to vendor - If checked into git, this will result in rename conflicts for people using macs during git pull which are a pain to deal with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This improves the quality of Phan's analysis of a codebase help wanted Features where help is wanted (E.g. use plugins). Features marked as "probably easy" are easier.
Projects
None yet
Development

No branches or pull requests

4 participants