keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

Namespaces #171

Closed szepeviktor closed 3 years ago

szepeviktor commented 3 years ago

Would you welcome a PR introducing namespaces?

namespace KeyCDN\WordPress\Cache_Enabler;

kép

coreykn commented 3 years ago

Thanks for brining this discussion up, @szepeviktor. A few months ago I had considered the same thing but given how the class names were already defined I didn't move forward with this. Can you please provide a little more clarity on how you'd introduce this change?

szepeviktor commented 3 years ago

@coreykn Simply

final class Cache_Enabler_Disk {

👇 

namespace KeyCDN\WordPress\Cache_Enabler;

final class Disk {
szepeviktor commented 3 years ago

...and of course modify the autoloader and \add_action( 'plugins_loaded', array( __NAMESPACE__ . '\\Plugin', 'init' ) );

coreykn commented 3 years ago

Thank you for the confirmation. 🙂 Unfortunately I don't think this would be a good idea due to how the current classes are used out in the wild between Cache Enabler users and third party plugins.

szepeviktor commented 3 years ago

I suspected BC will be a blocker.

szepeviktor commented 3 years ago

It is extreeemly hard to ship software to users armed with a mouse 🐁

szepeviktor commented 3 years ago

...although we may add class_alias() ...