Last modified: 2013-12-02 12:30:54 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 T59585, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57585 - [upstream] PHP CodeSniffer: Overriding a method to change visibility should not be classified as "Useless method overriding"
[upstream] PHP CodeSniffer: Overriding a method to change visibility should n...
Status: NEW
Product: Wikimedia
Classification: Unclassified
Continuous integration (Other open bugs)
wmf-deployment
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
https://pear.php.net/bugs/bug.php?id=...
: upstream
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-26 12:12 UTC by Siebrand Mazeland
Modified: 2013-12-02 12:30 UTC (History)
4 users (show)

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


Attachments

Description Siebrand Mazeland 2013-11-26 12:12:02 UTC
In for example https://gerrit.wikimedia.org/r/#/c/96456/2/includes/db/ORMTable.php, protected DBAccessBase::releaseConnection is overridden as public ORMTable::releaseConnection.

Running CodeSniffer on this, leads to a "useless method overriding" warning. However, the visibility is intentional and valid, so CodeSniffer should not warn.

Example code:

	<?php
	
	class DBAccessBase {
		protected function releaseConnection( DatabaseBase $db ) {
		}
	}
	
	class ORMTable extends DBAccessBase {
		public function releaseConnection( DatabaseBase $db ) {
			parent::releaseConnection( $db ); // just make it public
		}
	}

CodeSniffer output:

FILE: test.php
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 9 | WARNING | Useless method overriding detected
   |         | (Generic.CodeAnalysis.UselessOverridingMethod.Found)
--------------------------------------------------------------------------------
Comment 1 Krinkle 2013-11-28 16:17:30 UTC
Please file an issue upstream:
 https://github.com/squizlabs/PHP_CodeSniffer#issues

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


Navigation
Links