1.2.1223. Trait Not Found¶
A unknown trait is mentioned in the use expression.
The used traits all exist, but in the configuration block, some unmentioned trait is called.
Be aware that the traits used in any configuration block may originate in any use expression. PHP will check the configuration block at instantiation only, and after compiling : at that moment, it will know all the used traits across the class.
<?php
class x {
// c is not a used trait
use a, b { c::d insteadof e;}
// e is a used trait, even if is not in the use above.
use e;
}
?>
See also Traits.
1.2.1223.2. Connex PHP features¶
1.2.1223.2.1. Suggestions¶
Switch the name of the trait to an existing and used trait
Drop the expression that rely on the non-existent trait
1.2.1223.2.2. Specs¶
Short name |
Traits/TraitNotFound |
Rulesets |
|
Exakat since |
1.7.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Note |
This issue may lint but will not run |
Available in |