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

Changed to PSR-4 autoloading #70

Closed

Conversation

leroy0211
Copy link

fixed #52

@@ -2,3 +2,4 @@
/composer.lock
/phpunit.xml
/earl-report.jsonld
/.idea
Copy link

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/" }
Copy link
Owner

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.

Copy link
Author

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.

Copy link
Owner

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?

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

@lanthaler lanthaler closed this in d4f28dd Nov 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to PSR-4 class autoloading instead of PSR-0!?
4 participants