diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 7d3862a3d9..74376aa01f 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -420,7 +420,7 @@ class BaseHtml * @param string $text link body. It will NOT be HTML-encoded. Therefore you can pass in HTML code * such as an image tag. If this is coming from end users, you should consider [[encode()]] * it to prevent XSS attacks. - * @param string $email email address. If this is null, the first parameter (link body) will be treated + * @param string|null $email email address. If this is null, the first parameter (link body) will be treated * as the email address and used. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. @@ -470,7 +470,7 @@ class BaseHtml * @param string $content label text. It will NOT be HTML-encoded. Therefore you can pass in HTML code * such as an image tag. If this is is coming from end users, you should [[encode()]] * it to prevent XSS attacks. - * @param string $for the ID of the HTML element that this label is associated with. + * @param string|null $for the ID of the HTML element that this label is associated with. * If this is null, the "for" attribute will not be generated. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. @@ -545,8 +545,8 @@ class BaseHtml /** * Generates an input type of the given type. * @param string $type the type attribute. - * @param string $name the name attribute. If it is null, the name attribute will not be generated. - * @param string $value the value attribute. If it is null, the value attribute will not be generated. + * @param string|null $name the name attribute. If it is null, the name attribute will not be generated. + * @param string|null $value the value attribute. If it is null, the value attribute will not be generated. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. * If a value is null, the corresponding attribute will not be rendered. @@ -617,7 +617,7 @@ class BaseHtml /** * Generates a text input field. * @param string $name the name attribute. - * @param string $value the value attribute. If it is null, the value attribute will not be generated. + * @param string|null $value the value attribute. If it is null, the value attribute will not be generated. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. * If a value is null, the corresponding attribute will not be rendered. @@ -632,7 +632,7 @@ class BaseHtml /** * Generates a hidden input field. * @param string $name the name attribute. - * @param string $value the value attribute. If it is null, the value attribute will not be generated. + * @param string|null $value the value attribute. If it is null, the value attribute will not be generated. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. * If a value is null, the corresponding attribute will not be rendered. @@ -647,7 +647,7 @@ class BaseHtml /** * Generates a password input field. * @param string $name the name attribute. - * @param string $value the value attribute. If it is null, the value attribute will not be generated. + * @param string|null $value the value attribute. If it is null, the value attribute will not be generated. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. * If a value is null, the corresponding attribute will not be rendered. @@ -665,7 +665,7 @@ class BaseHtml * be "multipart/form-data". After the form is submitted, the uploaded file information * can be obtained via $_FILES[$name] (see PHP documentation). * @param string $name the name attribute. - * @param string $value the value attribute. If it is null, the value attribute will not be generated. + * @param string|null $value the value attribute. If it is null, the value attribute will not be generated. * @param array $options the tag options in terms of name-value pairs. These will be rendered as * the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. * If a value is null, the corresponding attribute will not be rendered. diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index 5a8f1f01dd..acf71020fb 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -614,7 +614,7 @@ class Formatter extends Component /** * Formats the value as a date. - * @param int|string|DateTime $value the value to be formatted. The following + * @param int|string|DateTime|DateTimeInterface $value the value to be formatted. The following * types of value are supported: * * - an integer representing a UNIX timestamp. A UNIX timestamp is always in UTC by its definition. @@ -627,7 +627,7 @@ class Formatter extends Component * If no timezone conversion should be performed, you need to set [[defaultTimeZone]] and [[timeZone]] to the same value. * Also no conversion will be performed on values that have no time information, e.g. `"2017-06-05"`. * - * @param string $format the format used to convert the value into a date string. + * @param string|null $format the format used to convert the value into a date string. * If null, [[dateFormat]] will be used. * * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. @@ -652,7 +652,7 @@ class Formatter extends Component /** * Formats the value as a time. - * @param int|string|DateTime $value the value to be formatted. The following + * @param int|string|DateTime|DateTimeInterface $value the value to be formatted. The following * types of value are supported: * * - an integer representing a UNIX timestamp. A UNIX timestamp is always in UTC by its definition. @@ -664,7 +664,7 @@ class Formatter extends Component * The formatter will convert date values according to [[timeZone]] before formatting it. * If no timezone conversion should be performed, you need to set [[defaultTimeZone]] and [[timeZone]] to the same value. * - * @param string $format the format used to convert the value into a date string. + * @param string|null $format the format used to convert the value into a date string. * If null, [[timeFormat]] will be used. * * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. @@ -689,7 +689,7 @@ class Formatter extends Component /** * Formats the value as a datetime. - * @param int|string|DateTime $value the value to be formatted. The following + * @param int|string|DateTime|DateTimeInterface $value the value to be formatted. The following * types of value are supported: * * - an integer representing a UNIX timestamp. A UNIX timestamp is always in UTC by its definition. @@ -701,7 +701,7 @@ class Formatter extends Component * The formatter will convert date values according to [[timeZone]] before formatting it. * If no timezone conversion should be performed, you need to set [[defaultTimeZone]] and [[timeZone]] to the same value. * - * @param string $format the format used to convert the value into a date string. + * @param string|null $format the format used to convert the value into a date string. * If null, [[datetimeFormat]] will be used. * * This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. @@ -735,7 +735,7 @@ class Formatter extends Component ]; /** - * @param int|string|DateTime $value the value to be formatted. The following + * @param int|string|DateTime|DateTimeInterface $value the value to be formatted. The following * types of value are supported: * * - an integer representing a UNIX timestamp @@ -811,7 +811,7 @@ class Formatter extends Component /** * Normalizes the given datetime value as a DateTime object that can be taken by various date/time formatting methods. * - * @param int|string|DateTime $value the datetime value to be normalized. The following + * @param int|string|DateTime|DateTimeInterface $value the datetime value to be normalized. The following * types of value are supported: * * - an integer representing a UNIX timestamp @@ -871,7 +871,7 @@ class Formatter extends Component /** * Formats a date, time or datetime in a float number as UNIX timestamp (seconds since 01-01-1970). - * @param int|string|DateTime $value the value to be formatted. The following + * @param int|string|DateTime|DateTimeInterface $value the value to be formatted. The following * types of value are supported: * * - an integer representing a UNIX timestamp @@ -899,7 +899,7 @@ class Formatter extends Component * 2. Using a timestamp that is relative to the `$referenceTime`. * 3. Using a `DateInterval` object. * - * @param int|string|DateTime|DateInterval $value the value to be formatted. The following + * @param int|string|DateTime|DateTimeInterface|DateInterval $value the value to be formatted. The following * types of value are supported: * * - an integer representing a UNIX timestamp @@ -908,7 +908,7 @@ class Formatter extends Component * - a PHP [DateTime](https://secure.php.net/manual/en/class.datetime.php) object * - a PHP DateInterval object (a positive time interval will refer to the past, a negative one to the future) * - * @param int|string|DateTime $referenceTime if specified the value is used as a reference time instead of `now` + * @param int|string|DateTime|DateTimeInterface|null $referenceTime if specified the value is used as a reference time instead of `now` * when `$value` is not a `DateInterval` object. * @return string the formatted result. * @throws InvalidArgumentException if the input value can not be evaluated as a date value. @@ -1114,7 +1114,7 @@ class Formatter extends Component * recommended to pass them as strings and not use scientific notation otherwise the output might be wrong. * * @param mixed $value the value to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * If not given, the number of digits depends in the input value and is determined based on * `NumberFormatter::MIN_FRACTION_DIGITS` and `NumberFormatter::MAX_FRACTION_DIGITS`, which can be configured * using [[$numberFormatterOptions]]. @@ -1164,7 +1164,7 @@ class Formatter extends Component * recommended to pass them as strings and not use scientific notation otherwise the output might be wrong. * * @param mixed $value the value to be formatted. It must be a factor e.g. `0.75` will result in `75%`. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * If not given, the number of digits depends in the input value and is determined based on * `NumberFormatter::MIN_FRACTION_DIGITS` and `NumberFormatter::MAX_FRACTION_DIGITS`, which can be configured * using [[$numberFormatterOptions]]. @@ -1209,7 +1209,7 @@ class Formatter extends Component * Formats the value as a scientific number. * * @param mixed $value the value to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * If not given, the number of digits depends in the input value and is determined based on * `NumberFormatter::MIN_FRACTION_DIGITS` and `NumberFormatter::MAX_FRACTION_DIGITS`, which can be configured * using [[$numberFormatterOptions]]. @@ -1255,7 +1255,7 @@ class Formatter extends Component * scientific notation otherwise the output might be wrong. * * @param mixed $value the value to be formatted. - * @param string $currency the 3-letter ISO 4217 currency code indicating the currency to use. + * @param string|null $currency the 3-letter ISO 4217 currency code indicating the currency to use. * If null, [[currencyCode]] will be used. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. @@ -1374,7 +1374,7 @@ class Formatter extends Component * are used in the formatting result. * * @param string|int|float $value value in bytes to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return string the formatted result. @@ -1430,7 +1430,7 @@ class Formatter extends Component * are used in the formatting result. * * @param string|int|float $value value in bytes to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return string the formatted result. @@ -1485,7 +1485,7 @@ class Formatter extends Component * of the smallest unit and [[systemOfUnits]] to switch between [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. * * @param float|int $value value to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * @param array $numberOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return string the formatted result. @@ -1508,7 +1508,7 @@ class Formatter extends Component * of the smallest unit and [[systemOfUnits]] to switch between [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. * * @param float|int $value value to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return string the formatted result. @@ -1529,7 +1529,7 @@ class Formatter extends Component * of the smallest unit and [[systemOfUnits]] to switch between [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. * * @param float|int $value value to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return string the formatted result. @@ -1551,7 +1551,7 @@ class Formatter extends Component * of the smallest unit and [[systemOfUnits]] to switch between [[UNIT_SYSTEM_METRIC]] or [[UNIT_SYSTEM_IMPERIAL]]. * * @param float|int $value value to be formatted. - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return string the formatted result. @@ -1756,7 +1756,7 @@ class Formatter extends Component * @param int $style the type of the number formatter. * Values: NumberFormatter::DECIMAL, ::CURRENCY, ::PERCENT, ::SCIENTIFIC, ::SPELLOUT, ::ORDINAL * ::DURATION, ::PATTERN_RULEBASED, ::DEFAULT_STYLE, ::IGNORE - * @param int $decimals the number of digits after the decimal point. + * @param int|null $decimals the number of digits after the decimal point. * @param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]]. * @param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]]. * @return NumberFormatter the created formatter instance @@ -2023,7 +2023,7 @@ class Formatter extends Component * to the defined decimal digits. * * @param string|int|float $value the value to be formatted. - * @param int $decimals the number of digits after the decimal point. The default value is `0`. + * @param int|null $decimals the number of digits after the decimal point. The default value is `0`. * @return string the formatted result. * @since 2.0.16 */ @@ -2063,7 +2063,7 @@ class Formatter extends Component * Fallback for formatting value as a currency number. * * @param string|int|float $value the value to be formatted. - * @param string $currency the 3-letter ISO 4217 currency code indicating the currency to use. + * @param string|null $currency the 3-letter ISO 4217 currency code indicating the currency to use. * If null, [[currencyCode]] will be used. * @return string the formatted result. * @throws InvalidConfigException if no currency is given and [[currencyCode]] is not defined.