I have a class that inherits from a another class.
I am overloading one method; PHP screams about this.
How do I silence this message? It clutters my debug logs.
Declaration of
Dashboard_Abstract::factory() should
be compatible with that of
Abstract::factory()
class Abstract{
static public function factory($param){
...
...
}
}
class Dashboard_Abstract extends Abstract{
static public function factory($param1,$param2){
...
...
}
}
Look, fellow developers. There is a difference between errors and warnings:
means,
“Look, if you are new to this you
might be doing something wrong here,
If you are experienced, you might be
doing right, so we will let you, the
developer, decide.”
So, why won’t you let me decide?
Is it so bad to use all of a language abilities to the max, even if some think it is an error (although, obviously, it is not).
You can use the
error_reporting()function to override it at runtime, and there’s an identically named parameter in php.ini you can set to make the change permanent. However, warnings are there for a reason and generally you should fix your code instead of just silencing them.