-
Notifications
You must be signed in to change notification settings - Fork 652
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
Phar version and no composer autoloader doesn't seem to work #1923
Comments
When I run Psalm in that repo after running |
Yes, you used composer to install it. :) Try using the phar distribution of Side-Rant: Imho, using composer to install tools is fundamentally broken as it mangles tool dependencies with runtime dependencies of the software and creates a bloated autoloader. Tools should always be installed using a self contained phar and, ideally, scoped so no conflicts with tool dependencies and software dependencies can arise. |
I didn't, though - I used the Phar. I ran
and Psalm happily reported results. If it detects a |
theseer@nyda /tmp/1923 $ git clone git@github.com:phar-io/version.git
Cloning into 'version'...
remote: Enumerating objects: 260, done.
remote: Total 260 (delta 0), reused 0 (delta 0), pack-reused 260
Receiving objects: 100% (260/260), 39.49 KiB | 421.00 KiB/s, done.
Resolving deltas: 100% (168/168), done.
theseer@nyda /tmp/1923 $ cd version/
theseer@nyda /tmp/1923/version master $ phive install psalm
Phive 0.12.2-dirty - Copyright (C) 2015-2019 by Arne Blankerts, Sebastian Heuer and Contributors
Linking /home/theseer/.phive/phars/psalm.phar to /tmp/1923/version/tools/psalm
theseer@nyda /tmp/1923/version master $ ./tools/psalm
Could not find any composer autoloaders in /tmp/1923/version/
Add a --root=[your/project/directory] flag to specify a particular project to run Psalm on. |
Why would I need to run |
You don't, actually - |
Can you point me to the code for that? I'm confused :) |
The only code I can find (using What am I missing? :) |
The composer autoload initialisation logic is here: https://github.com/vimeo/psalm/blob/master/src/command_functions.php#L16 |
Found that already. I'm still missing something probably trivial ;) In line 85 the autoload files are merely required. In case no composer autoloader is in use the init code will return Given I can (can I?) specify my own autoloader in psalm.xml ( There must be something more to it that I just fail to see or find. I found more code dealing with the composer autoloader class in psalm's Feel free to close this btw. if you think it's working as intended and we'll discuss the topic in fall at IPC in Munich ;) |
Here's where the specific error you're seeing is generated: psalm/src/command_functions.php Lines 63 to 73 in aa0efcf
But yes, going to close! See you in Munich! |
This might be pretty much identical to #935, but I'm not sure it qualifies as a duplicate just yet.
Maybe I'm just doing things wrong.
I'm trying to introduce psalm to phar-io/version. As it's a simple library, it doesn't have any external dependencies but of course can be used as a dependency by others - thus provides a
composer.json
file.Yet, we do not use composer for autoloading but provide our own autoloader - in
src/autoload.php
.I found the
autoloader
attribute forpsalm.xml
but that seems to not be working the way I expected it to - becausepsalm
keeps complaining it cannot find a composer autoloader.Bug or feature? ;-)
The text was updated successfully, but these errors were encountered: