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
Changed to PSR-4 autoloading #70
Changed to PSR-4 autoloading #70
Conversation
@@ -2,3 +2,4 @@ | |||
/composer.lock | |||
/phpunit.xml | |||
/earl-report.jsonld | |||
/.idea |
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.
Should be in your global .gitignore
but not committed in the repository.
@@ -22,7 +22,9 @@ | |||
"json-ld/tests": "@dev" | |||
}, | |||
"autoload": { | |||
"psr-0": { "ML\\JsonLD": "" } | |||
"psr-4": { "ML\\JsonLD\\": "src/" } |
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.
It would be way easier to just change the line above to "psr-4": { "ML\\JsonLD\\": "" }
and leave the rest as is. I'm not a big fan of hiding everything in a src
directory. Also, please make sure the tests pass.
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.
Without it, on a production server the Tests are also autoloaded. Because the tests folder is also included in the primary source.
This is quite a bit of overhead. I always use an autoload
for the source, and an autoload-dev
for the tests. That is the reason for the src
folder being separated from the tests
folder.
I'm not really sure why the tests fail. But let me check that out.
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.
What do you mean they are autoloaded? They are just loaded if they are used. Or do you mean that the class map grows? Can't that be worked around with exclude-from-classmap
?
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.
"exclude-from-classmap": ["/Test/"]
should work.
See "Excluding paths from the optimized classmap" section of https://seld.be/notes/new-composer-patterns
fixed #52