Skip to content

Commit 9bcb041

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: bug #40427 [Console] Stop accepting ints as InputOption defaults Fix fingerprint when context is not serializable Fix `ConstraintViolation#getMessageTemplate()` to always return `string`
2 parents e197b56 + 09c5430 commit 9bcb041

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ConstraintViolation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function __toString()
100100
*/
101101
public function getMessageTemplate()
102102
{
103-
return $this->messageTemplate;
103+
return (string) $this->messageTemplate;
104104
}
105105

106106
/**

Tests/ConstraintViolationTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,19 @@ public function testRetrievedPropertyPathIsAStringEvenIfNotSet()
171171
))->getPropertyPath()
172172
);
173173
}
174+
175+
public function testRetrievedMessageTemplateIsAStringEvenIfNotSet()
176+
{
177+
self::assertSame(
178+
'',
179+
(new ConstraintViolation(
180+
'irrelevant',
181+
null,
182+
[],
183+
'irrelevant',
184+
'irrelevant',
185+
null
186+
))->getMessageTemplate()
187+
);
188+
}
174189
}

0 commit comments

Comments
 (0)