Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit caf40a7

Browse filesBrowse files
committed
Improve readability
1 parent 4622893 commit caf40a7
Copy full SHA for caf40a7

File tree

2 files changed

+16
-20
lines changed
Filter options

2 files changed

+16
-20
lines changed

‎src/Symfony/Component/Validator/Constraints/Count.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/Count.php
+8-10Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ class Count extends Constraint
3838

3939
public function __construct($options = null)
4040
{
41-
if (null !== $options) {
42-
if (!\is_array($options)) {
43-
$options = [
44-
'min' => $options,
45-
'max' => $options,
46-
];
47-
} elseif (isset($options['value']) && !isset($options['min']) && !isset($options['max'])) {
48-
$options['min'] = $options['max'] = $options['value'];
49-
unset($options['value']);
50-
}
41+
if (null !== $options && !\is_array($options)) {
42+
$options = [
43+
'min' => $options,
44+
'max' => $options,
45+
];
46+
} elseif (\is_array($options) && isset($options['value']) && !isset($options['min']) && !isset($options['max'])) {
47+
$options['min'] = $options['max'] = $options['value'];
48+
unset($options['value']);
5149
}
5250

5351
parent::__construct($options);

‎src/Symfony/Component/Validator/Constraints/Length.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/Length.php
+8-10Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ class Length extends Constraint
4242

4343
public function __construct($options = null)
4444
{
45-
if (null !== $options) {
46-
if (!\is_array($options)) {
47-
$options = [
48-
'min' => $options,
49-
'max' => $options,
50-
];
51-
} elseif (isset($options['value']) && !isset($options['min']) && !isset($options['max'])) {
52-
$options['min'] = $options['max'] = $options['value'];
53-
unset($options['value']);
54-
}
45+
if (null !== $options && !\is_array($options)) {
46+
$options = [
47+
'min' => $options,
48+
'max' => $options,
49+
];
50+
} elseif (\is_array($options) && isset($options['value']) && !isset($options['min']) && !isset($options['max'])) {
51+
$options['min'] = $options['max'] = $options['value'];
52+
unset($options['value']);
5553
}
5654

5755
parent::__construct($options);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.