update 1.0.8.0

Commits for version update
This commit is contained in:
Manish Verma
2016-10-17 12:02:27 +05:30
parent dec927987b
commit 76e85db070
9674 changed files with 495757 additions and 58922 deletions

View File

@@ -2,8 +2,8 @@
namespace Illuminate\Validation;
use Illuminate\Contracts\Validation\ValidationException;
use Illuminate\Contracts\Validation\UnauthorizedException;
use Illuminate\Contracts\Validation\ValidationException as ValidationExceptionContract;
/**
* Provides default implementation of ValidatesWhenResolved contract.
@@ -46,7 +46,7 @@ trait ValidatesWhenResolvedTrait
*/
protected function failedValidation(Validator $validator)
{
throw new ValidationException($validator);
throw new ValidationExceptionContract($validator);
}
/**

View File

@@ -498,7 +498,9 @@ class Validator implements ValidatorContract
$this->passes();
}
return array_diff_key($this->data, $this->messages()->toArray());
return array_diff_key(
$this->data, $this->attributesThatHaveMessages()
);
}
/**
@@ -512,7 +514,25 @@ class Validator implements ValidatorContract
$this->passes();
}
return array_intersect_key($this->data, $this->messages()->toArray());
return array_intersect_key(
$this->data, $this->attributesThatHaveMessages()
);
}
/**
* Generate an array of all attributes that have messages.
*
* @return array
*/
protected function attributesThatHaveMessages()
{
$results = [];
foreach ($this->messages()->toArray() as $key => $message) {
$results[] = explode('.', $key)[0];
}
return array_flip(array_unique($results));
}
/**
@@ -1221,6 +1241,12 @@ class Validator implements ValidatorContract
protected function validateIn($attribute, $value, $parameters)
{
if (is_array($value) && $this->hasRule($attribute, 'Array')) {
foreach ($value as $element) {
if (is_array($element)) {
return false;
}
}
return count(array_diff($value, $parameters)) == 0;
}
@@ -1296,6 +1322,10 @@ class Validator implements ValidatorContract
if (strtolower($id) == 'null') {
$id = null;
}
if (filter_var($id, FILTER_VALIDATE_INT) !== false) {
$id = intval($id);
}
}
// The presence verifier is responsible for counting rows within this store
@@ -1504,7 +1534,7 @@ class Validator implements ValidatorContract
(/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment
$~ixu';
return preg_match($pattern, $value) === 1;
return preg_match($pattern, $value) > 0;
}
/**
@@ -1561,7 +1591,7 @@ class Validator implements ValidatorContract
*/
protected function validateDimensions($attribute, $value, $parameters)
{
if (! $sizeDetails = getimagesize($value->getRealPath())) {
if (! $this->isAValidFileInstance($value) || ! $sizeDetails = getimagesize($value->getRealPath())) {
return false;
}
@@ -1665,7 +1695,7 @@ class Validator implements ValidatorContract
return false;
}
return preg_match('/^[\pL\pM\pN]+$/u', $value);
return preg_match('/^[\pL\pM\pN]+$/u', $value) > 0;
}
/**
@@ -1681,7 +1711,7 @@ class Validator implements ValidatorContract
return false;
}
return preg_match('/^[\pL\pM\pN_-]+$/u', $value);
return preg_match('/^[\pL\pM\pN_-]+$/u', $value) > 0;
}
/**
@@ -1700,7 +1730,7 @@ class Validator implements ValidatorContract
$this->requireParameterCount(1, $parameters, 'regex');
return preg_match($parameters[0], $value);
return preg_match($parameters[0], $value) > 0;
}
/**
@@ -2073,8 +2103,8 @@ class Validator implements ValidatorContract
$value = $this->getAttribute($attribute);
$message = str_replace(
[':ATTRIBUTE', ':Attribute', ':attribute'],
[Str::upper($value), Str::ucfirst($value), $value],
[':attribute', ':ATTRIBUTE', ':Attribute'],
[$value, Str::upper($value), Str::ucfirst($value)],
$message
);

View File

@@ -10,7 +10,7 @@
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
"email": "taylor@laravel.com"
}
],
"require": {