Call to undefined method %s::%s()

Description

This message is emitted when no method with the requested name could be found on the class, or its parents or traits.

Calling from another class’s context yields a distinct message.

Example

<?php

class X {
    function foo() {}
}

$x = new X;
$x->goo();

?>

Literal Examples

  • Call to undefined method x::goo()

Solutions

  • Check the spelling of the method name.

  • Check if the object supports this method.

  • Check if there are the valid trait name import (use in a class), to define the method.

  • Check if the method is still available in the current setup (PHP version, components and library versions…).

  • Check if the magic method __call() is not missing in the object’s class.