syntax error, unexpected token “;”, expecting “{”¶
Description¶
Namespace accepts two syntaxes: the first one with an ending semi-colon, or a block, which starts with an opening curly bracket.
In the current case, there is another feature at play: the name of the namespace may be empty, to refer to the global namespace. In that case, either the namespace
keyword is omitted, or a block is defined after the namespace.
Example¶
<?php
namespace ;
?>
Solutions¶
Remove the
namespace ;
entirely.Add a block after the
namespace
, and remove the semi-colon.