Skip to content

MIR0215

InvalidStaticInvocation

A method is called using the static call syntax (ClassName::method()) but the method is not declared static. Calling a non-static method statically is deprecated in PHP and will produce a warning or error.

<?php
class Formatter {
public function format(string $value): string {
return strtoupper($value);
}
}
echo Formatter::format('hello'); // format() is not static

Either declare the method static, or instantiate the class and call the method on the instance:

<?php
$formatter = new Formatter();
echo $formatter->format('hello');