https://bugzilla.wikimedia.org/show_bug.cgi?id=57585
Web browser: ---
Bug ID: 57585
Summary: Overriding a method to change visibility classified as
""Useless method overriding"
Product: Wikimedia
Version: wmf-deployment
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: Continuous integration
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
Mobile Platform: ---
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)
--------------------------------------------------------------------------------
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l