1.2.642. Locally Used Property In Trait

List of properties that are used in the trait where they are defined. A property should be used at least once in the trait of its definition.

<?php

trait foo {
    public $unused, $used;// property $unused is never used in this trait

    function bar() {
        $this->used++; // property $used is used in this method
    }
}

class X {
    use foo;
}

$foo = new X();
$foo->unused = 'here'; // property $unused is used outside the trait definition
?>

1.2.642.1. Connex PHP features

1.2.642.1.1. Specs

Short name

Traits/LocallyUsedProperty

Rulesets

All, Changed Behavior

Exakat since

1.3.5

PHP Version

All

Severity

Minor

Time To Fix

Slow (1 hour)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud