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
Solutions¶
Make the method static.
Find an object to call the method.