Uploaded image for project: 'SonarPHP'
  1. SonarPHP
  2. SONARPHP-262

Rule "Using undefined variables"

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      SonarCube should report folloing Violation

      <?php
      
      class TestUnknownVariables
      {
          public function badFunction($a)
          {
              $p = $a + 2;
              $p = $p - $pp; // Usage of undefined variable
      
              echo $p;
          }
          
          public function goodFunction($a)
          {
              global $pp;
              $p = $a + 2;
              $p = $p - $pp;
      
              echo $p;
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              gennadiy@gmail.com Gennadiy Litvinyuk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: