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

False Positive UnusedLocalVariableCheck (S1481): "::class" impact

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8
    • Component/s: Rules
    • Labels:
      None

      Description

      RSPEC-1481

      class Foo{
         public function bar()
         {
              SomeClass::class;   // no FP without this line
              $A = 1;
      
              foreach ($A as $x) {   // FP "Remove this unused "$A" local variable."
                  foo($x);
              }
          }
      
        public function foo()
        {
           ObjectCustomService::class;  // no FP without this line
           $C = 1;
           return $C;  // FP "Remove this unused "$C" local variable."
        }
      }
      

        Attachments

          Activity

            People

            Assignee:
            elena.vilchik Elena Vilchik
            Reporter:
            elena.vilchik Elena Vilchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: