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     protected function createApplication()

    {

        $applicationResolver = static::$applicationResolver ?: function () {

            if (trait_exists(\Tests\CreatesApplication::class)) {

                $applicationCreator = new class

                {

                    use \Tests\CreatesApplication;
<?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;

                    }

                }
<?php         if (isset($a[$prefix.'returnType'])) {

            $v = $a[$prefix.'returnType'];

            $v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;

            $a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType'] instanceof \ReflectionNamedType && $a[$prefix.'returnType']->allowsNull() && 'mixed' !== $v ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);

        }

        if (isset($a[$prefix.'class'])) {

            $a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
<?php         if (isset($a[$prefix.'typeHint'])) {

            $v = $a[$prefix.'typeHint'];

            $a[$prefix.'typeHint'] = new ClassStub($v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);

        } else {

            unset($a[$prefix.'allowsNull']);

        }