Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-1766

More than one property should not be declared per statement

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      {0} property declarations were found in this statement. Reformat the code to declare only one property per statement.
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      PSR-2
    • Covered Languages:
      PHP
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      2min

      Description

      For better readability, do not put multiple property declarations in the same statement.

      Noncompliant Code Example

      <?php
      class Foo
      {
         private $bar = 1, $bar2 = 2;
      }
      

      Compliant Solution

      <?php
      class Foo
      {
         private $bar1 = 1; 
         private $bar2 = 2;
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                linda.martin Linda Martin (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: