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

Skip to content

Commit e70bec9

Browse files
Merge branch '2.7' into 2.8
* 2.7: [2.7] Clean deprecated interfaces use new repo location in some readme.md [Validator] Cleanup a test
2 parents ce5bb62 + ae64324 commit e70bec9

25 files changed

+93
-21
lines changed

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
1919
{
2020
/**
2121
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
22+
* @group legacy
2223
*/
2324
public function testItOnlyWorksWithQueryBuilderOrClosure()
2425
{

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testCollapsedEntityField()
9090
$this->setMaxRunningTime(1);
9191

9292
for ($i = 0; $i < 40; ++$i) {
93-
$form = $this->factory->create('entity', null, array(
93+
$form = $this->factory->create('Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
9494
'class' => self::ENTITY_CLASS,
9595
));
9696

@@ -108,7 +108,7 @@ public function testCollapsedEntityFieldWithChoices()
108108
$this->setMaxRunningTime(1);
109109

110110
for ($i = 0; $i < 40; ++$i) {
111-
$form = $this->factory->create('entity', null, array(
111+
$form = $this->factory->create('Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
112112
'class' => self::ENTITY_CLASS,
113113
'choices' => $choices,
114114
));
@@ -127,7 +127,7 @@ public function testCollapsedEntityFieldWithPreferredChoices()
127127
$this->setMaxRunningTime(1);
128128

129129
for ($i = 0; $i < 40; ++$i) {
130-
$form = $this->factory->create('entity', null, array(
130+
$form = $this->factory->create('Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
131131
'class' => self::ENTITY_CLASS,
132132
'preferred_choices' => $choices,
133133
));

src/Symfony/Component/BrowserKit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Resources
1010
---------
1111

1212
For a simple implementation of a browser based on an HTTP layer, have a look
13-
at [Goutte](https://github.com/fabpot/Goutte).
13+
at [Goutte](https://github.com/FriendsOfPHP/Goutte).
1414

1515
For an implementation based on HttpKernelInterface, have a look at the
1616
[Client](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Client.php)

src/Symfony/Component/Form/ChoiceList/Factory/CachingFactoryDecorator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function createListFromChoices($choices, $value = null)
141141
* @deprecated Added for backwards compatibility in Symfony 2.7, to be
142142
* removed in Symfony 3.0.
143143
*/
144-
public function createListFromFlippedChoices($choices, $value = null)
144+
public function createListFromFlippedChoices($choices, $value = null, $triggerDeprecationNotice = true)
145145
{
146146
if ($choices instanceof \Traversable) {
147147
$choices = iterator_to_array($choices);
@@ -158,7 +158,7 @@ public function createListFromFlippedChoices($choices, $value = null)
158158
$hash = self::generateHash(array($flatChoices, $value), 'fromFlippedChoices');
159159

160160
if (!isset($this->lists[$hash])) {
161-
$this->lists[$hash] = $this->decoratedFactory->createListFromFlippedChoices($choices, $value);
161+
$this->lists[$hash] = $this->decoratedFactory->createListFromFlippedChoices($choices, $value, $triggerDeprecationNotice);
162162
}
163163

164164
return $this->lists[$hash];

src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ public function createListFromChoices($choices, $value = null)
4343
* @deprecated Added for backwards compatibility in Symfony 2.7, to be
4444
* removed in Symfony 3.0.
4545
*/
46-
public function createListFromFlippedChoices($choices, $value = null)
46+
public function createListFromFlippedChoices($choices, $value = null, $triggerDeprecationNotice = true)
4747
{
48+
if ($triggerDeprecationNotice) {
49+
@trigger_error('The '.__METHOD__.' is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
50+
}
51+
4852
return new ArrayKeyChoiceList($choices, $value);
4953
}
5054

src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ public function createListFromChoices($choices, $value = null)
116116
* @deprecated Added for backwards compatibility in Symfony 2.7, to be
117117
* removed in Symfony 3.0.
118118
*/
119-
public function createListFromFlippedChoices($choices, $value = null)
119+
public function createListFromFlippedChoices($choices, $value = null, $triggerDeprecationNotice = true)
120120
{
121121
// Property paths are not supported here, because array keys can never
122122
// be objects
123-
return $this->decoratedFactory->createListFromFlippedChoices($choices, $value);
123+
return $this->decoratedFactory->createListFromFlippedChoices($choices, $value, $triggerDeprecationNotice);
124124
}
125125

126126
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public function configureOptions(OptionsResolver $resolver)
280280

281281
// BC when choices are in the keys, not in the values
282282
if (!$options['choices_as_values']) {
283-
return $choiceListFactory->createListFromFlippedChoices($choices, $options['choice_value']);
283+
return $choiceListFactory->createListFromFlippedChoices($choices, $options['choice_value'], false);
284284
}
285285

286286
return $choiceListFactory->createListFromChoices($choices, $options['choice_value']);

src/Symfony/Component/Form/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Resources
1010

1111
Silex integration:
1212

13-
https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/FormServiceProvider.php
13+
https://github.com/silexphp/Silex/blob/master/src/Silex/Provider/FormServiceProvider.php
1414

1515
Documentation:
1616

src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ public function testCreateFromChoicesDifferentValueClosure()
155155
$this->assertSame($list2, $this->factory->createListFromChoices($choices, $closure2));
156156
}
157157

158+
/**
159+
* @group legacy
160+
*/
158161
public function testCreateFromFlippedChoicesEmpty()
159162
{
160163
$list = new \stdClass();
@@ -168,6 +171,9 @@ public function testCreateFromFlippedChoicesEmpty()
168171
$this->assertSame($list, $this->factory->createListFromFlippedChoices(array()));
169172
}
170173

174+
/**
175+
* @group legacy
176+
*/
171177
public function testCreateFromFlippedChoicesComparesTraversableChoicesAsArray()
172178
{
173179
// The top-most traversable is converted to an array
@@ -184,6 +190,9 @@ public function testCreateFromFlippedChoicesComparesTraversableChoicesAsArray()
184190
$this->assertSame($list, $this->factory->createListFromFlippedChoices($choices2));
185191
}
186192

193+
/**
194+
* @group legacy
195+
*/
187196
public function testCreateFromFlippedChoicesFlattensChoices()
188197
{
189198
$choices1 = array('key' => array('a' => 'A'));
@@ -201,6 +210,7 @@ public function testCreateFromFlippedChoicesFlattensChoices()
201210

202211
/**
203212
* @dataProvider provideSameKeyChoices
213+
* @group legacy
204214
*/
205215
public function testCreateFromFlippedChoicesSameChoices($choice1, $choice2)
206216
{
@@ -219,6 +229,7 @@ public function testCreateFromFlippedChoicesSameChoices($choice1, $choice2)
219229

220230
/**
221231
* @dataProvider provideDistinguishedKeyChoices
232+
* @group legacy
222233
*/
223234
public function testCreateFromFlippedChoicesDifferentChoices($choice1, $choice2)
224235
{
@@ -240,6 +251,9 @@ public function testCreateFromFlippedChoicesDifferentChoices($choice1, $choice2)
240251
$this->assertSame($list2, $this->factory->createListFromFlippedChoices($choices2));
241252
}
242253

254+
/**
255+
* @group legacy
256+
*/
243257
public function testCreateFromFlippedChoicesSameValueClosure()
244258
{
245259
$choices = array(1);
@@ -255,6 +269,9 @@ public function testCreateFromFlippedChoicesSameValueClosure()
255269
$this->assertSame($list, $this->factory->createListFromFlippedChoices($choices, $closure));
256270
}
257271

272+
/**
273+
* @group legacy
274+
*/
258275
public function testCreateFromFlippedChoicesDifferentValueClosure()
259276
{
260277
$choices = array(1);

src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ function ($object) { return $object->value; }
193193
$this->assertObjectListWithCustomValues($list);
194194
}
195195

196+
/**
197+
* @group legacy
198+
*/
196199
public function testCreateFromFlippedChoicesEmpty()
197200
{
198201
$list = $this->factory->createListFromFlippedChoices(array());
@@ -201,6 +204,9 @@ public function testCreateFromFlippedChoicesEmpty()
201204
$this->assertSame(array(), $list->getValues());
202205
}
203206

207+
/**
208+
* @group legacy
209+
*/
204210
public function testCreateFromFlippedChoicesFlat()
205211
{
206212
$list = $this->factory->createListFromFlippedChoices(
@@ -210,6 +216,9 @@ public function testCreateFromFlippedChoicesFlat()
210216
$this->assertScalarListWithChoiceValues($list);
211217
}
212218

219+
/**
220+
* @group legacy
221+
*/
213222
public function testCreateFromFlippedChoicesFlatTraversable()
214223
{
215224
$list = $this->factory->createListFromFlippedChoices(
@@ -219,6 +228,9 @@ public function testCreateFromFlippedChoicesFlatTraversable()
219228
$this->assertScalarListWithChoiceValues($list);
220229
}
221230

231+
/**
232+
* @group legacy
233+
*/
222234
public function testCreateFromFlippedChoicesFlatValuesAsCallable()
223235
{
224236
$list = $this->factory->createListFromFlippedChoices(
@@ -229,6 +241,9 @@ public function testCreateFromFlippedChoicesFlatValuesAsCallable()
229241
$this->assertScalarListWithCustomValues($list);
230242
}
231243

244+
/**
245+
* @group legacy
246+
*/
232247
public function testCreateFromFlippedChoicesFlatValuesAsClosure()
233248
{
234249
$list = $this->factory->createListFromFlippedChoices(
@@ -246,6 +261,9 @@ function ($choice) {
246261
$this->assertScalarListWithCustomValues($list);
247262
}
248263

264+
/**
265+
* @group legacy
266+
*/
249267
public function testCreateFromFlippedChoicesGrouped()
250268
{
251269
$list = $this->factory->createListFromFlippedChoices(
@@ -258,6 +276,9 @@ public function testCreateFromFlippedChoicesGrouped()
258276
$this->assertScalarListWithChoiceValues($list);
259277
}
260278

279+
/**
280+
* @group legacy
281+
*/
261282
public function testCreateFromFlippedChoicesGroupedTraversable()
262283
{
263284
$list = $this->factory->createListFromFlippedChoices(
@@ -270,6 +291,9 @@ public function testCreateFromFlippedChoicesGroupedTraversable()
270291
$this->assertScalarListWithChoiceValues($list);
271292
}
272293

294+
/**
295+
* @group legacy
296+
*/
273297
public function testCreateFromFlippedChoicesGroupedValuesAsCallable()
274298
{
275299
$list = $this->factory->createListFromFlippedChoices(
@@ -283,6 +307,9 @@ public function testCreateFromFlippedChoicesGroupedValuesAsCallable()
283307
$this->assertScalarListWithCustomValues($list);
284308
}
285309

310+
/**
311+
* @group legacy
312+
*/
286313
public function testCreateFromFlippedChoicesGroupedValuesAsClosure()
287314
{
288315
$list = $this->factory->createListFromFlippedChoices(

src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public function testCreateFromChoicesPropertyPathInstance()
6363
$this->assertSame(array('value'), $this->factory->createListFromChoices($choices, new PropertyPath('property')));
6464
}
6565

66+
/**
67+
* @group legacy
68+
*/
6669
public function testCreateFromFlippedChoices()
6770
{
6871
// Property paths are not supported here, because array keys can never

src/Symfony/Compon 10000 ent/Form/Tests/ChoiceList/LegacyChoiceListAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
/**
1818
* @author Bernhard Schussek <bschussek@gmail.com>
19+
* @group legacy
1920
*/
2021
class LegacyChoiceListAdapterTest extends \PHPUnit_Framework_TestCase
2122
{

src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,7 @@ public function testPassPlaceholderToView($multiple, $expanded, $required, $plac
15391539

15401540
/**
15411541
* @dataProvider getOptionsWithPlaceholder
1542+
* @group legacy
15421543
*/
15431544
public function testPassEmptyValueBC($multiple, $expanded, $required, $placeholder, $viewValue)
15441545
{

src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ public function testPassPlaceholderAsString()
338338
$this->assertSame('Empty', $view['time']['second']->vars['placeholder']);
339339
}
340340

341+
/**
342+
* @group legacy
343+
*/
341344
public function testPassEmptyValueBC()
342345
{
343346
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(

src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ public function testPassPlaceholderAsString()
7 97AE 69769
$this->assertSame('Empty', $view['day']->vars['placeholder']);
770770
}
771771

772+
/**
773+
* @group legacy
774+
*/
772775
public function testPassEmptyValueBC()
773776
{
774777
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(

src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@ public function testPassPlaceholderAsString()
572572
$this->assertSame('Empty', $view['second']->vars['placeholder']);
573573
}
574574

575+
/**
576+
* @group legacy
577+
*/
575578
public function testPassEmptyValueBC()
576579
{
577580
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(

src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public function test2Dot5ValidationApi()
4848
$this->assertInstanceOf('Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser', $guesser);
4949
}
5050

51+
/**
52+
* @group legacy
53+
*/
5154
public function test2Dot4ValidationApi()
5255
{
5356
$factory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
@@ -82,6 +85,7 @@ public function test2Dot4ValidationApi()
8285

8386
/**
8487
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
88+
* @group legacy
8589
*/
8690
public function testInvalidValidatorInterface()
8791
{

src/Symfony/Component/Translation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Resources
2424

2525
Silex integration:
2626

27-
https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php
27+
https://github.com/silexphp/Silex/blob/master/src/Silex/Provider/TranslationServiceProvider.php
2828

2929
Documentation:
3030

src/Symfony/Component/Validator/ConstraintViolationInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public function getMessageTemplate();
6868
* @see getMessageTemplate()
6969
*
7070
* @api
71+
*
72+
* @deprecated since version 2.7, to be replaced by getParameters() in 3.0.
7173
*/
7274
public function getMessageParameters();
7375

@@ -86,6 +88,8 @@ public function getMessageParameters();
8688
* pluralization form (in this case "choices").
8789
*
8890
* @return int|null The number to use to pluralize of the message.
91+
*
92+
* @deprecated since version 2.7, to be replaced by getPlural() in 3.0.
8993
*/
9094
public function getMessagePluralization();
9195

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ public function validate($object, Constraint $constraint)
5454
$method($object, $this->context);
5555
} elseif (is_array($method)) {
5656
if (!is_callable($method)) {
57-
throw new ConstraintDefinitionException(sprintf('"%s::%s" targeted by Callback constraint is not a valid callable', $method[0], $method[1]));
57+
if (isset($method[0]) && is_object($method[0])) {
58+
$method[0] = get_class($method[0]);
59+
}
60+
throw new ConstraintDefinitionException(sprintf('%s targeted by Callback constraint is not a valid callable', json_encode($method)));
5861
}
5962

6063
call_user_func($method, $object, $this->context);

src/Symfony/Component/Validator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Resources
109109

110110
Silex integration:
111111

112-
https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/ValidatorServiceProvider.php
112+
https://github.com/silexphp/Silex/blob/master/src/Silex/Provider/ValidatorServiceProvider.php
113113

114114
Documentation:
115115

0 commit comments

Comments
 (0)
0