getdokan/woocommerce-conversion-tracking

Namespaced classes

Closed this issue · 4 comments

gp0 commented

Hey,
it would be great if the classes would be Namespaced, otherwise your plugin collides with other plugins ("PHP Fatal error: Cannot redeclare class WCCT_Admin"). If namespaces aren't an option please consider a prefix to make the class names more unique.

WooCommerceConversionTracking is already prefixed. Which other plugin is conflicting with such class name? That would be a real coincidence.

gp0 commented

It's this one. I'm not the author, just ran into it randomly, because a client of mine wanted to try it out, and i figured i'd just let you know.

Probably niche-ish use case, but in my opinion, using the PHP namespaces would still be a good idea, depends on how much backwards compatability you want to maintain, afaik Woocommerce recommends PHP7, so one could argue that using PHP namespaces would be okay.

I'm all in for using namespace and other PHP > 5.4 functionalities, but backwards compatibility is the main killer for plugin developers.

gp0 commented

For now, i've patched in a prefix in the other plugin and can live with that workaround.