[wp-trac] [WordPress Trac] #37699: Death to Globals Episode #1: A Registry, A Pattern
WordPress Trac
noreply at wordpress.org
Thu Aug 18 16:14:02 UTC 2016
#37699: Death to Globals Episode #1: A Registry, A Pattern
----------------------------+------------------
Reporter: wonderboymusic | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.7
Component: General | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
----------------------------+------------------
Comment (by jdgrimes):
Replying to [comment:4 schlessera]:
> When evaluating whether interfaces are feasible, it should be noted that
the current class name (`wpdb`) would be ideal as the first level of
interface migration.
>
> So, I would recommend starting by creating an interface `wpdb`, and
rename the current existing concrete implementation to `MySQLwpdb
implements wpdb`. In this way, we have introduced an interface that can be
used for typehinting, while not breaking any existing `instanceof` checks.
This would still break any code that was doing `new wpdb()` though. Not
sure how common that is, but there may be plugins that do it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37699#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list