Skip to content

Commit 8482ee5

Browse files
authored
Fix rule phpdoc
1 parent fb33c0d commit 8482ee5

8 files changed

Lines changed: 40 additions & 40 deletions

File tree

src/Rule/Boolean.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class Boolean extends Rule
2424
*/
2525
private $falseValue = '0';
2626
/**
27-
* @var bool whether the comparison to [[trueValue]] and [[falseValue]] is strict.
28-
* When this is true, the attribute value and type must both match those of [[trueValue]] or [[falseValue]].
27+
* @var bool whether the comparison to {@see trueValue()} and {@see falseValue()} is strict.
28+
* When this is true, the attribute value and type must both match those of {@see trueValue()} or {@see falseValue()}.
2929
* Defaults to false, meaning only the value needs to be matched.
3030
*/
3131
private bool $strict = false;

src/Rule/CompareTo.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@
1111
/**
1212
* CompareValidator compares the specified attribute value with another value.
1313
*
14-
* The value being compared with a constant [[compareValue]], which is set
14+
* The value being compared with a constant {@see CompareTo::$compareValue}, which is set
1515
* in the constructor.
1616
*
1717
* CompareValidator supports different comparison operators, specified
18-
* via the [[operator]] property.
18+
* via the {@see CompareTo::operator()}.
1919
*
2020
* The default comparison function is based on string values, which means the values
21-
* are compared byte by byte. When comparing numbers, make sure to set the [[$type]]
22-
* to [[TYPE_NUMBER]] to enable numeric comparison.
21+
* are compared byte by byte. When comparing numbers, make sure to call the {@see CompareTo::asNumber()}
22+
* to enable numeric comparison.
2323
*/
2424
class CompareTo extends Rule
2525
{
2626
/**
27-
* Constant for specifying the comparison [[type]] by numeric values.
27+
* Constant for specifying the comparison as string values.
28+
* No conversion will be done before comparison.
2829
*
2930
* @see type
3031
*/
3132
private const TYPE_STRING = 'string';
3233
/**
33-
* Constant for specifying the comparison [[type]] by numeric values.
34+
* Constant for specifying the comparison as numeric values.
35+
* String values will be converted into numbers before comparison.
3436
*
3537
* @see type
3638
*/
@@ -41,10 +43,7 @@ class CompareTo extends Rule
4143
*/
4244
private $compareValue;
4345
/**
44-
* @var string the type of the values being compared. The follow types are supported:
45-
*
46-
* - [[TYPE_STRING|string]]: the values are being compared as strings. No conversion will be done before comparison.
47-
* - [[TYPE_NUMBER|number]]: the values are being compared as numbers. String values will be converted into numbers before comparison.
46+
* @var string the type of the values being compared.
4847
*/
4948
private string $type = self::TYPE_STRING;
5049
/**
@@ -59,7 +58,7 @@ class CompareTo extends Rule
5958
* - `<`: check if value being validated is less than the value being compared with.
6059
* - `<=`: check if value being validated is less than or equal to the value being compared with.
6160
*
62-
* When you want to compare numbers, make sure to also set [[type]] to `number`.
61+
* When you want to compare numbers, make sure to also call {@see asNumber()}.
6362
*/
6463
private string $operator = '==';
6564

src/Rule/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Email extends Rule
2727
private string $pattern = '/^[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/';
2828
/**
2929
* @var string the regular expression used to validateValue email addresses with the name part.
30-
* This property is used only when [[allowName]] is true.
30+
* This property is used only when {@see allowName()} is true.
3131
*
3232
* @see allowName
3333
*/

src/Rule/InRange.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
/**
1515
* In validates that the attribute value is among a list of values.
1616
*
17-
* The range can be specified via the [[range]] property.
18-
* If the [[not]] property is set true, the validator will ensure the attribute value
17+
* The range can be specified via constructor.
18+
* If the {@see InRange::not()} is called, the validator will ensure the attribute value
1919
* is NOT among the specified range.
2020
*/
2121
class InRange extends Rule
@@ -32,7 +32,7 @@ class InRange extends Rule
3232
private bool $strict = false;
3333
/**
3434
* @var bool whether to invert the validation logic. Defaults to false. If set to true,
35-
* the attribute value should NOT be among the list of values defined via [[range]].
35+
* the attribute value should NOT be among the list of values passed via constructor.
3636
*/
3737
private bool $not = false;
3838

src/Rule/Ip.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,24 @@
3131
* ['ip_address', 'ip', 'expandIPv6' => true], // expands IPv6 address to a full notation format
3232
* ```
3333
*
34-
* @property array $ranges The IPv4 or IPv6 ranges that are allowed or forbidden. See [[setRanges()]] for
34+
* @property array $ranges The IPv4 or IPv6 ranges that are allowed or forbidden. See {@see Ip::ranges()} for
3535
* detailed description.
3636
*/
3737
class Ip extends Rule
3838
{
3939
/**
4040
* Negation char.
4141
*
42-
* Used to negate [[ranges]] or [[networks]] or to negate validating value when [[negation]] is set to `true`.
43-
*
44-
* @see allowNegation
45-
* @see networks
46-
* @see ranges
42+
* Used to negate {@see ranges()} or {@see network()} or to negate validating value when {@see allowNegation()}
43+
* is used.
4744
*/
4845
private const NEGATION_CHAR = '!';
4946

5047
/**
5148
* @var array The network aliases, that can be used in {@see ranges()}.
5249
* - key - alias name
5350
* - value - array of strings. String can be an IP range, IP address or another alias. String can be
54-
* negated with [[NEGATION_CHAR]] (independent of `negation` option).
51+
* negated with {@see NEGATION_CHAR} (independent of {@see allowNegation()} option).
5552
*
5653
* The following aliases are defined by default:
5754
* - `*`: `any`
@@ -99,7 +96,7 @@ class Ip extends Rule
9996
private bool $requireSubnet = false;
10097

10198
/**
102-
* @var bool whether address may have a [[NEGATION_CHAR]] character at the beginning.
99+
* @var bool whether address may have a {@see NEGATION_CHAR} character at the beginning.
103100
* Defaults to `false`.
104101
*/
105102
private bool $allowNegation = false;
@@ -151,7 +148,7 @@ class Ip extends Rule
151148
private string $wrongCidr = 'Contains wrong subnet mask.';
152149

153150
/**
154-
* @var string user-defined error message is used when validation fails due to subnet [[subnet]] set to 'only',
151+
* @var string user-defined error message is used when validation fails due to subnet {@see allowSubnet()} is used,
155152
* but the CIDR prefix is not set.
156153
*
157154
* You may use the following placeholders in the message:
@@ -165,7 +162,7 @@ class Ip extends Rule
165162

166163
/**
167164
* @var string user-defined error message is used when validation fails
168-
* due to [[subnet]] is false, but CIDR prefix is present.
165+
* due to {@see allowSubnet()} is false, but CIDR prefix is present.
169166
*
170167
* You may use the following placeholders in the message:
171168
*
@@ -178,7 +175,7 @@ class Ip extends Rule
178175

179176
/**
180177
* @var string user-defined error message is used when validation fails due to IP address
181-
* is not not allowed by [[ranges]] check.
178+
* is not not allowed by {@see ranges()} check.
182179
*
183180
* You may use the following placeholders in the message:
184181
*
@@ -265,7 +262,7 @@ protected function validateValue($value, DataSetInterface $dataSet = null): Resu
265262
*
266263
* The following preparation tasks are performed:
267264
*
268-
* - Recursively substitutes aliases (described in [[networks]]) with their values.
265+
* - Recursively substitutes aliases (described in {@see networks}) with their values.
269266
* - Removes duplicates
270267
*
271268
* @param array $ranges the IPv4 or IPv6 ranges that are allowed or forbidden.
@@ -405,7 +402,7 @@ private function isAllowed(string $ip): bool
405402
}
406403

407404
/**
408-
* Parses IP address/range for the negation with [[NEGATION_CHAR]].
405+
* Parses IP address/range for the negation with {@see NEGATION_CHAR}.
409406
*
410407
* @param $string
411408
*
@@ -420,9 +417,9 @@ private function parseNegatedRange($string): array
420417
}
421418

422419
/**
423-
* Prepares array to fill in [[ranges]].
420+
* Prepares array to fill in {@see ranges}.
424421
*
425-
* - Recursively substitutes aliases, described in [[networks]] with their values,
422+
* - Recursively substitutes aliases, described in {@see networks} with their values,
426423
* - Removes duplicates.
427424
*
428425
* @param array $ranges

src/Rule/MatchRegularExpression.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
use function is_array;
1212

1313
/**
14-
* RegularExpressionValidator validates that the attribute value matches the specified [[pattern]].
14+
* RegularExpressionValidator validates that the attribute value matches the pattern specified in constructor.
1515
*
16-
* If the [[not]] property is set true, the validator will ensure the attribute value do NOT match the [[pattern]].
16+
* If the {@see MatchRegularExpression::not()} is used, the validator will ensure the attribute value do NOT match
17+
* the pattern.
1718
*/
1819
class MatchRegularExpression extends Rule
1920
{
@@ -25,12 +26,15 @@ class MatchRegularExpression extends Rule
2526
private string $pattern;
2627
/**
2728
* @var bool whether to invert the validation logic. Defaults to false. If set to true,
28-
* the regular expression defined via [[pattern]] should NOT match the attribute value.
29+
* the regular expression defined via {@see pattern} should NOT match the attribute value.
2930
*/
3031
private bool $not = false;
3132

3233
private string $message = 'Value is invalid.';
3334

35+
/**
36+
* @param string $pattern The regular expression to be matched with.
37+
*/
3438
public function __construct(string $pattern)
3539
{
3640
$this->pattern = $pattern;

src/Rule/Number.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
/**
1313
* NumberValidator validates that the attribute value is a number.
1414
*
15-
* The format of the number must match the regular expression specified in [[integerPattern]] or [[numberPattern]].
16-
* Optionally, you may configure the [[max]] and [[min]] properties to ensure the number
17-
* is within certain range.
15+
* The format of the number must match the regular expression specified in {@see Number::$integerPattern}
16+
* or {@see Number::$numberPattern}. Optionally, you may configure the {@see Number::max()} and {@see Number::min()}
17+
* to ensure the number is within certain range.
1818
*/
1919
class Number extends Rule
2020
{

src/Rule/Url.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use function strlen;
1414

1515
/**
16-
* UrlValidator validates that the attribute value is a valid http or https URL.
16+
* UrlValidator validates that the attribute value is a valid HTTP or HTTPS URL.
1717
*
1818
* Note that this validator only checks if the URL scheme and host part are correct.
1919
* It does not check the remaining parts of a URL.
@@ -25,7 +25,7 @@ class Url extends Rule
2525
/**
2626
* @var string the regular expression used to validateValue the attribute value.
2727
* The pattern may contain a `{schemes}` token that will be replaced
28-
* by a regular expression which represents the [[validSchemes]].
28+
* by a regular expression which represents the {@see schemes()}.
2929
*/
3030
private string $pattern = '/^{schemes}:\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(?::\d{1,5})?(?:$|[?\/#])/i';
3131
/**

0 commit comments

Comments
 (0)