mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fix types (#19332)
* Migration::upsert() returns void * Unneeded `@property` tags * Add missing `null` param/return types * Null types for db\Query + db\ActiveQuery * Fixed testSelect
This commit is contained in:
@ -119,7 +119,7 @@ class DateValidator extends Validator
|
||||
*/
|
||||
public $timeZone;
|
||||
/**
|
||||
* @var string the name of the attribute to receive the parsing result.
|
||||
* @var string|null the name of the attribute to receive the parsing result.
|
||||
* When this property is not null and the validation is successful, the named attribute will
|
||||
* receive the parsing result.
|
||||
*
|
||||
@ -160,7 +160,7 @@ class DateValidator extends Validator
|
||||
*/
|
||||
public $timestampAttributeTimeZone = 'UTC';
|
||||
/**
|
||||
* @var int|string upper limit of the date. Defaults to null, meaning no upper limit.
|
||||
* @var int|string|null upper limit of the date. Defaults to null, meaning no upper limit.
|
||||
* This can be a unix timestamp or a string representing a date time value.
|
||||
* If this property is a string, [[format]] will be used to parse it.
|
||||
* @see tooBig for the customized message used when the date is too big.
|
||||
@ -168,7 +168,7 @@ class DateValidator extends Validator
|
||||
*/
|
||||
public $max;
|
||||
/**
|
||||
* @var int|string lower limit of the date. Defaults to null, meaning no lower limit.
|
||||
* @var int|string|null lower limit of the date. Defaults to null, meaning no lower limit.
|
||||
* This can be a unix timestamp or a string representing a date time value.
|
||||
* If this property is a string, [[format]] will be used to parse it.
|
||||
* @see tooSmall for the customized message used when the date is too small.
|
||||
@ -186,13 +186,13 @@ class DateValidator extends Validator
|
||||
*/
|
||||
public $tooSmall;
|
||||
/**
|
||||
* @var string user friendly value of upper limit to display in the error message.
|
||||
* @var string|null user friendly value of upper limit to display in the error message.
|
||||
* If this property is null, the value of [[max]] will be used (before parsing).
|
||||
* @since 2.0.4
|
||||
*/
|
||||
public $maxString;
|
||||
/**
|
||||
* @var string user friendly value of lower limit to display in the error message.
|
||||
* @var string|null user friendly value of lower limit to display in the error message.
|
||||
* If this property is null, the value of [[min]] will be used (before parsing).
|
||||
* @since 2.0.4
|
||||
*/
|
||||
|
@ -308,7 +308,7 @@ class ExistValidator extends Validator
|
||||
* Returns conditions with alias.
|
||||
* @param ActiveQuery $query
|
||||
* @param array $conditions array of condition, keys to be modified
|
||||
* @param null|string $alias set empty string for no apply alias. Set null for apply primary table alias
|
||||
* @param string|null $alias set empty string for no apply alias. Set null for apply primary table alias
|
||||
* @return array
|
||||
*/
|
||||
private function applyTableAlias($query, $conditions, $alias = null)
|
||||
|
@ -28,7 +28,7 @@ use yii\web\UploadedFile;
|
||||
class FileValidator extends Validator
|
||||
{
|
||||
/**
|
||||
* @var array|string a list of file name extensions that are allowed to be uploaded.
|
||||
* @var array|string|null a list of file name extensions that are allowed to be uploaded.
|
||||
* This can be either an array or a string consisting of file extension names
|
||||
* separated by space or comma (e.g. "gif, jpg").
|
||||
* Extension names are case-insensitive. Defaults to null, meaning all file name
|
||||
@ -42,7 +42,7 @@ class FileValidator extends Validator
|
||||
*/
|
||||
public $checkExtensionByMimeType = true;
|
||||
/**
|
||||
* @var array|string a list of file MIME types that are allowed to be uploaded.
|
||||
* @var array|string|null a list of file MIME types that are allowed to be uploaded.
|
||||
* This can be either an array or a string consisting of file MIME types
|
||||
* separated by space or comma (e.g. "text/plain, image/png").
|
||||
* The mask with the special character `*` can be used to match groups of mime types.
|
||||
@ -52,13 +52,13 @@ class FileValidator extends Validator
|
||||
*/
|
||||
public $mimeTypes;
|
||||
/**
|
||||
* @var int the minimum number of bytes required for the uploaded file.
|
||||
* @var int|null the minimum number of bytes required for the uploaded file.
|
||||
* Defaults to null, meaning no limit.
|
||||
* @see tooSmall for the customized message for a file that is too small.
|
||||
*/
|
||||
public $minSize;
|
||||
/**
|
||||
* @var int the maximum number of bytes required for the uploaded file.
|
||||
* @var int|null the maximum number of bytes required for the uploaded file.
|
||||
* Defaults to null, meaning no limit.
|
||||
* Note, the size limit is also affected by `upload_max_filesize` and `post_max_size` INI setting
|
||||
* and the 'MAX_FILE_SIZE' hidden field value. See [[getSizeLimit()]] for details.
|
||||
|
@ -27,25 +27,25 @@ class ImageValidator extends FileValidator
|
||||
*/
|
||||
public $notImage;
|
||||
/**
|
||||
* @var int the minimum width in pixels.
|
||||
* @var int|null the minimum width in pixels.
|
||||
* Defaults to null, meaning no limit.
|
||||
* @see underWidth for the customized message used when image width is too small.
|
||||
*/
|
||||
public $minWidth;
|
||||
/**
|
||||
* @var int the maximum width in pixels.
|
||||
* @var int|null the maximum width in pixels.
|
||||
* Defaults to null, meaning no limit.
|
||||
* @see overWidth for the customized message used when image width is too big.
|
||||
*/
|
||||
public $maxWidth;
|
||||
/**
|
||||
* @var int the minimum height in pixels.
|
||||
* @var int|null the minimum height in pixels.
|
||||
* Defaults to null, meaning no limit.
|
||||
* @see underHeight for the customized message used when image height is too small.
|
||||
*/
|
||||
public $minHeight;
|
||||
/**
|
||||
* @var int the maximum width in pixels.
|
||||
* @var int|null the maximum width in pixels.
|
||||
* Defaults to null, meaning no limit.
|
||||
* @see overHeight for the customized message used when image height is too big.
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ class IpValidator extends Validator
|
||||
*/
|
||||
public $ipv4 = true;
|
||||
/**
|
||||
* @var bool whether the address can be an IP with CIDR subnet, like `192.168.10.0/24`.
|
||||
* @var bool|null whether the address can be an IP with CIDR subnet, like `192.168.10.0/24`.
|
||||
* The following values are possible:
|
||||
*
|
||||
* - `false` - the address must not have a subnet (default).
|
||||
|
@ -34,12 +34,12 @@ class NumberValidator extends Validator
|
||||
*/
|
||||
public $integerOnly = false;
|
||||
/**
|
||||
* @var int|float upper limit of the number. Defaults to null, meaning no upper limit.
|
||||
* @var int|float|null upper limit of the number. Defaults to null, meaning no upper limit.
|
||||
* @see tooBig for the customized message used when the number is too big.
|
||||
*/
|
||||
public $max;
|
||||
/**
|
||||
* @var int|float lower limit of the number. Defaults to null, meaning no lower limit.
|
||||
* @var int|float|null lower limit of the number. Defaults to null, meaning no lower limit.
|
||||
* @see tooSmall for the customized message used when the number is too small.
|
||||
*/
|
||||
public $min;
|
||||
|
@ -309,7 +309,7 @@ class UniqueValidator extends Validator
|
||||
* Returns conditions with alias.
|
||||
* @param ActiveQuery $query
|
||||
* @param array $conditions array of condition, keys to be modified
|
||||
* @param null|string $alias set empty string for no apply alias. Set null for apply primary table alias
|
||||
* @param string|null $alias set empty string for no apply alias. Set null for apply primary table alias
|
||||
* @return array
|
||||
*/
|
||||
private function applyTableAlias($query, $conditions, $alias = null)
|
||||
|
@ -35,7 +35,7 @@ class UrlValidator extends Validator
|
||||
*/
|
||||
public $validSchemes = ['http', 'https'];
|
||||
/**
|
||||
* @var string the default URI scheme. If the input doesn't contain the scheme part, the default
|
||||
* @var string|null the default URI scheme. If the input doesn't contain the scheme part, the default
|
||||
* scheme will be prepended to it (thus changing the input). Defaults to null, meaning a URL must
|
||||
* contain the scheme part.
|
||||
*/
|
||||
|
@ -132,7 +132,7 @@ class Validator extends Component
|
||||
*/
|
||||
public $skipOnError = true;
|
||||
/**
|
||||
* @var bool whether this validation rule should be skipped if the attribute value
|
||||
* @var bool|null whether this validation rule should be skipped if the attribute value
|
||||
* is null or an empty string. This property is used only when validating [[yii\base\Model]].
|
||||
*/
|
||||
public $skipOnEmpty = true;
|
||||
@ -271,7 +271,7 @@ class Validator extends Component
|
||||
* - If this is a string or an array, the intersection of [[getAttributeNames()]]
|
||||
* and the specified attributes will be returned.
|
||||
*
|
||||
* @return array list of attribute names.
|
||||
* @return array|null list of attribute names.
|
||||
* @since 2.0.16
|
||||
*/
|
||||
public function getValidationAttributes($attributes = null)
|
||||
@ -313,7 +313,7 @@ class Validator extends Component
|
||||
* Validates a given value.
|
||||
* You may use this method to validate a value out of the context of a data model.
|
||||
* @param mixed $value the data value to be validated.
|
||||
* @param string $error the error message to be returned, if the validation fails.
|
||||
* @param string|null $error the error message to be returned, if the validation fails.
|
||||
* @return bool whether the data is valid.
|
||||
*/
|
||||
public function validate($value, &$error = null)
|
||||
|
Reference in New Issue
Block a user