1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Broker;
4:
5: use PHPStan\AnalysedCodeException;
6: use PHPStan\Turbo\ReferencedByTurboExtension;
7: use function sprintf;
8:
9: /**
10: * @api
11: *
12: * Unchecked exception thrown from `ReflectionProvider` and other places
13: * in case the user does not check the existence of the class beforehand
14: * with `hasClass()` or similar.
15: */
16: #[ReferencedByTurboExtension(key: 'classNotFoundException')]
17: final class ClassNotFoundException extends AnalysedCodeException
18: {
19:
20: public function __construct(private string $className)
21: {
22: parent::__construct(sprintf('Class %s was not found while trying to analyse it - discovering symbols is probably not configured properly.', $className));
23: }
24:
25: public function getClassName(): string
26: {
27: return $this->className;
28: }
29:
30: public function getTip(): string
31: {
32: return 'Learn more at https://phpstan.org/user-guide/discovering-symbols';
33: }
34:
35: }
36: