1.2.1215. Traits Usage

This is the list of traits that are actually ‘used’ in the code. There are classes or traits that ‘use’ them. Traits can only be accessed by calling them with the ‘use’ command. It is not possible to reach a trait element (method, constant, property) by refering to them with the trait name, even for static elements: the code must go through the host class.

<?php

trait t {
    function t() {
        echo 'I\'m in t';
    }
}

class foo {
    use t;
}

$x = new foo();
$x->t();

?>

See also Traits.

1.2.1215.1. Specs

Short name

Traits/TraitUsage

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Slow (1 hour)

Precision

Very high

Features

trait

Available in

Entreprise Edition, Community Edition, Exakat Cloud