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`
12: * in case the user does not check the existence of the constant beforehand
13: * with `hasConstant()`.
14: */
15: final class ConstantNotFoundException extends AnalysedCodeException
16: {
17:
18: public function __construct(private string $constantName)
19: {
20: parent::__construct(sprintf('Constant %s not found.', $constantName));
21: }
22:
23: public function getConstantName(): string
24: {
25: return $this->constantName;
26: }
27:
28: public function getTip(): string
29: {
30: return 'Learn more at https://phpstan.org/user-guide/discovering-symbols';
31: }
32:
33: }
34: