1.2.415. Empty Namespace

Declaring a namespace in the code and not using it for structure declarations or global instructions is useless.

Using simple style : Using bracket-style syntax :

<?php

namespace Y;

class foo {}


namespace X;
// This is useless

?>

1.2.415.1. Suggestions

  • Remove the namespace

  • Fill the namespace with some definition

1.2.415.2. Specs

Short name

Namespaces/EmptyNamespace

Rulesets

All, Analyze, CE, CI-checks, Changed Behavior, Dead code

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Instant (5 mins)

Precision

Very high

Features

namespace

ClearPHP

no-empty-namespace

Available in

Entreprise Edition, Community Edition, Exakat Cloud