Non-static method %s::%s() should not be called statically
Description
A non-static method requires an object to be called, as PHP will populate that object in the $this method.
If the method makes no use of $this, make it static to allow the call. Otherwise, keep it non-static, and use an object for the call.
Example
<?php
class X {
function foo() { echo __METHOD__;}
}
X::foo();
?>
Literal Examples
- Non-static method x::foo() should not be called statically
Alternatives
- Make the method static.
- Find an object to call the method.
Related error messages
In more recent PHP versions, this error message is now :ref:non-static-method-%s::%s()-cannot-be-called-statically.