Cannot use%s %s as %s because the name is already in use

Description

This error appears when a name, for class, interface, trait or enumeration was already used by a use command. This is usually a problem within the block that has the use.

Example

<?php

use X as Y;

class Y {}

?>

Literal Examples

  • Cannot use X as Y because the name is already in use

Solutions

  • Use another name for the alias.

  • Use another name for the definition.