Skip to content

Commit 59c08ed

Browse files
committed
[Validator] fixed coding standard issues
1 parent 2118521 commit 59c08ed

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/Symfony/Component/Validator/ConstraintViolation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class ConstraintViolation implements ConstraintViolationInterface
5353
*/
5454
public function __construct($message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, $code = null, Constraint $constraint = null, $cause = null)
5555
{
56-
if (!(NULL === $message || is_string($message) || (is_object($message) && method_exists($message, '__toString' )))) {
57-
throw new InvalidArgumentException("Constraint violation message should be a string or an object which implements the __toString() method.");
56+
if (!(null === $message || \is_string($message) || (\is_object($message) && method_exists($message, '__toString')))) {
57+
throw new InvalidArgumentException('Constraint violation message should be a string or an object which implements the __toString() method.');
5858
}
5959
$this->message = $message;
6060
$this->messageTemplate = $messageTemplate;

src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testToStringHandlesArrays()
3535
Array
3636
EOF;
3737

38-
$this->assertSame($expected, (string)$violation);
38+
$this->assertSame($expected, (string) $violation);
3939
}
4040

4141
public function testToStringHandlesArrayRoots()
@@ -54,7 +54,7 @@ public function testToStringHandlesArrayRoots()
5454
42 cannot be used here
5555
EOF;
5656

57-
$this->assertSame($expected, (string)$violation);
57+
$this->assertSame($expected, (string) $violation);
5858
}
5959

6060
public function testToStringHandlesCodes()
@@ -75,7 +75,7 @@ public function testToStringHandlesCodes()
7575
42 cannot be used here (code 0)
7676
EOF;
7777

78-
$this->assertSame($expected, (string)$violation);
78+
$this->assertSame($expected, (string) $violation);
7979
}
8080

8181
public function testToStringOmitsEmptyCodes()
@@ -96,7 +96,7 @@ public function testToStringOmitsEmptyCodes()
9696
null
9797
);
9898

99-
$this->assertSame($expected, (string)$violation);
99+
$this->assertSame($expected, (string) $violation);
100100

101101
$violation = new ConstraintViolation(
102102
'42 cannot be used here',
@@ -109,7 +109,7 @@ public function testToStringOmitsEmptyCodes()
109109
''
110110
);
111111

112-
$this->assertSame($expected, (string)$violation);
112+
$this->assertSame($expected, (string) $violation);
113113
}
114114

115115
public function testMessageCanBeStringableObject()
@@ -128,7 +128,7 @@ public function testMessageCanBeStringableObject()
128128
Root.property.path:
129129
toString
130130
EOF;
131-
$this->assertSame($expected, (string)$violation);
131+
$this->assertSame($expected, (string) $violation);
132132
$this->assertSame($message, $violation->getMessage());
133133
}
134134

@@ -157,5 +157,4 @@ public function testMessageObjectMustBeStringable()
157157
null
158158
);
159159
}
160-
161160
}

0 commit comments

Comments
 (0)