1.2.1252. Undefined Trait¶
Those are undefined, traits .
When the using class or trait is instantiated, PHP emits a a fatal error.
Trait which are referenced in a use expression are omitted: they are considered part of code that is probably outside the current code, either omitted or in external component.
<?php
use Composer/Component/someTrait as externalTrait;
trait t {
function foo() {}
}
// This class uses trait that are all known
class hasOnlyDefinedTrait {
use t, externalTrait;
}
// This class uses trait that are unknown
class hasUndefinedTrait {
use unknownTrait, t, externalTrait;
}
?>
1.2.1252.1. Suggestions¶
Define the missing trait
Remove usage of the missing trait
1.2.1252.2. Specs¶
Short name |
Traits/UndefinedTrait |
Rulesets |
All, Analyze, CE, CI-checks, Changed Behavior, LintButWontExec |
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Critical |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Note |
This issue may lint but will not run |
Available in |