Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #19540 Incorrect useless method override
Submitted: 2012-08-02 20:51 UTC
From: cweiske Assigned: squiz
Status: Duplicate Package: PHP_CodeSniffer (version 1.3.5)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2012-08-02 20:51 UTC] cweiske (Christian Weiske)
Description: ------------ Some code extends ArrayObject and limits the types of elements that can be added by overriding the append() function. PHPCS reports that as "Useless method overriding detected" (Generic_Sniffs_CodeAnalysis_UselessOverridingMethodSniff). So in this case, the override is necessary. Test script: --------------- <?php class Foo extends ArrayObject { public function append(FooElement $e) { parent::append($e); } } ?> Expected result: ---------------- No warning about that. Actual result: -------------- WARNING | Useless method overriding detected

Comments

 [2012-08-06 09:30 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Feedback -Assigned To: +Assigned To: squiz
This looks like the same sort of problem as bug #19481. I don't see how this can be fixed. Got any ideas?
 [2012-08-17 07:43 UTC] squiz (Greg Sherwood)
-Status: Feedback +Status: Duplicate
Marking as duplicate. May as well keep any discussions centralised.