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