Skip to content

Commit

Permalink
Merge pull request #614 from WordPress/feature/idnaencode-ipv6-tweaks…
Browse files Browse the repository at this point in the history
…-for-stringable-support
  • Loading branch information
schlessera authored Nov 15, 2021
2 parents bc50fe9 + fcb4913 commit 3a6d438
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
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

0 comments on commit 3a6d438

Please sign in to comment.