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

[S1121] Fix rule description

    XMLWordPrintable

    Details

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

      Description

      About the current documentation.

      The current PHP Noncompliant example (see below) for Rule S1121 shows an issue which is not found by the analyzer.

      if ($val = value() && check()) { // Noncompliant
      }
      

      In fact the rule should apply on assignment within sub-expressions, which is not the case of the example which can be read as A = (B && C) , and therefore the assignment is not a sub-expression.

      We should modify the Noncompliant example for the user-documentation.

      if ( ($val = value()) && check() ) { // Noncompliant
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              nils.werner Nils Werner
              Reporter:
              roberto.orlandi Roberto Orlandi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: