Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Non-abstract method %s::%s() must contain body

Description

A method must have a body block. When it has no body block, it has a semicolon instead, and it must have the abstract keyword for the method, and following, to the class.

Example

<?php

class X {
     function foo();
}

?>

Literal Examples

  • Non-abstract method X::foo() must contain body

Alternatives

  • Add a body block to the method.
  • Add a abstract option to the method and to the class.