Use a more precise autoload prefix #1078
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As
phpdocumentor/guides-markdown
provides only classes for theMarkdown
subnamespace, using a more precise autoload prefix for the PSR-4 configuration will allow the ClassLoader to avoid checking that package for other guides classes.This won't make much difference when using an optimized autoloader with level 2 optimizations as the classmap will be used instead of checking the filesystem. But it will help a bit when using a non-optimized autoloader (which is common in dev environments as that provide a better DX when your codebase gets edited).
If this is considered good by maintainers, I will update the PR to apply that to other packages rather than just
guides-markdown
as others could also benefit from it.Also, maintainers should decide whether they prefer using
src/Markdown/
as path in the config or flattening thesrc
folder by removing theMarkdown
folder entirely (similar to what is done forguides-cli
). Both options are valid and I'll happily apply the preferred one when updating this PR to cover all packages.