forked from webmozarts/assert
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test argument really is a string before doing a filter_var. (webmozar…
- Loading branch information
1 parent
a3a574a
commit 8c707ac
Showing
6 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -443,6 +443,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('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), | ||
|
@@ -455,6 +456,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('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), | ||
|
@@ -470,6 +472,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('::ffff:192.0.2.1'), true), | ||
array('ipv6', array('::1'), true), | ||
array('ipv6', array('::'), true), | ||
|
@@ -482,6 +485,7 @@ public function getTests() | |
array('email', array(123), false), | ||
array('email', array('foo.com'), false), | ||
array('email', array('[email protected]'), true), | ||
array('email', array(new ToStringClass('[email protected]')), false), | ||
array('uniqueValues', array(array('qwerty', 'qwerty')), false), | ||
array('uniqueValues', array(array('asdfg', 'qwerty')), true), | ||
array('uniqueValues', array(array(123, '123')), false), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Webmozart\Assert\Tests\StaticAnalysis; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* @psalm-param mixed $value | ||
*/ | ||
function consume($value): string | ||
{ | ||
Assert::email($value); | ||
|
||
return $value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Webmozart\Assert\Tests\StaticAnalysis; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* @psalm-param mixed $value | ||
*/ | ||
function consume($value): string | ||
{ | ||
Assert::ip($value); | ||
|
||
return $value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Webmozart\Assert\Tests\StaticAnalysis; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* @psalm-param mixed $value | ||
*/ | ||
function consume($value): string | ||
{ | ||
Assert::ipv4($value); | ||
|
||
return $value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Webmozart\Assert\Tests\StaticAnalysis; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* @psalm-param mixed $value | ||
*/ | ||
function consume($value): string | ||
{ | ||
Assert::ipv6($value); | ||
|
||
return $value; | ||
} |