mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-03 12:17:48 +08:00
Fixed devtool config.
This commit is contained in:
parent
6f7fe2fbbc
commit
77b7549186
@ -38,8 +38,11 @@ return [
|
||||
'middleware' => [
|
||||
'namespace' => 'App\\Middleware',
|
||||
],
|
||||
'Process' => [
|
||||
'process' => [
|
||||
'namespace' => 'App\\Process',
|
||||
],
|
||||
'request' => [
|
||||
'namespace' => 'App\\Request',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
@ -33,6 +33,6 @@ class RequestCommand extends GeneratorCommand
|
||||
|
||||
protected function getDefaultNamespace(): string
|
||||
{
|
||||
return $this->getConfig()['namespace'] ?? 'App\\Requests';
|
||||
return $this->getConfig()['namespace'] ?? 'App\\Request';
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ class Rule
|
||||
/**
|
||||
* Get a dimensions constraint builder instance.
|
||||
*
|
||||
* @param array $constraints
|
||||
* @return \Hyperf\Validation\Rules\Dimensions
|
||||
*/
|
||||
public static function dimensions(array $constraints = [])
|
||||
@ -33,8 +32,6 @@ class Rule
|
||||
/**
|
||||
* Get a exists constraint builder instance.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $column
|
||||
* @return \Hyperf\Validation\Rules\Exists
|
||||
*/
|
||||
public static function exists(string $table, string $column = 'NULL')
|
||||
|
@ -46,9 +46,6 @@ trait DatabaseRule
|
||||
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $column
|
||||
*/
|
||||
public function __construct(string $table, string $column = 'NULL')
|
||||
{
|
||||
@ -81,7 +78,6 @@ trait DatabaseRule
|
||||
/**
|
||||
* Set a "where not" constraint on the query.
|
||||
*
|
||||
* @param string $column
|
||||
* @param array|string $value
|
||||
* @return $this
|
||||
*/
|
||||
@ -97,7 +93,6 @@ trait DatabaseRule
|
||||
/**
|
||||
* Set a "where null" constraint on the query.
|
||||
*
|
||||
* @param string $column
|
||||
* @return $this
|
||||
*/
|
||||
public function whereNull(string $column)
|
||||
@ -108,7 +103,6 @@ trait DatabaseRule
|
||||
/**
|
||||
* Set a "where not null" constraint on the query.
|
||||
*
|
||||
* @param string $column
|
||||
* @return $this
|
||||
*/
|
||||
public function whereNotNull(string $column)
|
||||
@ -119,8 +113,6 @@ trait DatabaseRule
|
||||
/**
|
||||
* Set a "where in" constraint on the query.
|
||||
*
|
||||
* @param string $column
|
||||
* @param array $values
|
||||
* @return $this
|
||||
*/
|
||||
public function whereIn(string $column, array $values)
|
||||
@ -133,8 +125,6 @@ trait DatabaseRule
|
||||
/**
|
||||
* Set a "where not in" constraint on the query.
|
||||
*
|
||||
* @param string $column
|
||||
* @param array $values
|
||||
* @return $this
|
||||
*/
|
||||
public function whereNotIn(string $column, array $values)
|
||||
@ -147,7 +137,6 @@ trait DatabaseRule
|
||||
/**
|
||||
* Register a custom query callback.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function using(Closure $callback)
|
||||
@ -159,8 +148,6 @@ trait DatabaseRule
|
||||
|
||||
/**
|
||||
* Get the custom query callbacks for the rule.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function queryCallbacks(): array
|
||||
{
|
||||
@ -169,8 +156,6 @@ trait DatabaseRule
|
||||
|
||||
/**
|
||||
* Format the where clauses.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function formatWheres(): string
|
||||
{
|
||||
|
@ -23,8 +23,6 @@ class Dimensions
|
||||
|
||||
/**
|
||||
* Create a new dimensions rule instance.
|
||||
*
|
||||
* @param array $constraints;
|
||||
*/
|
||||
public function __construct(array $constraints = [])
|
||||
{
|
||||
@ -33,8 +31,6 @@ class Dimensions
|
||||
|
||||
/**
|
||||
* Convert the rule to a validation string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
@ -50,7 +46,6 @@ class Dimensions
|
||||
/**
|
||||
* Set the "width" constraint.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function width(int $value)
|
||||
@ -63,7 +58,6 @@ class Dimensions
|
||||
/**
|
||||
* Set the "height" constraint.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function height(int $value)
|
||||
@ -76,7 +70,6 @@ class Dimensions
|
||||
/**
|
||||
* Set the "min width" constraint.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function minWidth(int $value)
|
||||
@ -89,7 +82,6 @@ class Dimensions
|
||||
/**
|
||||
* Set the "min height" constraint.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function minHeight(int $value)
|
||||
@ -102,7 +94,6 @@ class Dimensions
|
||||
/**
|
||||
* Set the "max width" constraint.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function maxWidth(int $value)
|
||||
@ -115,7 +106,6 @@ class Dimensions
|
||||
/**
|
||||
* Set the "max height" constraint.
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function maxHeight(int $value)
|
||||
@ -128,7 +118,6 @@ class Dimensions
|
||||
/**
|
||||
* Set the "ratio" constraint.
|
||||
*
|
||||
* @param float $value
|
||||
* @return $this
|
||||
*/
|
||||
public function ratio(float $value)
|
||||
|
@ -18,8 +18,6 @@ class Exists
|
||||
|
||||
/**
|
||||
* Convert the rule to a validation string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -28,8 +28,6 @@ class In
|
||||
|
||||
/**
|
||||
* Create a new in rule instance.
|
||||
*
|
||||
* @param array $values
|
||||
*/
|
||||
public function __construct(array $values)
|
||||
{
|
||||
@ -39,8 +37,6 @@ class In
|
||||
/**
|
||||
* Convert the rule to a validation string.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @see \Hyperf\Validation\ValidationRuleParser::parseParameters
|
||||
*/
|
||||
public function __toString(): string
|
||||
|
@ -28,8 +28,6 @@ class NotIn
|
||||
|
||||
/**
|
||||
* Create a new "not in" rule instance.
|
||||
*
|
||||
* @param array $values
|
||||
*/
|
||||
public function __construct(array $values)
|
||||
{
|
||||
@ -38,8 +36,6 @@ class NotIn
|
||||
|
||||
/**
|
||||
* Convert the rule to a validation string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -33,8 +33,6 @@ class RequiredIf
|
||||
|
||||
/**
|
||||
* Convert the rule to a validation string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -34,8 +34,6 @@ class Unique
|
||||
|
||||
/**
|
||||
* Convert the rule to a validation string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -39,8 +39,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Create a new message bag instance.
|
||||
*
|
||||
* @param array $messages
|
||||
*/
|
||||
public function __construct(array $messages = [])
|
||||
{
|
||||
@ -53,8 +51,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Convert the message bag to its string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
@ -63,8 +59,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Get the keys present in the message bag.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function keys(): array
|
||||
{
|
||||
@ -74,8 +68,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
/**
|
||||
* Add a message to the message bag.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $message
|
||||
* @return $this
|
||||
*/
|
||||
public function add(string $key, string $message)
|
||||
@ -108,7 +100,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
* Determine if messages exist for all of the given keys.
|
||||
*
|
||||
* @param array|string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key): bool
|
||||
{
|
||||
@ -135,7 +126,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
* Determine if messages exist for any of the given keys.
|
||||
*
|
||||
* @param array|string $keys
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAny($keys = []): bool
|
||||
{
|
||||
@ -159,7 +149,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $format
|
||||
* @return string
|
||||
*/
|
||||
public function first($key = null, $format = null): string
|
||||
{
|
||||
@ -173,9 +162,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
/**
|
||||
* Get all of the messages from the message bag for a given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $format
|
||||
* @return array
|
||||
*/
|
||||
public function get(string $key, $format = null): array
|
||||
{
|
||||
@ -201,7 +188,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
* Get all of the messages for every key in the message bag.
|
||||
*
|
||||
* @param string $format
|
||||
* @return array
|
||||
*/
|
||||
public function all($format = null): array
|
||||
{
|
||||
@ -220,7 +206,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
* Get all of the unique messages for every key in the message bag.
|
||||
*
|
||||
* @param string $format
|
||||
* @return array
|
||||
*/
|
||||
public function unique($format = null): array
|
||||
{
|
||||
@ -229,8 +214,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Get the raw messages in the message bag.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
@ -239,8 +222,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Get the raw messages in the message bag.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMessages(): array
|
||||
{
|
||||
@ -259,8 +240,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Get the default message format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormat(): string
|
||||
{
|
||||
@ -270,7 +249,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
/**
|
||||
* Set the default message format.
|
||||
*
|
||||
* @param string $format
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function setFormat(string $format = ':message')
|
||||
@ -282,8 +260,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Determine if the message bag has any messages.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
@ -292,8 +268,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Determine if the message bag has any messages.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isNotEmpty(): bool
|
||||
{
|
||||
@ -302,8 +276,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Determine if the message bag has any messages.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function any(): bool
|
||||
{
|
||||
@ -312,8 +284,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Get the number of messages in the message bag.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
@ -322,8 +292,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Get the instance as an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
@ -332,8 +300,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Convert the object into something JSON serializable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
@ -342,9 +308,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Convert the object to its JSON representation.
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson(int $options = 0): string
|
||||
{
|
||||
@ -353,10 +316,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Determine if a key and message combination already exists.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $message
|
||||
* @return bool
|
||||
*/
|
||||
protected function isUnique(string $key, string $message): bool
|
||||
{
|
||||
@ -368,9 +327,7 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
/**
|
||||
* Get the messages for a wildcard key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param null|string $format
|
||||
* @return array
|
||||
*/
|
||||
protected function getMessagesForWildcardKey(string $key, $format): array
|
||||
{
|
||||
@ -389,11 +346,6 @@ class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, Me
|
||||
|
||||
/**
|
||||
* Format an array of messages.
|
||||
*
|
||||
* @param array $messages
|
||||
* @param string $format
|
||||
* @param string $messageKey
|
||||
* @return array
|
||||
*/
|
||||
protected function transform(array $messages, string $format, string $messageKey): array
|
||||
{
|
||||
|
@ -56,8 +56,6 @@ trait ValidatesWhenResolvedTrait
|
||||
/**
|
||||
* Handle a failed validation attempt.
|
||||
*
|
||||
* @param \Hyperf\Validation\Contracts\Validation\Validator $validator
|
||||
*
|
||||
* @throws \Hyperf\Validation\ValidationException
|
||||
*/
|
||||
protected function failedValidation(Validator $validator)
|
||||
@ -67,8 +65,6 @@ trait ValidatesWhenResolvedTrait
|
||||
|
||||
/**
|
||||
* Determine if the request passes the authorization check.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function passesAuthorization(): bool
|
||||
{
|
||||
|
@ -19,10 +19,6 @@ class ValidationData
|
||||
{
|
||||
/**
|
||||
* Initialize and gather data for given attribute.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param array $masterData
|
||||
* @return array
|
||||
*/
|
||||
public static function initializeAndGatherData(string $attribute, array $masterData): array
|
||||
{
|
||||
@ -41,8 +37,6 @@ class ValidationData
|
||||
* Used to extract a sub-section of the data for faster iteration.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param array $masterData
|
||||
* @return array
|
||||
*/
|
||||
public static function extractDataFromPath($attribute, array $masterData): array
|
||||
{
|
||||
@ -64,7 +58,6 @@ class ValidationData
|
||||
*
|
||||
* Allows us to not spin through all of the flattened data for some operations.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return string
|
||||
*/
|
||||
public static function getLeadingExplicitAttributePath(string $attribute)
|
||||
@ -75,8 +68,6 @@ class ValidationData
|
||||
/**
|
||||
* Gather a copy of the attribute data filled with any missing attributes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param array $masterData
|
||||
* @return array
|
||||
*/
|
||||
protected static function initializeAttributeOnData(string $attribute, array $masterData)
|
||||
@ -94,11 +85,6 @@ class ValidationData
|
||||
|
||||
/**
|
||||
* Get all of the exact attribute values for a given wildcard attribute.
|
||||
*
|
||||
* @param array $masterData
|
||||
* @param array $data
|
||||
* @param string $attribute
|
||||
* @return array
|
||||
*/
|
||||
protected static function extractValuesForWildcards(array $masterData, array $data, string $attribute): array
|
||||
{
|
||||
|
@ -58,7 +58,6 @@ class ValidationException extends ServerException
|
||||
*
|
||||
* @param \Hyperf\Validation\Contracts\Validation\Validator $validator
|
||||
* @param null|ResponseInterface $response
|
||||
* @param string $errorBag
|
||||
*/
|
||||
public function __construct($validator, $response = null, string $errorBag = 'default')
|
||||
{
|
||||
@ -72,7 +71,6 @@ class ValidationException extends ServerException
|
||||
/**
|
||||
* Create a new validation exception from a plain array of messages.
|
||||
*
|
||||
* @param array $messages
|
||||
* @return static
|
||||
*/
|
||||
public static function withMessages(array $messages)
|
||||
@ -88,8 +86,6 @@ class ValidationException extends ServerException
|
||||
|
||||
/**
|
||||
* Get all of the validation error messages.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function errors(): array
|
||||
{
|
||||
@ -99,7 +95,6 @@ class ValidationException extends ServerException
|
||||
/**
|
||||
* Set the HTTP status code to be used for the response.
|
||||
*
|
||||
* @param int $status
|
||||
* @return $this
|
||||
*/
|
||||
public function status(int $status)
|
||||
@ -112,7 +107,6 @@ class ValidationException extends ServerException
|
||||
/**
|
||||
* Set the error bag on the exception.
|
||||
*
|
||||
* @param string $errorBag
|
||||
* @return $this
|
||||
*/
|
||||
public function errorBag(string $errorBag)
|
||||
@ -125,7 +119,6 @@ class ValidationException extends ServerException
|
||||
/**
|
||||
* Set the URL to redirect to on a validation error.
|
||||
*
|
||||
* @param string $url
|
||||
* @return $this
|
||||
*/
|
||||
public function redirectTo(string $url)
|
||||
|
@ -37,8 +37,6 @@ class ValidationRuleParser
|
||||
|
||||
/**
|
||||
* Create a new validation rule parser.
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
@ -48,7 +46,6 @@ class ValidationRuleParser
|
||||
/**
|
||||
* Parse the human-friendly rules into a full rules array for the validator.
|
||||
*
|
||||
* @param array $rules
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function explode(array $rules)
|
||||
@ -66,10 +63,8 @@ class ValidationRuleParser
|
||||
/**
|
||||
* Merge additional rules into a given attribute(s).
|
||||
*
|
||||
* @param array $results
|
||||
* @param array|string $attribute
|
||||
* @param array|string $rules
|
||||
* @return array
|
||||
*/
|
||||
public function mergeRules(array $results, $attribute, $rules = []): array
|
||||
{
|
||||
@ -92,7 +87,6 @@ class ValidationRuleParser
|
||||
* Extract the rule name and parameters from a rule.
|
||||
*
|
||||
* @param array|string $rules
|
||||
* @return array
|
||||
*/
|
||||
public static function parse($rules): array
|
||||
{
|
||||
@ -113,9 +107,6 @@ class ValidationRuleParser
|
||||
|
||||
/**
|
||||
* Explode the rules into an array of explicit rules.
|
||||
*
|
||||
* @param array $rules
|
||||
* @return array
|
||||
*/
|
||||
protected function explodeRules(array $rules): array
|
||||
{
|
||||
@ -136,7 +127,6 @@ class ValidationRuleParser
|
||||
* Explode the explicit rule into an array if necessary.
|
||||
*
|
||||
* @param mixed $rule
|
||||
* @return array
|
||||
*/
|
||||
protected function explodeExplicitRule($rule): array
|
||||
{
|
||||
@ -175,10 +165,7 @@ class ValidationRuleParser
|
||||
/**
|
||||
* Define a set of rules that apply to each element in an array attribute.
|
||||
*
|
||||
* @param array $results
|
||||
* @param string $attribute
|
||||
* @param array|string $rules
|
||||
* @return array
|
||||
*/
|
||||
protected function explodeWildcardRules(array $results, string $attribute, $rules): array
|
||||
{
|
||||
@ -202,10 +189,7 @@ class ValidationRuleParser
|
||||
/**
|
||||
* Merge additional rules into a given attribute.
|
||||
*
|
||||
* @param array $results
|
||||
* @param string $attribute
|
||||
* @param array|string $rules
|
||||
* @return array
|
||||
*/
|
||||
protected function mergeRulesForAttribute(array $results, string $attribute, $rules): array
|
||||
{
|
||||
@ -221,9 +205,6 @@ class ValidationRuleParser
|
||||
|
||||
/**
|
||||
* Parse an array based rule.
|
||||
*
|
||||
* @param array $rules
|
||||
* @return array
|
||||
*/
|
||||
protected static function parseArrayRule(array $rules): array
|
||||
{
|
||||
@ -232,9 +213,6 @@ class ValidationRuleParser
|
||||
|
||||
/**
|
||||
* Parse a string based rule.
|
||||
*
|
||||
* @param string $rules
|
||||
* @return array
|
||||
*/
|
||||
protected static function parseStringRule(string $rules): array
|
||||
{
|
||||
@ -254,10 +232,6 @@ class ValidationRuleParser
|
||||
|
||||
/**
|
||||
* Parse a parameter list.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param string $parameter
|
||||
* @return array
|
||||
*/
|
||||
protected static function parseParameters(string $rule, string $parameter): array
|
||||
{
|
||||
@ -272,9 +246,6 @@ class ValidationRuleParser
|
||||
|
||||
/**
|
||||
* Normalizes a rule so that we can accept short types.
|
||||
*
|
||||
* @param string $rule
|
||||
* @return string
|
||||
*/
|
||||
protected static function normalizeRule(string $rule): string
|
||||
{
|
||||
|
@ -204,12 +204,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Create a new Validator instance.
|
||||
*
|
||||
* @param TranslatorInterface $translator
|
||||
* @param array $data
|
||||
* @param array $rules
|
||||
* @param array $messages
|
||||
* @param array $customAttributes
|
||||
*/
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
@ -252,9 +246,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Parse the data array, converting dots to ->.
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function parseData(array $data): array
|
||||
{
|
||||
@ -295,8 +286,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Determine if the data passes the validation rules.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function passes(): bool
|
||||
{
|
||||
@ -331,8 +320,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Determine if the data fails the validation rules.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function fails(): bool
|
||||
{
|
||||
@ -343,7 +330,6 @@ class Validator implements ValidatorContract
|
||||
* Run the validator's rules against its data.
|
||||
*
|
||||
* @throws \Hyperf\Validation\ValidationException
|
||||
* @return array
|
||||
*/
|
||||
public function validate(): array
|
||||
{
|
||||
@ -358,7 +344,6 @@ class Validator implements ValidatorContract
|
||||
* Get the attributes and values that were validated.
|
||||
*
|
||||
* @throws \Hyperf\Validation\ValidationException
|
||||
* @return array
|
||||
*/
|
||||
public function validated(): array
|
||||
{
|
||||
@ -383,10 +368,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Add a failed rule and error message to the collection.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param string $rule
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function addFailure(string $attribute, string $rule, array $parameters = [])
|
||||
{
|
||||
@ -406,8 +387,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Returns the data which was valid.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function valid(): array
|
||||
{
|
||||
@ -423,8 +402,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Returns the data which was invalid.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function invalid(): array
|
||||
{
|
||||
@ -440,8 +417,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Get the failed validation rules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function failed(): array
|
||||
{
|
||||
@ -485,9 +460,7 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Determine if the given attribute has a rule in the given set.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param array|string $rules
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRule(string $attribute, $rules): bool
|
||||
{
|
||||
@ -496,8 +469,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Get the data under validation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
@ -506,8 +477,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Get the data under validation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData(): array
|
||||
{
|
||||
@ -517,7 +486,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Set the data under validation.
|
||||
*
|
||||
* @param array $data
|
||||
* @return $this
|
||||
*/
|
||||
public function setData(array $data)
|
||||
@ -531,8 +499,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Get the validation rules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRules(): array
|
||||
{
|
||||
@ -542,7 +508,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Set the validation rules.
|
||||
*
|
||||
* @param array $rules
|
||||
* @return $this
|
||||
*/
|
||||
public function setRules(array $rules)
|
||||
@ -558,8 +523,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Parse the given rules and merge them into current rules.
|
||||
*
|
||||
* @param array $rules
|
||||
*/
|
||||
public function addRules(array $rules)
|
||||
{
|
||||
@ -585,7 +548,6 @@ class Validator implements ValidatorContract
|
||||
*
|
||||
* @param array|string $attribute
|
||||
* @param array|string $rules
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function sometimes($attribute, $rules, callable $callback)
|
||||
@ -603,8 +565,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Register an array of custom validator extensions.
|
||||
*
|
||||
* @param array $extensions
|
||||
*/
|
||||
public function addExtensions(array $extensions)
|
||||
{
|
||||
@ -619,8 +579,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Register an array of custom implicit validator extensions.
|
||||
*
|
||||
* @param array $extensions
|
||||
*/
|
||||
public function addImplicitExtensions(array $extensions)
|
||||
{
|
||||
@ -633,8 +591,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Register an array of custom implicit validator extensions.
|
||||
*
|
||||
* @param array $extensions
|
||||
*/
|
||||
public function addDependentExtensions(array $extensions)
|
||||
{
|
||||
@ -648,7 +604,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Register a custom validator extension.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $extension
|
||||
*/
|
||||
public function addExtension(string $rule, $extension)
|
||||
@ -659,7 +614,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Register a custom implicit validator extension.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $extension
|
||||
*/
|
||||
public function addImplicitExtension(string $rule, $extension)
|
||||
@ -672,7 +626,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Register a custom dependent validator extension.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $extension
|
||||
*/
|
||||
public function addDependentExtension(string $rule, $extension)
|
||||
@ -684,8 +637,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Register an array of custom validator message replacers.
|
||||
*
|
||||
* @param array $replacers
|
||||
*/
|
||||
public function addReplacers(array $replacers)
|
||||
{
|
||||
@ -701,7 +652,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Register a custom validator message replacer.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param \Closure|string $replacer
|
||||
*/
|
||||
public function addReplacer(string $rule, $replacer)
|
||||
@ -712,7 +662,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Set the custom messages for the validator.
|
||||
*
|
||||
* @param array $messages
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomMessages(array $messages)
|
||||
@ -725,7 +674,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Set the custom attributes on the validator.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttributeNames(array $attributes)
|
||||
@ -738,7 +686,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Add custom attributes to the validator.
|
||||
*
|
||||
* @param array $customAttributes
|
||||
* @return $this
|
||||
*/
|
||||
public function addCustomAttributes(array $customAttributes)
|
||||
@ -751,7 +698,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Set the custom values on the validator.
|
||||
*
|
||||
* @param array $values
|
||||
* @return $this
|
||||
*/
|
||||
public function setValueNames(array $values)
|
||||
@ -764,7 +710,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Add the custom values for the validator.
|
||||
*
|
||||
* @param array $customValues
|
||||
* @return $this
|
||||
*/
|
||||
public function addCustomValues(array $customValues)
|
||||
@ -776,8 +721,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Set the fallback messages for the validator.
|
||||
*
|
||||
* @param array $messages
|
||||
*/
|
||||
public function setFallbackMessages(array $messages)
|
||||
{
|
||||
@ -815,8 +758,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Set the Presence Verifier implementation.
|
||||
*
|
||||
* @param \Hyperf\Validation\PresenceVerifierInterface $presenceVerifier
|
||||
*/
|
||||
public function setPresenceVerifier(PresenceVerifierInterface $presenceVerifier)
|
||||
{
|
||||
@ -835,8 +776,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Set the Translator implementation.
|
||||
*
|
||||
* @param TranslatorInterface $translator
|
||||
*/
|
||||
public function setTranslator(TranslatorInterface $translator)
|
||||
{
|
||||
@ -845,8 +784,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Set the IoC container instance.
|
||||
*
|
||||
* @param Container $container
|
||||
*/
|
||||
public function setContainer(ContainerInterface $container)
|
||||
{
|
||||
@ -910,7 +847,6 @@ class Validator implements ValidatorContract
|
||||
* Determine if the given rule depends on other fields.
|
||||
*
|
||||
* @param string $rule
|
||||
* @return bool
|
||||
*/
|
||||
protected function dependsOnOtherFields($rule): bool
|
||||
{
|
||||
@ -921,9 +857,6 @@ class Validator implements ValidatorContract
|
||||
* Get the explicit keys from an attribute flattened with dot notation.
|
||||
*
|
||||
* E.g. 'foo.1.bar.spark.baz' -> [1, 'spark'] for 'foo.*.bar.*.baz'
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return array
|
||||
*/
|
||||
protected function getExplicitKeys(string $attribute): array
|
||||
{
|
||||
@ -942,9 +875,6 @@ class Validator implements ValidatorContract
|
||||
* Get the primary attribute name.
|
||||
*
|
||||
* For example, if "name.0" is given, "name.*" will be returned.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return string
|
||||
*/
|
||||
protected function getPrimaryAttribute(string $attribute): string
|
||||
{
|
||||
@ -959,10 +889,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Replace each field parameter which has asterisks with the given keys.
|
||||
*
|
||||
* @param array $parameters
|
||||
* @param array $keys
|
||||
* @return array
|
||||
*/
|
||||
protected function replaceAsterisksInParameters(array $parameters, array $keys): array
|
||||
{
|
||||
@ -975,9 +901,7 @@ class Validator implements ValidatorContract
|
||||
* Determine if the attribute is validatable.
|
||||
*
|
||||
* @param object|string $rule
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function isValidatable($rule, string $attribute, $value): bool
|
||||
{
|
||||
@ -991,9 +915,7 @@ class Validator implements ValidatorContract
|
||||
* Determine if the field is present, or the rule implies required.
|
||||
*
|
||||
* @param object|string $rule
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function presentOrRuleIsImplicit($rule, string $attribute, $value): bool
|
||||
{
|
||||
@ -1009,7 +931,6 @@ class Validator implements ValidatorContract
|
||||
* Determine if a given rule implies the attribute is required.
|
||||
*
|
||||
* @param object|string $rule
|
||||
* @return bool
|
||||
*/
|
||||
protected function isImplicit($rule): bool
|
||||
{
|
||||
@ -1019,9 +940,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Determine if the attribute passes any optional check.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return bool
|
||||
*/
|
||||
protected function passesOptionalCheck(string $attribute): bool
|
||||
{
|
||||
@ -1039,8 +957,6 @@ class Validator implements ValidatorContract
|
||||
* Determine if the attribute fails the nullable check.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param string $attribute
|
||||
* @return bool
|
||||
*/
|
||||
protected function isNotNullIfMarkedAsNullable($rule, string $attribute): bool
|
||||
{
|
||||
@ -1057,8 +973,6 @@ class Validator implements ValidatorContract
|
||||
* This is to avoid possible database type comparison errors.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param string $attribute
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasNotFailedPreviousRuleIfPresenceRule($rule, string $attribute): bool
|
||||
{
|
||||
@ -1068,7 +982,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Validate an attribute using a custom rule object.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @param \Hyperf\Validation\Contracts\Validation\Rule $rule
|
||||
*/
|
||||
@ -1092,9 +1005,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Check if we should stop further validations on a given attribute.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldStopValidating(string $attribute): bool
|
||||
{
|
||||
@ -1117,8 +1027,6 @@ class Validator implements ValidatorContract
|
||||
|
||||
/**
|
||||
* Generate an array of all attributes that have messages.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function attributesThatHaveMessages(): array
|
||||
{
|
||||
@ -1130,7 +1038,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Get a rule and its parameters for a given attribute.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param array|string $rules
|
||||
* @return null|array
|
||||
*/
|
||||
@ -1154,7 +1061,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Get the value of a given attribute.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getValue(string $attribute)
|
||||
@ -1165,8 +1071,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Call a custom validator extension.
|
||||
*
|
||||
* @param string $rule
|
||||
* @param array $parameters
|
||||
* @return null|bool
|
||||
*/
|
||||
protected function callExtension(string $rule, array $parameters)
|
||||
@ -1184,8 +1088,6 @@ class Validator implements ValidatorContract
|
||||
/**
|
||||
* Call a class based validator extension.
|
||||
*
|
||||
* @param string $callback
|
||||
* @param array $parameters
|
||||
* @return bool
|
||||
*/
|
||||
protected function callClassBasedExtension(string $callback, array $parameters)
|
||||
|
Loading…
Reference in New Issue
Block a user