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

add missing duplicate function check #111

Closed
wants to merge 1 commit into from
Closed

add missing duplicate function check #111

wants to merge 1 commit into from

Conversation

sh-sabbir
Copy link

No description provided.

@ocean90
Copy link
Member

ocean90 commented Oct 25, 2021

@sh-sabbir Hey, could you please explain why this change is necessary?

@sh-sabbir
Copy link
Author

In my sane mind I can assume nobody or no plugin will create a method named "wordpresa_importer_init". But what if anyone does that? What will happen then? This function is not a part of a class & will result not working or breaking the website as soon as someone installs the plugin. It's a good practice to check for duplicate methods while declaring method outside a class.

@dd32
Copy link
Member

dd32 commented Oct 26, 2021

I don't think this change is necessary. The function is properly "namespaced" by being prefixed with the plugins name. We can't wrap every prefixed function/class name just in case someone else decides to use it.

For this to cause a problem, another plugin would need to use a clashing name, and not include function_exists() themselves, and create that function after both that function and this importer plugins were activated (As the WordPress plugin activation flow verifies that it doesn't cause a fatal error).

@dd32 dd32 closed this Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants