.. _namespace-declaration-statement-has-to-be: Namespace declaration statement has to be ----------------------------------------- .. meta:: :description: Namespace declaration statement has to be: A ``namespace`` declaration must be the very first statement of the file, or immediately follow a ``declare()`` call (such as ``declare(strict_types=1). :og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png :og:type: article :og:title: Namespace declaration statement has to be :og:description: A ``namespace`` declaration must be the very first statement of the file, or immediately follow a ``declare()`` call (such as ``declare(strict_types=1) :og:url: https://php-errors.readthedocs.io/en/latest/messages/namespace-declaration-statement-has-to-be.html :og:locale: en :twitter:card: summary_large_image :twitter:site: @exakat :twitter:title: Namespace declaration statement has to be :twitter:description: Namespace declaration statement has to be: A ``namespace`` declaration must be the very first statement of the file, or immediately follow a ``declare()`` call (such as ``declare(strict_types=1) :twitter:creator: @exakat :twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png .. raw:: html Description ___________ A ``namespace`` declaration must be the very first statement of the file, or immediately follow a ``declare()`` call (such as ``declare(strict_types=1);``). Any other statement, including a simple ``echo``, a comment that generates output, or whitespace before the opening `` Literal Examples **************** + Namespace declaration statement has to be the very first statement or after any declare call in the script Solutions _________ + Move the ``namespace`` statement to be the first statement in the file, right after the opening ```_.