Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IdnaEncoder + Ipv6: minor tweaks for Stringable support #614

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/IdnaEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class IdnaEncoder {
/**
* Encode a hostname using Punycode
*
* @param string $hostname Hostname
* @param string|Stringable $hostname Hostname
* @return string Punycode-encoded hostname
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string or a stringable object.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Ipv6.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class Ipv6 {
* @copyright 2003-2005 The PHP Group
* @license https://opensource.org/licenses/bsd-license.php
*
* @param string $ip An IPv6 address
* @param string|Stringable $ip An IPv6 address
* @return string The uncompressed IPv6 address
*
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed argument is not a string or a stringable object.
Expand Down
2 changes: 1 addition & 1 deletion tests/IdnaEncoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function dataInvalidUnicode() {
*/
public function testInvalidInputType($data) {
$this->expectException(InvalidArgument::class);
$this->expectExceptionMessage('Argument #1 ($hostname) must be of type string');
$this->expectExceptionMessage('Argument #1 ($hostname) must be of type string|Stringable');

IdnaEncoder::encode($data);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Ipv6Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function dataValidInputType() {
*/
public function testUncompressInvalidInputType($ip) {
$this->expectException(InvalidArgument::class);
$this->expectExceptionMessage('Argument #1 ($ip) must be of type string');
$this->expectExceptionMessage('Argument #1 ($ip) must be of type string|Stringable');

Ipv6::uncompress($ip);
}
Expand All @@ -100,7 +100,7 @@ public function testUncompressInvalidInputType($ip) {
*/
public function testCompressInvalidInputType($ip) {
$this->expectException(InvalidArgument::class);
$this->expectExceptionMessage('Argument #1 ($ip) must be of type string');
$this->expectExceptionMessage('Argument #1 ($ip) must be of type string|Stringable');

Ipv6::compress($ip);
}
Expand All @@ -117,7 +117,7 @@ public function testCompressInvalidInputType($ip) {
*/
public function testCheckIpv6InvalidInputType($ip) {
$this->expectException(InvalidArgument::class);
$this->expectExceptionMessage('Argument #1 ($ip) must be of type string');
$this->expectExceptionMessage('Argument #1 ($ip) must be of type string|Stringable');

Ipv6::check_ipv6($ip);
}
Expand Down