-
Notifications
You must be signed in to change notification settings - Fork 46
Introdce a safe_class_exists #110
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
Conversation
<?php | ||
|
||
// Don't redefine the functions if included multiple times. | ||
if (!function_exists('Http\Discovery\safe_class_exists')) { |
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.
why not require_once?
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.
I think this allows you to override... Im not sure. I just did it the "guzzle" way.
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.
yeah that allows to override by hijacking the namespace. sounds like either horrible situations or really bad design but i guess it does not hurt too much.
also will be quite some issue with having things loaded in the right order. but if its helpful to people to have it, i guess the overhad is insignificant so lets do it this way.
@@ -27,7 +27,8 @@ | |||
"autoload": { | |||
"psr-4": { | |||
"Http\\Discovery\\": "src/" | |||
} | |||
}, | |||
"files": ["src/functions_include.php"] |
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.
is there no autoloading for functions?
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.
I think only classes are autoloaded.
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.
right, otherwise we would need a naming scheme for function to filename...
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.
thanks.
can you check why the tests are failing?
Can you also check the alternative implementation for this feature: #111 |
ah, now i know why i was confused. i prefer #111 over the function, it seems less complicated infrastructure to me. |
Yeah, I agree with you. |
What's in this PR?
A workaround to make it work with Magento.
This solution to introduce a functions.php is inspired by Guzzle/PSR7. Now when Im done with the implementation I think it may be overkill.