Closed remicollet closed 9 years ago
This is a bug tracker for discussion (I can take care of implementation).
That indeed could work and I do like the idea.
I'm currently trying to decide whether this would be a BC break for anyone as the current default behavior is to consider the first directory to process as base directory (unless explicitly overwritten).
For the majority of my use cases, there shouldn't be any difference as I store the autoload.php file within the src directory. I don't really care too much about PSR-0 or PSR-4 and PSR compliance as the generated map works independently of any file system layout. But I do see the point of using the location of the autoload file as reference.
Obviously every user who had --basedir in place won't see any difference. So the only question is what would (or could?) break when one did not specify basedir?
I guess the current default behavior only works if you place the generated file into the very same directory you are processing. Every other usecase needs tweaking of the basedir setting.
So using the directory of the file as basedir shouldn't do any harm as it would only render the basedir specification superfluous for those cases.
Looking forward to a PR for this :)
Thanks for the effort and the fixes. I'll prepare a new release later today.
Thanks for merging :)
About defaut basedir. Would it make sense to use directory of output file (if given), so the generated file will be usable) ?
It is quite common to run
Because sometime library have file in "top" Without --basedir, default value is "top" which make the generated autoload.php unusable.
Ex : https://github.com/sebastianbergmann/version
Restoring a PSR-0 tree, this will be installed as
Obviously we cannot save the autoloader in top directory (which contains various libraries)