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

False Positive UnusedFunctionParameters: parameter is used in "compact" call

    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

      Parameter of compact function can be a string containing the name of the variable. We do not support such usages of variables/parameters when building the symbol table.

      function foo($variable) {
          $array = compact('variable');
          return $array;
      }
      

      See

      Note that this fix will affect other rules which use symbol table (like unused variable).

        Attachments

          Issue Links

            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: