Skip to content

Commit d6b3ad8

Browse files
eliecharranorberttech
authored andcommitted
[2.3] Fix bad encoding in Repeat expander (#113)
* Fix encoding * Fix tests
1 parent 7b2cb77 commit d6b3ad8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Matcher/Pattern/Expander/Repeat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function matchScalar(array $values, Matcher $matcher)
100100
$match = $matcher->match($value, $this->pattern);
101101

102102
if (!$match) {
103-
$this->error = sprintf("Repeat expander, entry n°%d, find error : %s", $index, $matcher->getError());
103+
$this->error = sprintf("Repeat expander, entry n°%d, find error : %s", $index, $matcher->getError());
104104
return false;
105105
}
106106
}
@@ -129,14 +129,14 @@ private function matchJson(array $values, Matcher $matcher)
129129

130130
foreach ($patternKeys as $key) {
131131
if (!array_key_exists($key, $value)) {
132-
$this->error = sprintf("Repeat expander, entry n°%d, require \"array\" to have key \"%s\".", $index, $key);
132+
$this->error = sprintf("Repeat expander, entry n°%d, require \"array\" to have key \"%s\".", $index, $key);
133133
return false;
134134
}
135135

136136
$match = $matcher->match($value[$key], $this->pattern[$key]);
137137

138138
if (!$match) {
139-
$this->error = sprintf("Repeat expander, entry n°%d, key \"%s\", find error : %s", $index, $key, $matcher->getError());
139+
$this->error = sprintf("Repeat expander, entry n°%d, key \"%s\", find error : %s", $index, $key, $matcher->getError());
140140
return false;
141141
}
142142
}

tests/Matcher/Pattern/Expander/RepeatTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public static function invalidCasesProvider()
7070
);
7171

7272
return array(
73-
array($pattern, $valueTest, 'Repeat expander, entry n°0, key "name", find error : integer "1" is not a valid string.'),
74-
array($pattern, $keyTest, 'Repeat expander, entry n°0, require "array" to have key "name".'),
73+
array($pattern, $valueTest, 'Repeat expander, entry n°0, key "name", find error : integer "1" is not a valid string.'),
74+
array($pattern, $keyTest, 'Repeat expander, entry n°0, require "array" to have key "name".'),
7575
array($pattern, $strictTest, 'Repeat expander expect to have 2 keys in array but get : 3'),
7676
array($pattern, "", 'Repeat expander require "array", got "".')
7777
);

0 commit comments

Comments
 (0)