8000 Merge branch '2.7' into 2.8 · symfony/symfony@17670e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 17670e4

Browse files
Merge branch '2.7' into 2.8
* 2.7: [DI] use assertStringEqualsFile when possible [VarDumper] Adapt to php 7.2 changes [Form][TwigBridge] Don't render _method in form_rest() for a child form [Validator] Fix IbanValidator for ukrainian IBANs
2 parents 7428aba + 072c866 commit 17670e4

File tree

7 files changed

+49
-19
lines changed

7 files changed

+49
-19
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
{% endif %}
309309
{%- endfor %}
310310

311-
{% if not form.methodRendered %}
311+
{% if not form.methodRendered and form.parent is null %}
312312
{%- do form.setMethodRendered() -%}
313313
{% set method = method|upper %}
314314
{%- if method in ["GET", "POST"] -%}

src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ public function testAddService()
119119
// without compilation
120120
$container = include self::$fixturesPath.'/containers/container9.php';
121121
$dumper = new PhpDumper($container);
122-
$this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services9.php')), $dumper->dump(), '->dump() dumps services');
122+
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services9.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services');
123123

124124
// with compilation
125125
$container = include self::$fixturesPath.'/containers/container9.php';
126126
$container->compile();
127127
$dumper = new PhpDumper($container);
128-
$this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services9_compiled.php')), $dumper->dump(), '->dump() dumps services');
128+
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services');
129129

130130
$dumper = new PhpDumper($container = new ContainerBuilder());
131131
$container->register('foo', 'FooClass')->addArgument(new \stdClass());
@@ -145,7 +145,7 @@ public function testLegacySynchronizedServices()
145145
{
146146
$container = include self::$fixturesPath.'/containers/container20.php';
147147
$dumper = new PhpDumper($container);
148-
$this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services20.php')), $dumper->dump(), '->dump() dumps services');
148+
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services20.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services');
149149
}
150150

151151
public function testServicesWithAnonymousFactories()

src/Symfony/Component/Validator/Constraints/IbanValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class IbanValidator extends ConstraintValidator
3434
* a BBAN (Basic Bank Account Number) which has a fixed length per country and,
3535
* included within it, a bank identifier with a fixed position and a fixed length per country
3636
*
37-
* @see http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf
37+
* @see https://www.swift.com/sites/default/files/resources/iban_registry.pdf
3838
*
3939
* @var array
4040
*/
@@ -130,7 +130,7 @@ class IbanValidator extends ConstraintValidator
130130
'TL' => 'TL\d{2}\d{3}\d{14}\d{2}', // Timor-Leste
131131
'TN' => 'TN59\d{2}\d{3}\d{13}\d{2}', // Tunisia
132132
'TR' => 'TR\d{2}\d{5}[\dA-Z]{1}[\dA-Z]{16}', // Turkey
133-
'UA' => 'UA\d{2}[A-Z]{6}[\dA-Z]{19}', // Ukraine
133+
'UA' => 'UA\d{2}\d{6}[\dA-Z]{19}', // Ukraine
134134
'VG' => 'VG\d{2}[A-Z]{4}\d{16}', // Virgin Islands, British
135135
'WF' => 'FR\d{2}\d{5}\d{5}[\dA-Z]{11}\d{2}', // Wallis and Futuna Islands
136136
'XK' => 'XK\d{2}\d{4}\d{1 9E88 0}\d{2}', // Republic of Kosovo

src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function getValidIbans()
118118

119119
//Extended country list
120120
//http://www.nordea.com/Our+services/International+products+and+services/Cash+Management/IBAN+countries/908462.html
121-
// http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf
121+
// https://www.swift.com/sites/default/files/resources/iban_registry.pdf
122122
array('AO06000600000100037131174'), //Angola
123123
array('AZ21NABZ00000000137010001944'), //Azerbaijan
124124
array('BH29BMAG1299123456BH00'), //Bahrain
@@ -156,6 +156,7 @@ public function getValidIbans()
156156
array('TL380080012345678910157'), //Timor-Leste
157157
array('TN5914207207100707129648'), //Tunisia
158158
array('TR330006100519786457841326'), //Turkey
159+
array('UA213223130000026007233566001'), //Ukraine
159160
array('AE260211000000230064016'), //United Arab Emirates
160161
);
161162
}
@@ -268,6 +269,7 @@ public function getIbansWithInvalidFormat()
268269
array('TL3800800123456789101571'), //Timor-Leste
269270
array('TN59142072071007071296481'), //Tunisia
270271
array('TR3300061005197864578413261'), //Turkey
272+
array('UA21AAAA1300000260072335660012'), //Ukraine
271273
array('AE2602110000002300640161'), //United Arab Emirates
272274
);
273275
}
@@ -377,6 +379,7 @@ public function getIbansWithValidFormatButIncorrectChecksum()
377379
array('TL380080012345678910158'), //Timor-Leste
378380
array('TN5914207207100707129649'), //Tunisia
379381
array('TR330006100519786457841327'), //Turkey
382+
array('UA213223130000026007233566002'), //Ukraine
380383
array('AE260211000000230064017'), //United Arab Emirates
381384
);
382385
}

src/Symfony/Component/VarDumper/Caster/Caster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function castObject($obj, \ReflectionClass $reflector)
5454
if ($a) {
5555
$p = array_keys($a);
5656
foreach ($p as $i => $k) {
57-
if (isset($k[0]) && "\0" !== $k[0] && !$reflector->hasProperty($k)) {
57+
if (isset($k[0]) ? "\0" !== $k[0] && !$reflector->hasProperty($k) : \PHP_VERSION_ID >= 70200) {
5858
$p[$i] = self::PREFIX_DYNAMIC.$k;
5959
} elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
6060
$p[$i] = "\0".$reflector->getParentClass().'@anonymous'.strrchr($k, "\0");

src/Symfony/Component/VarDumper/Tests/CliDumperTest.php

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,35 +143,62 @@ public function testJsonCast()
143143
$var[] = &$v;
144144
$var[''] = 2;
145145

146-
$this->assertDumpMatchesFormat(
147-
<<<'EOTXT'
146+
if (\PHP_VERSION_ID >= 70200) {
147+
$this->assertDumpMatchesFormat(
148+
<<<'EOTXT'
149+
array:4 [
150+
0 => {}
151+
1 => &1 null
152+
2 => &1 null
153+
"" => 2
154+
]
155+
EOTXT
156+
,
157+
$var
158+
);
159+
} else {
160+
$this->assertDumpMatchesFormat(
161+
<<<'EOTXT'
148162
array:4 [
149163
"0" => {}
150164
"1" => &1 null
151165
0 => &1 null
152166
"" => 2
153167
]
154168
EOTXT
155-
,
156-
$var
157-
);
169+
,
170+
$var
171+
);
172+
}
158173
}
159174

160175
public function testObjectCast()
161176
{
162177
$var = (object) array(1 = F987 > 1);
163178
$var->{1} = 2;
164179

165-
$this->assertDumpMatchesFormat(
166-
<<<'EOTXT'
180+
if (\PHP_VERSION_ID >= 70200) {
181+
$this->assertDumpMatchesFormat(
182+
<<<'EOTXT'
183+
{
184+
+"1": 2
185+
}
186+
EOTXT
187+
,
188+
$var
189+
);
190+
} else {
191+
$this->assertDumpMatchesFormat(
192+
<<<'EOTXT'
167193
{
168194
+1: 1
169195
+"1": 2
170196
}
171197
EOTXT
172-
,
173-
$var
174-
);
198+
,
199+
$var
200+
);
201+
}
175202
}
176203

177204
public function testClosedResource()

src/Symfony/Component/VarDumper/Tests/VarClonerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function testJsonCast()
203203
EOTXT;
204204
ob_start();
205205
var_dump($clone);
206-
$this->assertStringMatchesFormat($expected, ob_get_clean());
206+
$this->assertStringMatchesFormat(\PHP_VERSION_ID >= 70200 ? str_replace('"1"', '1', $expected) : $expected, ob_get_clean());
207207
}
208208

209209
public function testCaster()

0 commit comments

Comments
 (0)
0