%s cannot implement %s - it is not an interface

Description

The implements keyword must use an interface, and cannot use anything else. In particular, it cannot be another class, enumeration or trait. All four structures CITE (class, Interface, Trait and Enumeration) use the same namespaces, and they cannot be told apart by reading the name only.

Indeed, when the structure has no definition, PHP reports interface-"E" not found.

Example

<?php

enum E {}
class X implements E {}

?>

Literal Examples

  • X cannot implement e - it is not an interface

Solutions

  • Make sure the implements structure is an interface, not a class, trait or enumeration.