Skip to content

Commit 45a38ac

Browse files
Merge branch '2.8' into 3.3
* 2.8: [CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction [Filesystem] mirror - fix copying content with same name as source/target. .php_cs.dist - simplify config [WebProfilerBundle] fixed TemplateManager when using Twig 2 without compat interfaces
2 parents 53980fd + 6e7a8bb commit 45a38ac

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

Constraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function __construct($options = null)
141141
$invalidOptions[] = $option;
142142
}
143143
}
144-
} elseif (null !== $options && !(is_array($options) && count($options) === 0)) {
144+
} elseif (null !== $options && !(is_array($options) && 0 === count($options))) {
145145
$option = $this->getDefaultOption();
146146

147147
if (null === $option) {

Constraints/ChoiceValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function validate($value, Constraint $constraint)
7777

7878
$count = count($value);
7979

80-
if ($constraint->min !== null && $count < $constraint->min) {
80+
if (null !== $constraint->min && $count < $constraint->min) {
8181
$this->context->buildViolation($constraint->minMessage)
8282
->setParameter('{{ limit }}', $constraint->min)
8383
->setPlural((int) $constraint->min)
@@ -87,7 +87,7 @@ public function validate($value, Constraint $constraint)
8787
return;
8888
}
8989

90-
if ($constraint->max !== null && $count > $constraint->max) {
90+
if (null !== $constraint->max && $count > $constraint->max) {
9191
$this->context->buildViolation($constraint->maxMessage)
9292
->setParameter('{{ limit }}', $constraint->max)
9393
->setPlural((int) $constraint->max)

Constraints/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function initializeNestedConstraints()
6363
foreach ($this->fields as $fieldName => $field) {
6464
// the XmlFileLoader and YamlFileLoader pass the field Optional
6565
// and Required constraint as an array with exactly one element
66-
if (is_array($field) && count($field) == 1) {
66+
if (is_array($field) && 1 == count($field)) {
6767
$this->fields[$fieldName] = $field = $field[0];
6868
}
6969

Constraints/ImageValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function validate($value, Constraint $constraint)
5454

5555
$size = @getimagesize($value);
5656

57-
if (empty($size) || ($size[0] === 0) || ($size[1] === 0)) {
57+
if (empty($size) || (0 === $size[0]) || (0 === $size[1])) {
5858
$this->context->buildViolation($constraint->sizeNotDetectedMessage)
5959
->setCode(Image::SIZE_NOT_DETECTED_ERROR)
6060
->addViolation();

Constraints/TypeValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function validate($value, Constraint $constraint)
3434
}
3535

3636
$type = strtolower($constraint->type);
37-
$type = $type == 'boolean' ? 'bool' : $constraint->type;
37+
$type = 'boolean' == $type ? 'bool' : $constraint->type;
3838
$isFunction = 'is_'.$type;
3939
$ctypeFunction = 'ctype_'.$type;
4040

Constraints/UuidValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ private function validateStrict($value, Uuid $constraint)
240240
// 0b10xx
241241
// & 0b1100 (12)
242242
// = 0b1000 (8)
243-
if ((hexdec($value[self::STRICT_VARIANT_POSITION]) & 12) !== 8) {
243+
if (8 !== (hexdec($value[self::STRICT_VARIANT_POSITION]) & 12)) {
244244
$this->context->buildViolation($constraint->message)
245245
->setParameter('{{ value }}', $this->formatValue($value))
246246
->setCode(Uuid::INVALID_VARIANT_ERROR)

Mapping/Loader/AbstractLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ protected function addNamespaceAlias($alias, $namespace)
7272
*/
7373
protected function newConstraint($name, $options = null)
7474
{
75-
if (strpos($name, '\\') !== false && class_exists($name)) {
75+
if (false !== strpos($name, '\\') && class_exists($name)) {
7676
$className = (string) $name;
77-
} elseif (strpos($name, ':') !== false) {
77+
} elseif (false !== strpos($name, ':')) {
7878
list($prefix, $className) = explode(':', $name, 2);
7979

8080
if (!isset($this->namespaces[$prefix])) {

0 commit comments

Comments
 (0)