Skip to content

Commit bad6ef1

Browse files
committed
Use InvalidArgumentException instead of RuntimeException
1 parent 3ff0d05 commit bad6ef1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Comment.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public static function parse(string $json, bool $assoc = false, int $depth = 512
205205
public static function parseFromFile(string $file, bool $assoc = false, int $depth = 512, int $options = 0)
206206
{
207207
if (!is_file($file)) {
208-
throw new \RuntimeException($file . ' does not exist or is not a file');
208+
throw new \InvalidArgumentException($file . ' does not exist or is not a file');
209209
}
210210

211211
$json = \file_get_contents($file);

tests/CommentTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ public function testParseFromFileThrowsNotExists()
7272
{
7373
$file = 'does-not-exist.json';
7474

75-
$this->expectException(\RuntimeException::class);
75+
$this->expectException(\InvalidArgumentException::class);
7676
$this->expectExceptionMessage($file . ' does not exist or is not a file');
7777

7878
Comment::parseFromFile($file, true);
7979
}
8080

8181
public function testParseFromFileThrowsNotFile()
8282
{
83-
$this->expectException(\RuntimeException::class);
83+
$this->expectException(\InvalidArgumentException::class);
8484
$this->expectExceptionMessage(__DIR__ . ' does not exist or is not a file');
8585

8686
Comment::parseFromFile(__DIR__, true);

0 commit comments

Comments
 (0)