Last modified: 2014-04-29 15:13:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 26333 - Constructors calling grandparent constructors
Constructors calling grandparent constructors
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Lowest minor (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: code_quality
  Show dependency treegraph
Reported: 2010-12-14 15:44 UTC by Sam Reed (reedy)
Modified: 2014-04-29 15:13 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Sam Reed (reedy) 2010-12-14 15:44:48 UTC
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 );
Comment 1 Brion Vibber 2010-12-27 02:16:57 UTC
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.)
Comment 2 Quim Gil 2014-04-29 15:13:20 UTC
Marking as Lowest since nobody is working or planning to work on this.

Note You need to log in before you can comment on or make changes to this bug.