Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Avoid "Cannot redeclare class" #602

Closed
wants to merge 1 commit into from

Conversation

NinoSkopac
Copy link
Contributor

I am not very knowledgeable of this SDK, so this may be a stupid idea (tests will show), but if you opt in for require_once instead of require, you can't have the same class file re-required, which is a good thing.

I am not very knowledgeable of this SDK, so this may be a stupid idea (tests will show), but if you opt in for require_once instead of require, you can't have the same class file re-required, which is a good thing.
@yguedidi
Copy link
Contributor

yguedidi commented Jun 1, 2016

👎 This is useless, as the autoloader is called for a class that is not loaded yet by PHP, once it's loaded, our autoload callback is no more called for that class :)

@SammyK
Copy link
Contributor

SammyK commented Jun 1, 2016

Hey @NinoSkopac! Thanks for another PR! But again, I'm with @yguedidi on this one. The autoloader is based off of an official example from the PHP-FIG. In addition to require_once being slower than require, the autoloader won't be invoked again once a class is loaded so it's redundant to have require_once. :)

@SammyK SammyK closed this Jun 1, 2016
@NinoSkopac NinoSkopac deleted the patch-2 branch June 2, 2016 03:01
@NinoSkopac
Copy link
Contributor Author

Yep, my bad <3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants