-
Notifications
You must be signed in to change notification settings - Fork 27
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
Use relative directories for packages when building GeneratedConfig #23
Conversation
4d74f10
to
e0372fb
Compare
@ondrejmirtes any chance this could be merged? |
Hi, we work with Docker and the composer image. We have the same problem and any though on this PR would be greatly appreciated. Even if it is a big no. |
Hi, |
When looking at the implementation, I already know that this is wrong: $vendorPos = strpos(__DIR__, 'vendor');
if ($vendorPos === false) {
return;
} Composer users can change their |
I stand by my comment from #17:
|
// walk up to vendor | ||
$basePathTail = substr(__DIR__, $vendorPos); | ||
// how many parts? | ||
$this->dirCount = substr_count($basePathTail, DIRECTORY_SEPARATOR) + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we can know that the vendor folder is always dirname(__DIR__, 3)
here, as this file is in <vendor-dir>/phpstan/extension-installer/src
whatever the vendor-dir is named.
@@ -129,4 +150,27 @@ public function process(Event $event): void | |||
} | |||
} | |||
|
|||
private function getInstallPath(InstallationManager $installationManager, PackageInterface $package): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative solution could be to rely on Composer\Util\Filesystem::findShortestPathCode
instead (but it might require changing the way $data
is handled for the file generation then as var_export($data, true)
won't do it anymore)
4961276
to
5de413b
Compare
I plan to tackle this myself, thank you. |
This was all that was needed: 66c7adc + phpstan/phpstan-src@0e306c6 |
Build the GeneratedConfig file using relative paths so PHPStan can be run inside/outside containers/CI, etc.
Fixes #17