DontCall Prevent calling of undefined methods. use Dont\DontCall; class MyClass { use DontCall; } (new MyClass)->undefinedMethod(); // will throw NonCallableObject exception