1.2.742. Multiple Usage Of Same Trait

The same trait is used several times. One trait usage is sufficient.

PHP doesn’t raise any error when traits are included multiple times.

<?php

// C is used twice, and could be dropped from B
trait A { use B, C;}
trait B { use C;}

?>

See also Traits.

1.2.742.1. Suggestions

  • Remove any multiple traits from use expressions

  • Review the class tree, and remove any trait mentioned multiple times

1.2.742.2. Specs

Short name

Traits/MultipleUsage

Rulesets

All, Changed Behavior, Suggestions

Exakat since

1.5.7

PHP Version

All

Severity

Minor

Time To Fix

Instant (5 mins)

Precision

Very high

Features

trait

Examples

NextCloud

Available in

Entreprise Edition, Exakat Cloud