syntax error, unexpected fully qualified name “%s”, expecting “{”

Description

Until PHP 8.0, it was possible to include spaces or new lines in a namespace. They would be ignored later, but parsed and handled that way.

In PHP 8.0, this is not possible anymore.

Example

<?php

namespace Vendor
\XXX;

echo 1;

?>

Literal Examples

  • syntax error, unexpected fully qualified name “XXX”, expecting “{”

Solutions

  • Make namespaces one string, without new lines or any spaces.