1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | namespace PHPStan\BetterReflection\SourceLocator\Exception; |
6: | |
7: | use RuntimeException; |
8: | |
9: | use function is_file; |
10: | use function sprintf; |
11: | |
12: | class InvalidDirectory extends RuntimeException |
13: | { |
14: | public static function fromNonDirectory(string $nonDirectory): self |
15: | { |
16: | if (is_file($nonDirectory)) { |
17: | return new self(sprintf('"%s" must be a directory, not a file', $nonDirectory)); |
18: | } |
19: | |
20: | return new self(sprintf('"%s" does not exist', $nonDirectory)); |
21: | } |
22: | } |
23: | |