class_uses_recursive

The class_uses_recursive function returns all traits used by a class, including traits used by all of its parent classes:
<?php $traits = class_uses_recursive(App\Models\User::class);
<?php         parent::setUp();



        $uses = array_flip(class_uses_recursive(static::class));



        if (isset($uses[PreventSavingStacheItemsToDisk::class])) {

            $this->preventSavingStacheItemsToDisk();
<?php     public function tearDown(): void

    {

        $uses = array_flip(class_uses_recursive(static::class));



        if (isset($uses[PreventSavingStacheItemsToDisk::class])) {

            $this->deleteFakeStacheDirectory();