composer update

This commit is contained in:
Oliver Davies 2019-01-24 08:00:03 +00:00
parent f6abc3dce2
commit 71dfaca858
1753 changed files with 45274 additions and 14619 deletions

View file

@ -1,7 +0,0 @@
{
"github-oauth": {
"github.com": "PLEASE DO NOT USE THIS TOKEN IN YOUR OWN PROJECTS/FORKS",
"github.com": "This token is reserved for testing the webmozart/* repositories",
"github.com": "a9debbffdd953ee9b3b82dbc3b807cde2086bb86"
}
}

View file

@ -1,11 +0,0 @@
preset: symfony
finder:
exclude:
- "tests"
enabled:
- ordered_use
disabled:
- phpdoc_annotation_without_dot # This is still buggy: https://github.com/symfony/symfony/pull/19198

View file

@ -3,6 +3,25 @@ Changelog
## UNRELEASED
## 1.4.0 (2018-12-25)
### Added
* added `Assert::ip()`
* added `Assert::ipv4()`
* added `Assert::ipv6()`
* added `Assert::notRegex()`
* added `Assert::interfaceExists()`
* added `Assert::isList()`
* added `Assert::isMap()`
* added polyfill for ctype
### Fixed
* Special case when comparing objects implementing `__toString()`
## 1.3.0 (2018-01-29)
### Added
* added `Assert::minCount()`
@ -20,6 +39,10 @@ Changelog
* `stringNotEmpty` will no longer report "0" is an empty string
### Deprecation
* deprecated `Assert::isTraversable()` in favor of `Assert::isIterable()`
## 1.2.0 (2016-11-23)
* added `Assert::throws()`

View file

@ -5,7 +5,6 @@ Webmozart Assert
[![Build status](https://ci.appveyor.com/api/projects/status/lyg83bcsisrr94se/branch/master?svg=true)](https://ci.appveyor.com/project/webmozart/assert/branch/master)
[![Latest Stable Version](https://poser.pugx.org/webmozart/assert/v/stable.svg)](https://packagist.org/packages/webmozart/assert)
[![Total Downloads](https://poser.pugx.org/webmozart/assert/downloads.svg)](https://packagist.org/packages/webmozart/assert)
[![Dependency Status](https://www.versioneye.com/php/webmozart:assert/1.2.0/badge.svg)](https://www.versioneye.com/php/webmozart:assert/1.2.0)
Latest release: [1.2.0](https://packagist.org/packages/webmozart/assert#1.2.0)
@ -146,6 +145,7 @@ Method | Description
`startsWithLetter($value, $message = '')` | Check that a string starts with a letter
`endsWith($value, $suffix, $message = '')` | Check that a string has a suffix
`regex($value, $pattern, $message = '')` | Check that a string matches a regular expression
`notRegex($value, $pattern, $message = '')` | Check that a string does not match a regular expression
`alpha($value, $message = '')` | Check that a string contains letters only
`digits($value, $message = '')` | Check that a string contains digits only
`alnum($value, $message = '')` | Check that a string contains letters and digits only
@ -156,6 +156,9 @@ Method | Description
`maxLength($value, $max, $message = '')` | Check that a string has at most a certain number of characters
`lengthBetween($value, $min, $max, $message = '')` | Check that a string has a length in the given range
`uuid($value, $message = '')` | Check that a string is a valid UUID
`ip($value, $message = '')` | Check that a string is a valid IP (either IPv4 or IPv6)
`ipv4($value, $message = '')` | Check that a string is a valid IPv4
`ipv6($value, $message = '')` | Check that a string is a valid IPv6
`notWhitespaceOnly($value, $message = '')` | Check that a string contains at least one non-whitespace character
### File Assertions
@ -174,6 +177,7 @@ Method | Description
----------------------------------------------------- | --------------------------------------------------
`classExists($value, $message = '')` | Check that a value is an existing class name
`subclassOf($value, $class, $message = '')` | Check that a class is a subclass of another
`interfaceExists($value, $message = '')` | Check that a value is an existing interface name
`implementsInterface($value, $class, $message = '')` | Check that a class implements an interface
`propertyExists($value, $property, $message = '')` | Check that a property exists in a class/object
`propertyNotExists($value, $property, $message = '')` | Check that a property does not exist in a class/object
@ -190,6 +194,8 @@ Method | Description
`minCount($array, $min, $message = '')` | Check that an array contains at least a certain number of elements
`maxCount($array, $max, $message = '')` | Check that an array contains at most a certain number of elements
`countBetween($array, $min, $max, $message = '')` | Check that an array has a count in the given range
`isList($array, $message = '')` | Check that an array is a non-associative list
`isMap($array, $message = '')` | Check that an array is associative and has strings as keys
### Function Assertions

View file

@ -1,7 +1,11 @@
{
"name": "webmozart/assert",
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": ["assert", "check", "validate"],
"keywords": [
"assert",
"check",
"validate"
],
"license": "MIT",
"authors": [
{
@ -10,12 +14,18 @@
}
],
"require": {
"php": "^5.3.3 || ^7.0"
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
@ -25,10 +35,5 @@
"psr-4": {
"Webmozart\\Assert\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
}
}

View file

@ -29,6 +29,7 @@ use Traversable;
* @method static void nullOrIntegerish($value, $message = '')
* @method static void nullOrFloat($value, $message = '')
* @method static void nullOrNumeric($value, $message = '')
* @method static void nullOrNatural($value, $message = '')
* @method static void nullOrBoolean($value, $message = '')
* @method static void nullOrScalar($value, $message = '')
* @method static void nullOrObject($value, $message = '')
@ -38,6 +39,7 @@ use Traversable;
* @method static void nullOrIsTraversable($value, $message = '')
* @method static void nullOrIsArrayAccessible($value, $message = '')
* @method static void nullOrIsCountable($value, $message = '')
* @method static void nullOrIsIterable($value, $message = '')
* @method static void nullOrIsInstanceOf($value, $class, $message = '')
* @method static void nullOrNotInstanceOf($value, $class, $message = '')
* @method static void nullOrIsInstanceOfAny($value, $classes, $message = '')
@ -45,6 +47,9 @@ use Traversable;
* @method static void nullOrNotEmpty($value, $message = '')
* @method static void nullOrTrue($value, $message = '')
* @method static void nullOrFalse($value, $message = '')
* @method static void nullOrIp($value, $message = '')
* @method static void nullOrIpv4($value, $message = '')
* @method static void nullOrIpv6($value, $message = '')
* @method static void nullOrEq($value, $value2, $message = '')
* @method static void nullOrNotEq($value,$value2, $message = '')
* @method static void nullOrSame($value, $value2, $message = '')
@ -62,6 +67,7 @@ use Traversable;
* @method static void nullOrStartsWithLetter($value, $message = '')
* @method static void nullOrEndsWith($value, $suffix, $message = '')
* @method static void nullOrRegex($value, $pattern, $message = '')
* @method static void nullOrNotRegex($value, $pattern, $message = '')
* @method static void nullOrAlpha($value, $message = '')
* @method static void nullOrDigits($value, $message = '')
* @method static void nullOrAlnum($value, $message = '')
@ -78,6 +84,7 @@ use Traversable;
* @method static void nullOrWritable($value, $message = '')
* @method static void nullOrClassExists($value, $message = '')
* @method static void nullOrSubclassOf($value, $class, $message = '')
* @method static void nullOrInterfaceExists($value, $message = '')
* @method static void nullOrImplementsInterface($value, $interface, $message = '')
* @method static void nullOrPropertyExists($value, $property, $message = '')
* @method static void nullOrPropertyNotExists($value, $property, $message = '')
@ -88,14 +95,18 @@ use Traversable;
* @method static void nullOrCount($value, $key, $message = '')
* @method static void nullOrMinCount($value, $min, $message = '')
* @method static void nullOrMaxCount($value, $max, $message = '')
* @method static void nullCountBetween($value, $min, $max, $message = '')
* @method static void nullOrIsList($value, $message = '')
* @method static void nullOrIsMap($value, $message = '')
* @method static void nullOrCountBetween($value, $min, $max, $message = '')
* @method static void nullOrUuid($values, $message = '')
* @method static void nullOrThrows($expression, $class = 'Exception', $message = '')
* @method static void allString($values, $message = '')
* @method static void allStringNotEmpty($values, $message = '')
* @method static void allInteger($values, $message = '')
* @method static void allIntegerish($values, $message = '')
* @method static void allFloat($values, $message = '')
* @method static void allNumeric($values, $message = '')
* @method static void allNatural($values, $message = '')
* @method static void allBoolean($values, $message = '')
* @method static void allScalar($values, $message = '')
* @method static void allObject($values, $message = '')
@ -105,6 +116,7 @@ use Traversable;
* @method static void allIsTraversable($values, $message = '')
* @method static void allIsArrayAccessible($values, $message = '')
* @method static void allIsCountable($values, $message = '')
* @method static void allIsIterable($values, $message = '')
* @method static void allIsInstanceOf($values, $class, $message = '')
* @method static void allNotInstanceOf($values, $class, $message = '')
* @method static void allIsInstanceOfAny($values, $classes, $message = '')
@ -114,6 +126,9 @@ use Traversable;
* @method static void allNotEmpty($values, $message = '')
* @method static void allTrue($values, $message = '')
* @method static void allFalse($values, $message = '')
* @method static void allIp($values, $message = '')
* @method static void allIpv4($values, $message = '')
* @method static void allIpv6($values, $message = '')
* @method static void allEq($values, $value2, $message = '')
* @method static void allNotEq($values,$value2, $message = '')
* @method static void allSame($values, $value2, $message = '')
@ -131,6 +146,7 @@ use Traversable;
* @method static void allStartsWithLetter($values, $message = '')
* @method static void allEndsWith($values, $suffix, $message = '')
* @method static void allRegex($values, $pattern, $message = '')
* @method static void allNotRegex($values, $pattern, $message = '')
* @method static void allAlpha($values, $message = '')
* @method static void allDigits($values, $message = '')
* @method static void allAlnum($values, $message = '')
@ -147,6 +163,7 @@ use Traversable;
* @method static void allWritable($values, $message = '')
* @method static void allClassExists($values, $message = '')
* @method static void allSubclassOf($values, $class, $message = '')
* @method static void allInterfaceExists($values, $message = '')
* @method static void allImplementsInterface($values, $interface, $message = '')
* @method static void allPropertyExists($values, $property, $message = '')
* @method static void allPropertyNotExists($values, $property, $message = '')
@ -158,7 +175,10 @@ use Traversable;
* @method static void allMinCount($values, $min, $message = '')
* @method static void allMaxCount($values, $max, $message = '')
* @method static void allCountBetween($values, $min, $max, $message = '')
* @method static void allIsList($values, $message = '')
* @method static void allIsMap($values, $message = '')
* @method static void allUuid($values, $message = '')
* @method static void allThrows($expressions, $class = 'Exception', $message = '')
*
* @since 1.0
*
@ -444,6 +464,36 @@ class Assert
}
}
public static function ip($value, $message = '')
{
if (false === filter_var($value, FILTER_VALIDATE_IP)) {
static::reportInvalidArgument(sprintf(
$message ?: 'Expected a value to be an IP. Got: %s',
static::valueToString($value)
));
}
}
public static function ipv4($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',
static::valueToString($value)
));
}
}
public static function ipv6($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',
static::valueToString($value)
));
}
}
public static function eq($value, $value2, $message = '')
{
if ($value2 != $value) {
@ -636,6 +686,18 @@ class Assert
}
}
public static function notRegex($value, $pattern, $message = '')
{
if (preg_match($pattern, $value, $matches, PREG_OFFSET_CAPTURE)) {
static::reportInvalidArgument(sprintf(
$message ?: 'The value %s matches the pattern %s (at offset %d).',
static::valueToString($value),
static::valueToString($pattern),
$matches[0][1]
));
}
}
public static function alpha($value, $message = '')
{
$locale = setlocale(LC_CTYPE, 0);
@ -835,6 +897,16 @@ class Assert
}
}
public static function interfaceExists($value, $message = '')
{
if (!interface_exists($value)) {
static::reportInvalidArgument(sprintf(
$message ?: 'Expected an existing interface name. got %s',
static::valueToString($value)
));
}
}
public static function implementsInterface($value, $interface, $message = '')
{
if (!in_array($interface, class_implements($value))) {
@ -888,7 +960,7 @@ class Assert
public static function keyExists($array, $key, $message = '')
{
if (!array_key_exists($key, $array)) {
if (!(isset($array[$key]) || array_key_exists($key, $array))) {
static::reportInvalidArgument(sprintf(
$message ?: 'Expected the key %s to exist.',
static::valueToString($key)
@ -898,7 +970,7 @@ class Assert
public static function keyNotExists($array, $key, $message = '')
{
if (array_key_exists($key, $array)) {
if (isset($array[$key]) || array_key_exists($key, $array)) {
static::reportInvalidArgument(sprintf(
$message ?: 'Expected the key %s to not exist.',
static::valueToString($key)
@ -951,6 +1023,30 @@ class Assert
}
}
public static function isList($array, $message = '')
{
if (!is_array($array) || !$array || array_keys($array) !== range(0, count($array) - 1)) {
static::reportInvalidArgument(
$message ?: 'Expected list - non-associative array.'
);
}
}
public static function isMap($array, $message = '')
{
if (
!is_array($array) ||
!$array ||
array_keys($array) !== array_filter(array_keys($array), function ($key) {
return is_string($key);
})
) {
static::reportInvalidArgument(
$message ?: 'Expected map - associative array with string keys.'
);
}
}
public static function uuid($value, $message = '')
{
$value = str_replace(array('urn:', 'uuid:', '{', '}'), '', $value);
@ -1044,6 +1140,10 @@ class Assert
}
if (is_object($value)) {
if (method_exists($value, '__toString')) {
return get_class($value).': '.self::valueToString($value->__toString());
}
return get_class($value);
}