syntax error, unexpected token “extends”, expecting “{”

Description

When declaring a class, the extends keyword must appear before the implements one. There is only one (or no) class extension, so the extends list is often shorter than the implements list.

Example

<?php

class X implements I1, I2 extends W {}

?>

Solutions

  • Move the extends keyword, and its class, right after the name of the class, and before the implements keyword.

  • Remove the extends keyword.