{"record":{"id":"65ddf9824339639f","repo":"pestphp/pest","slug":"the-class-or-trait-s-could-not-be-found-please","errorCode":null,"errorMessage":"The class or trait [%s] could not be found. Please check the name, and make sure it is autoloadable.","messagePattern":"The class or trait \\[(.+?)\\] could not be found\\. Please check the name, and make sure it is autoloadable\\.","errorType":"exception","errorClass":"TestCaseClassOrTraitNotFound","httpStatus":null,"severity":"error","filePath":"src/Repositories/TestRepository.php","lineNumber":72,"sourceCode":"        return array_values(array_map(static fn (TestCaseFactory $factory): string => $factory->filename, $this->testCases));\n    }\n\n    /**\n     * @param  array<int, string>  $classOrTraits\n     * @param  array<int, string>  $groups\n     * @param  array<int, string>  $paths\n     * @param  array<int, Closure>  $hooks\n     */\n    public function use(array $classOrTraits, array $groups, array $paths, array $hooks): void\n    {\n        foreach ($classOrTraits as $classOrTrait) {\n            if (class_exists($classOrTrait)) {\n                continue;\n            }\n            if (trait_exists($classOrTrait)) {\n                continue;\n            }\n            throw new TestCaseClassOrTraitNotFound($classOrTrait);\n        }\n\n        $hooks = array_map(fn (Closure $hook): array => [$hook], $hooks);\n\n        foreach ($paths as $path) {\n            if (array_key_exists($path, $this->uses)) {\n                $this->uses[$path] = [\n                    [...$this->uses[$path][0], ...$classOrTraits],\n                    [...$this->uses[$path][1], ...$groups],\n                    array_map(\n                        fn (int $index): array => [...$this->uses[$path][2][$index] ?? [], ...($hooks[$index] ?? [])],\n                        range(0, 3),\n                    ),\n                ];\n            } else {\n                $this->uses[$path] = [$classOrTraits, $groups, $hooks];\n            }\n        }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/pestphp/pest/blob/1af74a215c3a89bc7a44fc6f9322e369eaad2423/src/Repositories/TestRepository.php#L54-L90","documentation":"Error \"The class or trait [%s] could not be found. Please check the name, and make sure it is autoloadable.\" thrown in pestphp/pest.","triggerScenarios":"Thrown at src/Repositories/TestRepository.php:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1af74a215c3a89bc7a44fc6f9322e369eaad2423","analyzedAt":"2026-08-21T02:16:38.132Z","schemaVersion":2},"datasetVersion":"2026-08-21T03:17:12.404Z"}