1.2.1292. Unused Label

Some labels have been defined in the code, but they are not used. They may be removed as they are dead code.

There is no analysis for undefined goto call, as PHP checks that goto has a destination label at compile time :

<?php

$a = 0;
A:

    ++$a;

    // A loop. A: is used
    if ($a < 10) { goto A; }

// B is never called explicitly. This is useless.
B:

?>

See also Goto.

1.2.1292.1. Suggestions

  • Remove the unused label

  • Add a goto call to this label

  • Check for spelling mistakes

  • Check that it is not a coding typo, like a raw http://www.php.net, left in the code (It is actually valid PHP code)

1.2.1292.2. Specs

Short name

Structures/UnusedLabel

Rulesets

All, Changed Behavior, Dead code

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

label, goto

Available in

Entreprise Edition, Exakat Cloud