Is an E_STRICT warning when overwriting a static method with a different parameter list desired?
| From: | Martijn Evers | Date: | Sun, 20 Sep 2009 23:36:08 +0000 |
| Subject: | Is an E_STRICT warning when overwriting a static method with a different parameter list desired? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-298209@lists.php.net to get a copy of this message | ||
Hi,
I was wondering if an E_STRICT error is desired when a static method is overwritten with a other parameter list.
The error I'am getting is:
"Strict Standards: Declaration of Sub::doSomething() should be compatible with that of Base::doSomething()"
When I run this code:
---------------------------------------------------------------------------
class Base
{
public static function doSomething($something)
{
echo $something;
}
}
class Sub extends Base
{
public static function doSomething()
{
parent::doSomething('anything');
}
}
But why? Aren't interfaces supposed to handle this?
NOTE: Be sure to have E_STRICT enabled in the ini or a file including this one. E_STRICT errors are not reported in the file where error_reporting is used to set E_STRICT. (personal experience :P )