I've encountered code where a base class implements an interface, and then all the subclasses also declare they implement the interface like so
class BaseClass implements Countable { public function count() {} }
class SubClass extends BaseClass implements Countable {}
Assuming the absence of a namespace
and use
statements, to me, the latter implements Countable
is egregious. By virtue of extension it already does.
One might argue this makes it clear the subclass implements Countable
without having to look at the base class, but to me it's duplicate code that could lead to longer refactoring times (albeit nominal).
Is this practice considered good form for any reason, or is my hunch correct?