diff --git a/src/Assert.php b/src/Assert.php index d32366d9..b4027793 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -699,7 +699,6 @@ public static function false($value, $message = '') */ public static function ip($value, $message = '') { - static::string($value, $message); if (false === \filter_var($value, \FILTER_VALIDATE_IP)) { static::reportInvalidArgument(\sprintf( $message ?: 'Expected a value to be an IP. Got: %s', @@ -716,7 +715,6 @@ public static function ip($value, $message = '') */ public static function ipv4($value, $message = '') { - static::string($value, $message); if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) { static::reportInvalidArgument(\sprintf( $message ?: 'Expected a value to be an IPv4. Got: %s', @@ -733,7 +731,6 @@ public static function ipv4($value, $message = '') */ public static function ipv6($value, $message = '') { - static::string($value, $message); if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) { static::reportInvalidArgument(\sprintf( $message ?: 'Expected a value to be an IPv6. Got %s', @@ -750,7 +747,6 @@ public static function ipv6($value, $message = '') */ public static function email($value, $message = '') { - static::string($value, $message); if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) { static::reportInvalidArgument(\sprintf( $message ?: 'Expected a value to be a valid e-mail address. Got %s', diff --git a/tests/AssertTest.php b/tests/AssertTest.php index 4b22723b..a5b714c1 100644 --- a/tests/AssertTest.php +++ b/tests/AssertTest.php @@ -459,7 +459,7 @@ public function getTests() array('throws', array(function() { trigger_error('test'); }, 'Unthrowable'), false, false, 70000), array('throws', array(function() { throw new Error(); }, 'Throwable'), true, true, 70000), array('ip', array('192.168.0.1'), true), - array('ip', array(new ToStringClass('192.168.0.1')), false), + array('ip', array(new ToStringClass('192.168.0.1')), true), array('ip', array('255.255.255.255'), true), array('ip', array('0.0.0.0'), true), array('ip', array('2001:0db8:0000:0042:0000:8a2e:0370:7334'), true), @@ -472,7 +472,7 @@ public function getTests() array('ip', array(null), false), array('ip', array(false), false), array('ipv4', array('192.168.0.1'), true), - array('ipv4', array(new ToStringClass('192.168.0.1')), false), + array('ipv4', array(new ToStringClass('192.168.0.1')), true), array('ipv4', array('255.255.255.255'), true), array('ipv4', array('0.0.0.0'), true), array('ipv4', array('2001:0db8:0000:0042:0000:8a2e:0370:7334'), false), @@ -488,7 +488,7 @@ public function getTests() array('ipv6', array('255.255.255.255'), false), array('ipv6', array('0.0.0.0'), false), array('ipv6', array('2001:0db8:0000:0042:0000:8a2e:0370:7334'), true), - array('ipv6', array(new ToStringClass('2001:0db8:0000:0042:0000:8a2e:0370:7334')), false), + array('ipv6', array(new ToStringClass('2001:0db8:0000:0042:0000:8a2e:0370:7334')), true), array('ipv6', array('::ffff:192.0.2.1'), true), array('ipv6', array('::1'), true), array('ipv6', array('::'), true), @@ -501,7 +501,7 @@ public function getTests() array('email', array(123), false), array('email', array('foo.com'), false), array('email', array('foo@bar.com'), true), - array('email', array(new ToStringClass('foo@bar.com')), false), + array('email', array(new ToStringClass('foo@bar.com')), true), array('uniqueValues', array(array('qwerty', 'qwerty')), false), array('uniqueValues', array(array('asdfg', 'qwerty')), true), array('uniqueValues', array(array(123, '123')), false),