Skip to content

Commit e8a6d4f

Browse files
committed
ext/uri: switched catch to throwable
1 parent e3d68a9 commit e8a6d4f

18 files changed

Lines changed: 54 additions & 54 deletions

ext/uri/tests/004.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var_dump(Uri\Rfc3986\Uri::parse(""));
88

99
try {
1010
new Uri\WhatWg\Url("");
11-
} catch (Uri\WhatWg\InvalidUrlException $e) {
11+
} catch (Throwable $e) {
1212
echo $e::class, ': ', $e->getMessage(), "\n";
1313
}
1414

ext/uri/tests/007.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ Test URI creation errors
55

66
try {
77
new Uri\Rfc3986\Uri("https://example.com:8080@username:password/path?q=r#fragment");
8-
} catch (Uri\InvalidUriException $e) {
8+
} catch (Throwable $e) {
99
echo $e::class, ': ', $e->getMessage(), "\n";
1010
}
1111

1212
try {
1313
new Uri\WhatWg\Url("https://example.com:8080@username:password/path?q=r#fragment");
14-
} catch (Uri\WhatWg\InvalidUrlException $e) {
14+
} catch (Throwable $e) {
1515
echo $e::class, ': ', $e->getMessage(), "\n";
1616
var_dump($e->errors);
1717
}

ext/uri/tests/015.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ uri
99
try {
1010
$reflectionClass = new ReflectionClass(Uri\Rfc3986\Uri::class);
1111
$reflectionClass->newInstanceWithoutConstructor();
12-
} catch (ReflectionException $e) {
12+
} catch (Throwable $e) {
1313
echo $e::class, ': ', $e->getMessage(), "\n";
1414
}
1515

1616
try {
1717
$reflectionClass = new ReflectionClass(Uri\WhatWg\Url::class);
1818
$reflectionClass->newInstanceWithoutConstructor();
19-
} catch (ReflectionException $e) {
19+
} catch (Throwable $e) {
2020
echo $e::class, ': ', $e->getMessage(), "\n";
2121
}
2222

ext/uri/tests/023.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ var_dump($uri3->getScheme());
1717

1818
try {
1919
$uri3->withScheme("");
20-
} catch (Uri\InvalidUriException $e) {
20+
} catch (Throwable $e) {
2121
echo $e::class, ': ', $e->getMessage(), "\n";
2222
}
2323

2424
try {
2525
$uri3->withScheme("http%73");
26-
} catch (Uri\InvalidUriException $e) {
26+
} catch (Throwable $e) {
2727
echo $e::class, ': ', $e->getMessage(), "\n";
2828
}
2929

@@ -35,13 +35,13 @@ var_dump($url2->getScheme());
3535

3636
try {
3737
$url2->withScheme("");
38-
} catch (Uri\WhatWg\InvalidUrlException $e) {
38+
} catch (Throwable $e) {
3939
echo $e::class, ': ', $e->getMessage(), "\n";
4040
}
4141

4242
try {
4343
$url2->withScheme("http%73");
44-
} catch (Uri\WhatWg\InvalidUrlException $e) {
44+
} catch (Throwable $e) {
4545
echo $e::class, ': ', $e->getMessage(), "\n";
4646
}
4747

ext/uri/tests/026.phpt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ var_dump($uri6->getHost());
2929

3030
try {
3131
$uri3->withHost("test.com:8080");
32-
} catch (Uri\InvalidUriException $e) {
32+
} catch (Throwable $e) {
3333
echo $e::class, ': ', $e->getMessage(), "\n";
3434
}
3535

3636
try {
3737
$uri3->withHost("t%3As%2Ft.com"); // t:s/t.com
38-
} catch (Uri\InvalidUriException $e) {
38+
} catch (Throwable $e) {
3939
echo $e::class, ': ', $e->getMessage(), "\n";
4040
}
4141

4242
try {
4343
$uri3->withHost("t:s/t.com");
44-
} catch (Uri\InvalidUriException $e) {
44+
} catch (Throwable $e) {
4545
echo $e::class, ': ', $e->getMessage(), "\n";
4646
}
4747

4848
try {
4949
$uri2->withHost("");
50-
} catch (Uri\InvalidUriException $e) {
50+
} catch (Throwable $e) {
5151
echo $e::class, ': ', $e->getMessage(), "\n";
5252
}
5353

@@ -59,7 +59,7 @@ var_dump($uri2->getHost());
5959

6060
try {
6161
$uri1->withHost(null);
62-
} catch (Uri\InvalidUriException $e) {
62+
} catch (Throwable $e) {
6363
echo $e::class, ': ', $e->getMessage(), "\n";
6464
}
6565

@@ -77,25 +77,25 @@ var_dump($url5->getAsciiHost());
7777

7878
try {
7979
$url3->withHost("test.com:8080");
80-
} catch (Uri\WhatWg\InvalidUrlException $e) {
80+
} catch (Throwable $e) {
8181
echo $e::class, ': ', $e->getMessage(), "\n";
8282
}
8383

8484
try {
8585
$url3->withHost("t%3As%2Ft.com"); // t:s/t.com
86-
} catch (Uri\WhatWg\InvalidUrlException $e) {
86+
} catch (Throwable $e) {
8787
echo $e::class, ': ', $e->getMessage(), "\n";
8888
}
8989

9090
try {
9191
$url3->withHost("t:s/t.com"); // t:s/t.com
92-
} catch (Uri\WhatWg\InvalidUrlException $e) {
92+
} catch (Throwable $e) {
9393
echo $e::class, ': ', $e->getMessage(), "\n";
9494
}
9595

9696
try {
9797
$url2->withHost(null);
98-
} catch (Uri\WhatWg\InvalidUrlException $e) {
98+
} catch (Throwable $e) {
9999
echo $e::class, ': ', $e->getMessage(), "\n";
100100
}
101101

ext/uri/tests/026_userinfo.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var_dump($uri2->getPort());
2525

2626
try {
2727
$uri4->withUserInfo("u:s/r");
28-
} catch (Uri\InvalidUriException $e) {
28+
} catch (Throwable $e) {
2929
echo $e::class, ': ', $e->getMessage(), "\n";
3030
}
3131

ext/uri/tests/027.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var_dump($uri2->getPort());
2929

3030
try {
3131
$uri1->withPort(1);
32-
} catch (Uri\InvalidUriException $e) {
32+
} catch (Throwable $e) {
3333
echo $e::class, ': ', $e->getMessage(), "\n";
3434
}
3535

ext/uri/tests/028.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ var_dump($uri5->getPath());
2525

2626
try {
2727
$uri5->withPath("test");
28-
} catch (Uri\InvalidUriException $e) {
28+
} catch (Throwable $e) {
2929
echo $e::class, ': ', $e->getMessage(), "\n";
3030
}
3131

3232
try {
3333
$uri5->withPath("/#");
34-
} catch (Uri\InvalidUriException $e) {
34+
} catch (Throwable $e) {
3535
echo $e::class, ': ', $e->getMessage(), "\n";
3636
}
3737

ext/uri/tests/029.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var_dump($uri5->getQuery());
3737

3838
try {
3939
$uri5->withQuery("#");
40-
} catch (Uri\InvalidUriException $e) {
40+
} catch (Throwable $e) {
4141
echo $e::class, ': ', $e->getMessage(), "\n";
4242
}
4343

ext/uri/tests/030.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ var_dump($uri3->getFragment());
1717

1818
try {
1919
$uri3->withFragment(" ");
20-
} catch (Uri\InvalidUriException $e) {
20+
} catch (Throwable $e) {
2121
echo $e::class, ': ', $e->getMessage(), "\n";
2222
}
2323

2424
try {
2525
$uri1->withFragment("#fragment2");
26-
} catch (Uri\InvalidUriException $e) {
26+
} catch (Throwable $e) {
2727
echo $e::class, ': ', $e->getMessage(), "\n";
2828
}
2929

0 commit comments

Comments
 (0)