Cannot instantiate interface %s

Description

An interface represents an abstract class, and cannot be instantiated alone. For that, the interface must be implemented by a class, aka, it must be specified with the implements keyword.

Example

<?php

interface I {}

//Cannot instantiate interface I
new I();

class XI implements I {
}

new XI();

?>

Literal Examples

  • Cannot instantiate interface i

Solutions

  • Implement the interface with a class and use that class.