trait_exists

Supported Versions: PHP 5 >= 5.4.0, PHP 7, PHP 8
Checks if the trait exists
<?php trait_exists(string $trait, bool $autoload = true): bool
<?php     public function covers(string ...$classesOrFunctions): self

    {

        foreach ($classesOrFunctions as $classOrFunction) {

            $isClass = class_exists($classOrFunction) || trait_exists($classOrFunction);

            $isMethod = function_exists($classOrFunction);



            if (! $isClass && ! $isMethod) {
<?php             if (class_exists($classOrTrait)) {

                continue;

            }

            if (trait_exists($classOrTrait)) {

                continue;

            }

            throw new TestCaseClassOrTraitNotFound($classOrTrait);
<?php                             throw new TestCaseAlreadyInUse($testCase->class, $class, $testCase->filename);

                        }

                        $testCase->class = $class;

                    } elseif (trait_exists($class)) {

                        $testCase->traits[] = $class;

                    }

                }