Skip to content

Commit ccc56cb

Browse files
committed
Merge branch 'master' into 3.2-merge
2 parents d3a219e + fea3ffb commit ccc56cb

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/Concerns/ValidatesAttributes.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ public function validateActiveUrl(string $attribute, $value): bool
108108

109109
if ($url = parse_url($value, PHP_URL_HOST)) {
110110
try {
111-
return count(dns_get_record($url . '.', DNS_A | DNS_AAAA)) > 0;
111+
$records = dns_get_record($url . '.', DNS_A | DNS_AAAA);
112+
if (! $records) {
113+
return false;
114+
}
115+
return count($records) > 0;
112116
} catch (Exception) {
113117
return false;
114118
}

src/Rules/ArrayRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
$this->keys = is_array($keys) ? $keys : func_get_args();
3131
}
3232

33-
public function __toString()
33+
public function __toString(): string
3434
{
3535
if (empty($this->keys)) {
3636
return 'array';

src/Rules/ExcludeIf.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ public function __construct($condition)
3636

3737
/**
3838
* Convert the rule to a validation string.
39-
*
40-
* @return string
4139
*/
42-
public function __toString()
40+
public function __toString(): string
4341
{
4442
if (is_callable($this->condition)) {
4543
return call_user_func($this->condition) ? 'exclude' : '';

src/Rules/ProhibitedIf.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ public function __construct($condition)
3838

3939
/**
4040
* Convert the rule to a validation string.
41-
*
42-
* @return string
4341
*/
44-
public function __toString()
42+
public function __toString(): string
4543
{
4644
if (is_callable($this->condition)) {
4745
return call_user_func($this->condition) ? 'prohibited' : '';

tests/Cases/ValidationValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,15 +2858,15 @@ public function testValidateEmail()
28582858
$this->assertFalse($v->passes());
28592859

28602860
$v = new Validator($trans, ['x' => new class implements Stringable {
2861-
public function __toString()
2861+
public function __toString(): string
28622862
{
28632863
return 'aslsdlks';
28642864
}
28652865
}], ['x' => 'Email']);
28662866
$this->assertFalse($v->passes());
28672867

28682868
$v = new Validator($trans, ['x' => new class implements Stringable {
2869-
public function __toString()
2869+
public function __toString(): string
28702870
{
28712871
28722872
}

0 commit comments

Comments
 (0)