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

Skip to content

Commit d86a3f3

Browse files
Merge branch '2.7' into 2.8
* 2.7: [ci] Phpunit tests wont run if composer is installed in a wrapper [ci] Add version tag in phpunit wrapper to trigger cache-reset on demand fix race condition at mkdir (#16258) [VarDumper] Fix PHP7 type-hints compat [Bridge] [PhpUnit] fixes documentation markup. [PropertyAccess] Port of the performance optimization from 2.3 trigger deprecation warning when using empty_value [PropertyAccess] Test access to dynamic properties [PropertyAccess] Fix dynamic property accessing. [Serializer] GetSetNormalizer shouldn't set/get static methods [Serializer] PropertyNormalizer shouldn't set static properties JsonDescriptor - encode container params only once Conflicts: src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
2 parents b2afc32 + 1bc1931 commit d86a3f3

File tree

21 files changed

+384
-132
lines changed

21 files changed

+384
-132
lines changed

phpunit

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#!/usr/bin/env php
22
<?php
33

4+
/*
5+
* This file is part of the Symfony package.
6+
*
7+
* (c) Fabien Potencier <fabien@symfony.com>
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
13+
// Please update when phpunit needs to be reinstalled with fresh deps:
14+
// Cache-Id-Version: 2015-11-09 12:13 UTC
15+
416
use Symfony\Component\Process\ProcessUtils;
517

618
error_reporting(-1);
@@ -10,19 +22,11 @@ require __DIR__.'/src/Symfony/Component/Process/ProcessUtils.php';
1022
$PHPUNIT_VERSION = PHP_VERSION_ID >= 70000 ? '5.0' : '4.8';
1123
$PHPUNIT_DIR = __DIR__.'/.phpunit';
1224
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
13-
14-
if (!file_exists($COMPOSER = __DIR__.'/composer.phar')) {
15-
$COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : (`which composer.phar` ?: `which composer`));
16-
if (!file_exists($COMPOSER)) {
17-
stream_copy_to_stream(
18-
fopen('https://getcomposer.org/composer.phar', 'rb'),
19-
fopen($COMPOSER = __DIR__.'/composer.phar', 'wb')
20-
);
21-
}
22-
}
23-
2425
$PHP = ProcessUtils::escapeArgument($PHP);
25-
$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER);
26+
27+
$COMPOSER = file_exists($COMPOSER = __DIR__.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : `which composer.phar`))
28+
? $PHP.' '.ProcessUtils::escapeArgument($COMPOSER)
29+
: 'composer';
2630

2731
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.md5")) {
2832
// Build a standalone phpunit without symfony/yaml

src/Symfony/Bridge/PhpUnit/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ It comes with the following features:
1212

1313
By default any non-legacy-tagged or any non-@-silenced deprecation notices will
1414
make tests fail.
15-
This can be changed by setting the SYMFONY_DEPRECATIONS_HELPER environment
15+
This can be changed by setting the `SYMFONY_DEPRECATIONS_HELPER` environment
1616
variable to `weak`. This will make the bridge ignore deprecation notices and
1717
is useful to projects that must use deprecated interfaces for backward
1818
compatibility reasons.
@@ -33,7 +33,7 @@ A summary of deprecation notices is displayed at the end of the test suite:
3333
Usage
3434
-----
3535

36-
Add this bridge to the `require-dev` section of your composer.json file
36+
Add this bridge to the `require-dev` section of your `composer.json` file
3737
(not in `require`) with e.g. `composer require --dev "symfony/phpunit-bridge"`.
3838

3939
When running `phpunit`, you will see a summary of deprecation notices at the end

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function describeContainerParameter($parameter, array $options = array
157157
{
158158
$key = isset($options['parameter']) ? $options['parameter'] : '';
159159

160-
$this->writeData(array($key => $this->formatParameter($parameter)), $options);
160+
$this->writeData(array($key => $parameter), $options);
161161
}
162162

163163
/**

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public function getDescribeContainerParameterTestData()
118118
$data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter());
119119

120120
$data[0][] = array('parameter' => 'database_name');
121+
$data[1][] = array('parameter' => 'twig.form.resources');
121122

122123
return $data;
123124
}

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,16 @@ public static function getContainerParameter()
7272
{
7373
$builder = new ContainerBuilder();
7474
$builder->setParameter('database_name', 'symfony');
75+
$builder->setParameter('twig.form.resources', array(
76+
'bootstrap_3_horizontal_layout.html.twig',
77+
'bootstrap_3_layout.html.twig',
78+
'form_div_layout.html.twig',
79+
'form_table_layout.html.twig',
80+
));
7581

7682
return array(
7783
'parameter' => $builder,
84+
'array_parameter' => $builder,
7885
);
7986
}
8087

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
< E377 /code>
1+
{
2+
"twig.form.resources": ["bootstrap_3_horizontal_layout.html.twig", "bootstrap_3_layout.html.twig", "form_div_layout.html.twig", "form_table_layout.html.twig"]
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
twig.form.resources
2+
===================
3+
4+
["bootstrap_3_horizontal_layout.html.twig","bootstrap_3_layo...
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["bootstrap_3_horizontal_layout.html.twig","bootstrap_3_layo...
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<parameter key="twig.form.resources">["bootstrap_3_horizontal_layout.html.twig","bootstrap_3_layo...</parameter>

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,8 @@ public function configureOptions(OptionsResolver $resolver)
248248
return '';
249249
};
250250

251-
$emptyValue = function (Options $options) {
252-
return $options['required'] ? null : '';
253-
};
254-
255-
// for BC with the "empty_value" option
256251
$placeholder = function (Options $options) {
257-
return $options['empty_value'];
252+
return $options['required'] ? null : '';
258253
};
259254

260255
$choiceListNormalizer = function (Options $options, $choiceList) use ($choiceListFactory) {
@@ -287,6 +282,12 @@ public function configureOptions(OptionsResolver $resolver)
287282
};
288283

289284
$placeholderNormalizer = function (Options $options, $placeholder) {
285+
if (!is_object($options['empty_value']) || !$options['empty_value'] instanceof \Exception) {
286+
@trigger_error('The form option "empty_value" is deprecated since version 2.6 and will be removed in 3.0. Use "placeholder" instead.', E_USER_DEPRECATED);
287+
288+
$placeholder = $options['empty_value'];
289+
}
290+
290291
if ($options['multiple']) {
291292
// never use an empty value for this case
292293
return;
@@ -328,7 +329,7 @@ public function configureOptions(OptionsResolver $resolver)
328329
'preferred_choices' => array(),
329330
'group_by' => null,
330331
'empty_data' => $emptyData,
331-
'empty_value' => $emptyValue, // deprecated
332+
'empty_value' => new \Exception(), // deprecated
332333
'placeholder' => $placeholder,
333334
'error_bubbling' => false,
334335
'compound' => $compound,
@@ -340,7 +341,6 @@ public function configureOptions(OptionsResolver $resolver)
340341
));
341342

342343
$resolver->setNormalizer('choice_list', $choiceListNormalizer);
343-
$resolver->setNormalizer('empty_value', $placeholderNormalizer);
344344
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
345345
$resolver->setNormalizer('choice_translation_domain', $choiceTranslationDomainNormalizer);
346346

0 commit comments

Comments
 (0)
0