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

Make library usable as is without shim #666

Merged
merged 2 commits into from
Aug 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion deptrac.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
}

(static function (): void {
require_once __DIR__.'/vendor/autoload.php';
if (\file_exists($autoload = __DIR__.'/vendor/autoload.php')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To also support install as a global installed dependency there should be more paths taken into account, see https://github.com/sabre-io/dav/blob/c1afdc77a95efea6ee40c03c45f57c3c0c80ec22/bin/sabredav.php#L28

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, but this is already taken into the account. First of all, we do not have a deprac/bin/deptrac, but only "deptrac/deptrac".

This is the difference that would make it so we have to go "up" one less directory (one less ../).

If you take that into the account, then the path on line 12 is the same as in sabredev:29 and line 18 is the same as sabredev:30.

  • Why are they immediately called anonymous functions in deptrac? No idea.
  • Why are they separate? Again, no idea.

Anyways this code works and is internally consistent. The only "improvement" I could see is that we could check if exactly one autoloader is found and if not, throw an error. But that is out of scope IMHO.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the deptrac package directly is mainly a convenience feature for people working on it. Most people should still use the shim or phar. With that in mind, I think we don't have to make any more adjustments for now.

require_once $autoload;
}
})();

(static function (): void {
Expand Down