1.2.736. Multiple Property Declaration On One Line

Multiple properties are defined on the same line. They could be defined independently, on separate expressions.

Keeping properties separate helps documenting and refactoring them independently.

<?php

// multiple definition on one expression
class point {
    private $x, $y, $z;

    // more code
}

// one line, one definition
class point2 {
    private $x;

    private $y;

    private $z;

    // more code
}

?>

1.2.736.1. Suggestions

  • Split the definitions to one by line

1.2.736.2. Specs

Short name

Classes/MultiplePropertyDeclarationOnOneLine

Rulesets

All, Coding conventions

Exakat since

2.2.2

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud