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

FP on S2037 (SelfKeywordUsageCheck): constant from parent class declared in another file

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4
    • Component/s: Rules
    • Labels:
      None

      Description

      SONARPHP-719 fixed the problem only when 2 classes are in the same file. We should fix FPs when extended class is declared in another file
      file1:

      <?php
      class A {
          const A_CONST = 'a';
      }
      

      file2

      <?php
      class B extends A {
          const B_CONST = 'b';
          public $arr = [
              self::B_CONST,
              self::A_CONST,
          ];
      }
      

      Raised here https://github.com/SonarSource/sonar-php/pull/182

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              karim.ouerghemmi Karim El Ouerghemmi
              Reporter:
              elena.vilchik Elena Vilchik
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: