Skip to content

Commit

Permalink
Fix phpdocs (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantom409 committed Nov 18, 2020
1 parent e0e0b6b commit 0a540c4
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
Copyright © 2008 by Yii Software (https://www.yiiframework.com/)
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -11,7 +11,7 @@ are met:
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software LLC nor the names of its
* Neither the name of Yii Software nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

Expand Down
1 change: 1 addition & 0 deletions src/DataSetInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function getAttributeValue(string $attribute);

/**
* If there is such attribute in the set
* @return bool
*/
public function hasAttribute(string $attribute): bool;
}
1 change: 1 addition & 0 deletions src/Rule/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ public function disallowSubnet(): self
/**
* The method checks whether the IP address with specified CIDR is allowed according to the [[ranges]] list.
*
* @return bool
* @see ranges
*/
private function isAllowed(string $ip): bool
Expand Down
26 changes: 13 additions & 13 deletions src/Rule/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ private function isValidJson($value): bool
// Regular expression is built based on JSON grammar specified at
// https://tools.ietf.org/html/rfc8259
$regex = <<<'REGEX'
/
(?(DEFINE)
(?<json>(?>\s*(?&object)\s*|\s*(?&array)\s*))
(?<object>(?>\{\s*(?>(?&member)(?>\s*,\s*(?&member))*)?\s*\}))
(?<member>(?>(?&string)\s*:\s*(?&value)))
(?<array>(?>\[\s*(?>(?&value)(?>\s*,\s*(?&value))*)?\s*\]))
(?<value>(?>)false|null|true|(?&object)|(?&array)|(?&number)|(?&string))
(?<number>(?>-?(?>0|[1-9]\d*)(?>\.\d+)?(?>[eE][-+]?\d+)?))
(?<string>(?>"(?>\\(?>["\\\/bfnrt]|u[a-fA-F0-9]{4})|[^"\\\0-\x1F\x7F]+)*"))
)
\A(?&json)\z
/x
REGEX;
/
(?(DEFINE)
(?<json>(?>\s*(?&object)\s*|\s*(?&array)\s*))
(?<object>(?>\{\s*(?>(?&member)(?>\s*,\s*(?&member))*)?\s*\}))
(?<member>(?>(?&string)\s*:\s*(?&value)))
(?<array>(?>\[\s*(?>(?&value)(?>\s*,\s*(?&value))*)?\s*\]))
(?<value>(?>)false|null|true|(?&object)|(?&array)|(?&number)|(?&string))
(?<number>(?>-?(?>0|[1-9]\d*)(?>\.\d+)?(?>[eE][-+]?\d+)?))
(?<string>(?>"(?>\\(?>["\\\/bfnrt]|u[a-fA-F0-9]{4})|[^"\\\0-\x1F\x7F]+)*"))
)
\A(?&json)\z
/x
REGEX;

return is_string($value) && preg_match($regex, $value) === 1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
final class Rules
{
/**
* @var Rule[]
* @var Rule[] $rules
*/
private array $rules = [];

Expand All @@ -24,7 +24,7 @@ public function __construct(iterable $rules = [])
}

/**
* @param Rule|callable
* @param Rule|callable $rule
*/
public function add($rule): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
final class Validator implements ValidatorInterface
{
/**
* @var Rules[]
* @var Rules[] $attributeRules
*/
private array $attributeRules = [];

Expand Down Expand Up @@ -42,7 +42,7 @@ public function validate(DataSetInterface $dataSet): ResultSet

/**
* @param string $attribute
* @param Rule|callable
* @param Rule|callable $rule
*/
public function addRule(string $attribute, $rule): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/ValidatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private function normalizeRules(array $rules)
}

/**
* @param Rule|callable
* @param Rule|callable $rule
*/
private function normalizeRule($rule): Rule
{
Expand Down
3 changes: 2 additions & 1 deletion src/ValidatorFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
interface ValidatorFactoryInterface
{
/**
* @param Rule[]
* @param Rule[] $rules
* @return ValidatorInterface
*/
public function create(array $rules): ValidatorInterface;
}

0 comments on commit 0a540c4

Please sign in to comment.