Edit report at http://pear.php.net/bugs/bug.php?id=18750&edit=1
ID: 18750
Updated by: [email protected]
Reported By: j dot meijer at newcomresearch dot nl
-Summary: Implement an abstract method
+Summary: Override a method
Status: Open
Type: Feature/Change Request
Package: PHP_CodeSniffer
Operating System: Irrelevant
Package Version: 1.3.0
PHP Version: Irrelevant
Roadmap Versions:
New Comment:
-Summary: Implement an abstract method
+Summary: Override a method
Previous Comments:
------------------------------------------------------------------------
[2011-08-23 09:47:54] meijuh
Description:
------------
Suppose we have two classes. One has a method and the
other overrides this method.
The class which defines the method has some weird code
standard like putting a leading underscore in front of a
protected method. The other class which overrides this
method also has to use this leading underscore.
The class which defines the method has an other code style
than the class which overrides it (e.g. its an external library).
If a code standard which the extending class must adhere to
does not allow a leading underscore PHPCS will throw an
error. Which in my opinion it should not, because it overrides
the method and not defines it.
Maybe (I did not test this) this is also an issue when a method
is declared abstract.
Test script:
---------------
<?php
/* file 1 with code standard A */
class ExternalLibraryClass {
protected function _underscore() {
//Do something nice here
}
}
?>
<?php
/* file 2 with code standard B */
class ExtendingClass extends ExternalLibraryClass {
protected function _underscore() {
//Do something even nicer.
}
}
?>
Expected result:
----------------
Nothing, PHPCS should allow this.
Actual result:
--------------
Protected method name ExtendingClass::_underscore must not
be prefixed with an underscore.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18750&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.