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

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T28333, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26333 - Constructors calling grandparent constructors
Constructors calling grandparent constructors
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
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: ---


Attachments

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.


Navigation
Links