Page MenuHomePhabricator

Constructors calling grandparent constructors
Open, LowestPublic


It seems there are random instances of constructors calling grandparent constructors, for no explicit reason

Ideally these should be tidied up/reviewed. Such as r78379...

class RevDel_ArchiveItem extends RevDel_RevisionItem {

	public function __construct( $list, $row ) {
  • RevDel_Item::__construct( $list, $row );

+ parent::__construct( $list, $row );

Version: unspecified
Severity: minor



Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 11:22 PM
bzimport set Reference to bz26333.
bzimport added a subscriber: Unknown Object (MLST).
Reedy created this task.Dec 14 2010, 3:44 PM
brion added a comment.Dec 27 2010, 2:16 AM

Hmm, well this sort of thing actually seems to be done on purpose in those classes; RevDel_ArchiveItem and RevDel_ArchivedFileItem set their 'file' or 'revision' members in a different way than their parent classes do, so calling the parent would likely not work as intended.

While this works, it might make it easier on future maintenance to refactor the classes a bit: eg RevDel_RevisionItem and RevDel_ArchiveItem could *both* derive from the same parent class which contains their common code, rather than RevDel_ArchiveItem extending RevDel_RevisionItem and then replacing a couple bits.

Alternatively, the bit that processes $row should be split out to a second function, so the child class need only override that single function instead of skipping over its parent's constructor. (This would be a smaller code change.)

Qgil added a comment.Apr 29 2014, 3:13 PM

Marking as Lowest since nobody is working or planning to work on this.

Krinkle set Security to None.
Krinkle removed a subscriber: Unknown Object (MLST).