Cannot use '%s' as namespace name

Description

The namespace keyword is used to declare a namespace, and also to reference the current namespace, when building a name, for a function, a class, etc. As such, it is not possible to use namespace as a prefix of the name of a namespace (sic), as it may be confused later with the current namespace. Also, namespaces are case insensitive.

Example

<?php

namespace Namespace\xyz {}

namespace NAMEspace\xyz {}

// This is OK, as ``namespace`` is not first in the name
namespace Abc\Namespace\Xyz {}

?>

Literal Examples

  • Cannot use “namespacexyz” as namespace name, due to conflict with ns-relative names

Solutions

  • Remove the word namespace in the name of the namespace.

  • Add another prefix before the word namespace in the name of the namespace.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.