syntax error, unexpected token “namespace”

Description

The namespace token is one of the first to be used in a script. There is little other command that can be used outside a namespace.

Example

<?php

declare(strict_types=1)

namespace A;

?>

Solutions

  • Check the previous declare command, and its final semi colon.