Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

trigger_error() for deprecations #6180

Merged
merged 14 commits into from

7 participants

@colinfrei

See also #6173 and #6139.

Started triggering errors in the HttpFoundation component.
It seems as if most of the time the error is just duplicating the text in the @deprecation comment.

Any opinions on if duplicating the text is acceptable, or if fetching the comment text to output the error makes sense?

@Koc Koc commented on the diff
...omponent/HttpFoundation/Tests/Session/SessionTest.php
@@ -205,6 +208,9 @@ public function testGetSetFlashes()
$this->assertEquals(array('notice' => 'foo'), $this->session->getFlashes());
@Koc
Koc added a note

Does this test will work correct and this assertion will executed?

At the time you asked, no. With the changes below with the custom error handler it should work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
...omponent/HttpFoundation/Tests/Session/SessionTest.php
@@ -191,6 +191,9 @@ public function testGetFlashBag()
// deprecated since 2.1, will be removed from 2.3
+ /**
+ * @expectedException PHPUnit_Framework_Error_Deprecated
@Tobion Collaborator
Tobion added a note

Are the original assertions in the tests still executed? It must be, otherwise we could not really test if the methods behave in a BC way.

@stof Collaborator
stof added a note

they won't. We need to register a custom error_handler inside the testcase to catch the deprecated warning before PHPUnit (and restoring the error handler at the end and when an exception occurs)

yep, just noticed that the assertions after the first deprecated function call aren't executed...

@Tobion Collaborator
Tobion added a note

Can it be also achieved with surpressing php notices like @$session->getFlashes()?

@stof Collaborator
stof added a note

it could, yes. It depends if you want to ensure there is a deprecation warning here. But the drawbacks is that you would hide a NOTICE or an ERROR too

Added a custom error handler now to catch E_USER_DEPRECATED errors. It falls back to PHPUnit's error handler if it's a different error number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
colinfrei added some commits
@colinfrei colinfrei trigger errors for deprecated methods in HttpFoundation component f49704b
@colinfrei colinfrei Handle errors using a custom error handler
Without the custom handler, assertions after the first failure wouldn't be executed. This catches E_USER_DEPRECATED errors and passes everything else on to the phpunit error handler.
b35de9e
...ymfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -17,6 +17,16 @@
class RequestTest extends \PHPUnit_Framework_TestCase
{
+ public function deprecationErrorHandler($errorNumber, $message, $file, $line, $context)
+ {
+ if ($errorNumber & E_USER_DEPRECATED) {
+ return true;
+ }
+
+ \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line);
+ return false;
@stof Collaborator
stof added a note

you should return the return value of PHPUnit_Util_ErrorHandler to let it choose the return value IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Seldaek
Collaborator

IMO it's fine to just duplicate the @deprecated note in the message, since anyway this code is meant to be completely deleted, this duplication should not do much harm.

@fabpot
Owner

@colinfrei I've merged PR #6173. Do you have time to implement the trigger_error() call everywhere? Thanks.

@colinfrei

Yep I'll finish that, probably until the beginning of next week.

@webmozart
Collaborator

Thank you for working on this!

@fabpot
Owner

@colinfrei: Is this PR finished? Can I merge it?

@colinfrei

@fabpot not quite - I lost some work due to a computer crash over the weekend. The only thing open is fixing the tests for the Form Component and catching the cases where the Form Component intentionally uses deprecated stuff.

@colinfrei

@fabpot - finished adding trigger_errors and catching them in Tests and as needed.
Travis is failing, but that seems to be master being broken due to the Finder changes?

I changed a few cases where the code was using deprecated methods which wasn't necessary in my eyes, specifically 1d82112, 800a032, f3d6966

@fabpot fabpot referenced this pull request from a commit
@fabpot fabpot merged branch colinfrei/deprecationErrors (PR #6180)
This PR was merged into the master branch.

Commits
-------

6b10550 Merge branch 'master' of github.com:symfony/symfony into deprecationErrors
1d82112 [Form] Fix two cases where deprecated methods were being used
b8cdbdc [Form] Catch deprecation errors that are caused by BC code
ebcb432 [Form] [FrameworkBundle] catch deprecation errors in tests
c21b12e [Form] handle BC use of deprecated stuff in non-test-methods.
fc2be6d [Form] catch deprecated errors in tests
800a032 [Form] replace bindRequest() with bind(), as bindRequest is deprecated
d5b2638 [Form] Trigger errors for deprecated methods in Form Component
f3d6966 [Validator] Stop using deprecated methods
d57ad32 [Form] Catch deprecation errors when using deprecated methods/classes in tests
3241157 [Validator] Trigger errors for deprecations
1f9eb7f return value of handleError
b35de9e Handle errors using a custom error handler
f49704b trigger errors for deprecated methods in HttpFoundation component

Discussion
----------

trigger_error() for deprecations

See also #6173 and #6139.

Started triggering errors in the HttpFoundation component.
It seems as if most of the time the error is just duplicating the text in the @deprecation comment.

Any opinions on if duplicating the text is acceptable, or if fetching the comment text to output the error makes sense?

---------------------------------------------------------------------------

by Seldaek at 2012-12-04T13:39:42Z

IMO it's fine to just duplicate the `@deprecated` note in the message, since anyway this code is meant to be completely deleted, this duplication should not do much harm.

---------------------------------------------------------------------------

by fabpot at 2012-12-06T08:22:21Z

@colinfrei I've merged PR #6173. Do you have time to implement the `trigger_error()` call everywhere? Thanks.

---------------------------------------------------------------------------

by colinfrei at 2012-12-06T08:36:55Z

Yep I'll finish that, probably until the beginning of next week.

---------------------------------------------------------------------------

by bschussek at 2012-12-10T10:15:12Z

Thank you for working on this!

---------------------------------------------------------------------------

by fabpot at 2012-12-12T11:08:53Z

@colinfrei: Is this PR finished? Can I merge it?

---------------------------------------------------------------------------

by colinfrei at 2012-12-12T12:09:19Z

@fabpot not quite - I lost some work due to a computer crash over the weekend. The only thing open is fixing the tests  for the Form Component and catching the cases where the Form Component intentionally uses deprecated stuff.

---------------------------------------------------------------------------

by colinfrei at 2012-12-15T07:32:28Z

@fabpot - finished adding trigger_errors and catching them in Tests and as needed.
Travis is failing, but that seems to be master being broken due to the Finder changes?

I changed a few cases where the code was using deprecated methods which wasn't necessary in my eyes, specifically   1d82112, 800a032, f3d6966
e3cc337
@fabpot fabpot merged commit 6b10550 into from
@fabpot
Owner

@colinfrei Thank you very much for your work on this matter. This is much appreciated!

@fabpot fabpot referenced this pull request from a commit
@fabpot fabpot merged branch ricardclau/rename_choice_to_oneof (PR #6360)
This PR was merged into the master branch.

Commits
-------

9071676 create oneof constraint and add deprecation messages in choice, also make choice extend new oneOf constraint to avoid duplicate code

Discussion
----------

[Validator] Rename "Choice" to "OneOf"

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #6324
Todo:
License of the code: MIT
Documentation PR: symfony/symfony-docs#2025

---------------------------------------------------------------------------

by bschussek at 2012-12-14T18:20:56Z

Can you let `Choice` and `ChoiceValidator` extend the renamed classes? Then we avoid the code duplication. You can also remove `ChoiceValidatorTest` then.

---------------------------------------------------------------------------

by ricardclau at 2012-12-14T18:26:58Z

For sure! BTW there seems to be a problem with SF2 build when testing BR currency :S maybe it is the new ICU version supported, I guess you are aware of this but just in case!

---------------------------------------------------------------------------

by stof at 2012-12-14T21:14:04Z

the ``Choice`` constraint should trigger a ``E_USER_DEPRECATED`` in its constructor (and calling the parent constructor) as we agreed on this. The PR adding these calls everywhere is not merged yet, but it would avoid missing it when merging the PRs separately

---------------------------------------------------------------------------

by bschussek at 2012-12-14T21:19:45Z

Things missing:

* add a deprecation note to the Validator's CHANGELOG
* add a block in UPGRADE-2.2 under the Validator's "Deprecations" section that explains how to upgrade with a before/after sample
* add `trigger_error()` calls to the constructors of `Choice` and `ChoiceValidator`

See #6180 for more information about how to call `trigger_error()`.

---------------------------------------------------------------------------

by ricardclau at 2012-12-14T22:45:55Z

Sorry I was not aware of the trigger_error() agreement, absolutely +1 on it.

I hope I understood everything properly, if there is something else or some other errors please tell me!

---------------------------------------------------------------------------

by bschussek at 2012-12-15T08:46:51Z

The entry in the CHANGELOG is still missing.

---------------------------------------------------------------------------

by ricardclau at 2012-12-15T09:36:28Z

By the CHANGELOG you mean what I just added right? Hope now it is ok!

---------------------------------------------------------------------------

by bschussek at 2012-12-15T09:45:16Z

Awesome! :+1:
1de60c9
@mmucklo mmucklo referenced this pull request from a commit
@fabpot fabpot merged branch colinfrei/deprecationErrors (PR #6180)
This PR was merged into the master branch.

Commits
-------

6b10550 Merge branch 'master' of github.com:symfony/symfony into deprecationErrors
1d82112 [Form] Fix two cases where deprecated methods were being used
b8cdbdc [Form] Catch deprecation errors that are caused by BC code
ebcb432 [Form] [FrameworkBundle] catch deprecation errors in tests
c21b12e [Form] handle BC use of deprecated stuff in non-test-methods.
fc2be6d [Form] catch deprecated errors in tests
800a032 [Form] replace bindRequest() with bind(), as bindRequest is deprecated
d5b2638 [Form] Trigger errors for deprecated methods in Form Component
f3d6966 [Validator] Stop using deprecated methods
d57ad32 [Form] Catch deprecation errors when using deprecated methods/classes in tests
3241157 [Validator] Trigger errors for deprecations
1f9eb7f return value of handleError
b35de9e Handle errors using a custom error handler
f49704b trigger errors for deprecated methods in HttpFoundation component

Discussion
----------

trigger_error() for deprecations

See also #6173 and #6139.

Started triggering errors in the HttpFoundation component.
It seems as if most of the time the error is just duplicating the text in the @deprecation comment.

Any opinions on if duplicating the text is acceptable, or if fetching the comment text to output the error makes sense?

---------------------------------------------------------------------------

by Seldaek at 2012-12-04T13:39:42Z

IMO it's fine to just duplicate the `@deprecated` note in the message, since anyway this code is meant to be completely deleted, this duplication should not do much harm.

---------------------------------------------------------------------------

by fabpot at 2012-12-06T08:22:21Z

@colinfrei I've merged PR #6173. Do you have time to implement the `trigger_error()` call everywhere? Thanks.

---------------------------------------------------------------------------

by colinfrei at 2012-12-06T08:36:55Z

Yep I'll finish that, probably until the beginning of next week.

---------------------------------------------------------------------------

by bschussek at 2012-12-10T10:15:12Z

Thank you for working on this!

---------------------------------------------------------------------------

by fabpot at 2012-12-12T11:08:53Z

@colinfrei: Is this PR finished? Can I merge it?

---------------------------------------------------------------------------

by colinfrei at 2012-12-12T12:09:19Z

@fabpot not quite - I lost some work due to a computer crash over the weekend. The only thing open is fixing the tests  for the Form Component and catching the cases where the Form Component intentionally uses deprecated stuff.

---------------------------------------------------------------------------

by colinfrei at 2012-12-15T07:32:28Z

@fabpot - finished adding trigger_errors and catching them in Tests and as needed.
Travis is failing, but that seems to be master being broken due to the Finder changes?

I changed a few cases where the code was using deprecated methods which wasn't necessary in my eyes, specifically   1d82112, 800a032, f3d6966
9dfc8ea
@mmucklo mmucklo referenced this pull request from a commit
@fabpot fabpot merged branch ricardclau/rename_choice_to_oneof (PR #6360)
This PR was merged into the master branch.

Commits
-------

9071676 create oneof constraint and add deprecation messages in choice, also make choice extend new oneOf constraint to avoid duplicate code

Discussion
----------

[Validator] Rename "Choice" to "OneOf"

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #6324
Todo:
License of the code: MIT
Documentation PR: symfony/symfony-docs#2025

---------------------------------------------------------------------------

by bschussek at 2012-12-14T18:20:56Z

Can you let `Choice` and `ChoiceValidator` extend the renamed classes? Then we avoid the code duplication. You can also remove `ChoiceValidatorTest` then.

---------------------------------------------------------------------------

by ricardclau at 2012-12-14T18:26:58Z

For sure! BTW there seems to be a problem with SF2 build when testing BR currency :S maybe it is the new ICU version supported, I guess you are aware of this but just in case!

---------------------------------------------------------------------------

by stof at 2012-12-14T21:14:04Z

the ``Choice`` constraint should trigger a ``E_USER_DEPRECATED`` in its constructor (and calling the parent constructor) as we agreed on this. The PR adding these calls everywhere is not merged yet, but it would avoid missing it when merging the PRs separately

---------------------------------------------------------------------------

by bschussek at 2012-12-14T21:19:45Z

Things missing:

* add a deprecation note to the Validator's CHANGELOG
* add a block in UPGRADE-2.2 under the Validator's "Deprecations" section that explains how to upgrade with a before/after sample
* add `trigger_error()` calls to the constructors of `Choice` and `ChoiceValidator`

See #6180 for more information about how to call `trigger_error()`.

---------------------------------------------------------------------------

by ricardclau at 2012-12-14T22:45:55Z

Sorry I was not aware of the trigger_error() agreement, absolutely +1 on it.

I hope I understood everything properly, if there is something else or some other errors please tell me!

---------------------------------------------------------------------------

by bschussek at 2012-12-15T08:46:51Z

The entry in the CHANGELOG is still missing.

---------------------------------------------------------------------------

by ricardclau at 2012-12-15T09:36:28Z

By the CHANGELOG you mean what I just added right? Hope now it is ok!

---------------------------------------------------------------------------

by bschussek at 2012-12-15T09:45:16Z

Awesome! :+1:
54d5c61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 3, 2012
  1. @colinfrei
  2. @colinfrei

    Handle errors using a custom error handler

    colinfrei authored
    Without the custom handler, assertions after the first failure wouldn't be executed. This catches E_USER_DEPRECATED errors and passes everything else on to the phpunit error handler.
  3. @colinfrei
Commits on Dec 6, 2012
  1. @colinfrei
  2. @colinfrei
  3. @colinfrei
Commits on Dec 12, 2012
  1. @colinfrei
Commits on Dec 14, 2012
  1. @colinfrei
  2. @colinfrei
  3. @colinfrei
  4. @colinfrei
  5. @colinfrei
  6. @colinfrei
  7. @colinfrei
This page is out of date. Refresh to see the latest.
Showing with 525 additions and 63 deletions.
  1. +1 −0  src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
  2. +2 −2 src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
  3. +1 −0  src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php
  4. +2 −0  src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
  5. +2 −0  src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
  6. +10 −0 src/Symfony/Component/Form/AbstractType.php
  7. +6 −0 src/Symfony/Component/Form/AbstractTypeExtension.php
  8. +4 −0 src/Symfony/Component/Form/CallbackValidator.php
  9. +2 −0  src/Symfony/Component/Form/Event/DataEvent.php
  10. +5 −0 src/Symfony/Component/Form/Extension/Core/Type/FieldType.php
  11. +1 −0  src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
  12. +33 −1 src/Symfony/Component/Form/Form.php
  13. +2 −0  src/Symfony/Component/Form/FormBuilder.php
  14. +20 −0 src/Symfony/Component/Form/FormConfigBuilder.php
  15. +8 −0 src/Symfony/Component/Form/FormFactory.php
  16. +4 −0 src/Symfony/Component/Form/FormRegistry.php
  17. +2 −0  src/Symfony/Component/Form/FormTypeGuesserChain.php
  18. +27 −0 src/Symfony/Component/Form/FormView.php
  19. +2 −0  src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
  20. +12 −6 src/Symfony/Component/Form/Tests/CompoundFormTest.php
  21. +36 −0 src/Symfony/Component/Form/Tests/DeprecationErrorHandler.php
  22. +4 −4 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixRadioInputListenerTest.php
  23. +4 −4 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php
  24. +10 −10 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
  25. +15 −15 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
  26. +4 −4 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php
  27. +2 −2 src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
  28. +9 −9 src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php
  29. +4 −4 src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
  30. +6 −0 src/Symfony/Component/Form/Tests/FormFactoryTest.php
  31. +7 −0 src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php
  32. +4 −0 src/Symfony/Component/Form/Tests/FormRegistryTest.php
  33. +2 −0  src/Symfony/Component/Form/Tests/SimpleFormTest.php
  34. +1 −1  src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php
  35. +4 −0 src/Symfony/Component/HttpFoundation/Request.php
  36. +14 −0 src/Symfony/Component/HttpFoundation/Session/Session.php
  37. +19 −0 src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
  38. +33 −0 src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php
  39. +7 −0 src/Symfony/Component/Validator/ConstraintValidator.php
  40. +7 −0 src/Symfony/Component/Validator/Constraints/Max.php
  41. +7 −0 src/Symfony/Component/Validator/Constraints/MaxLength.php
  42. +5 −0 src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php
  43. +5 −0 src/Symfony/Component/Validator/Constraints/MaxValidator.php
  44. +7 −0 src/Symfony/Component/Validator/Constraints/Min.php
  45. +7 −0 src/Symfony/Component/Validator/Constraints/MinLength.php
  46. +5 −0 src/Symfony/Component/Validator/Constraints/MinLengthValidator.php
  47. +5 −0 src/Symfony/Component/Validator/Constraints/MinValidator.php
  48. +13 −1 src/Symfony/Component/Validator/ExecutionContext.php
  49. +14 −0 src/Symfony/Component/Validator/GraphWalker.php
  50. +2 −0  src/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php
  51. +2 −0  src/Symfony/Component/Validator/Mapping/MemberMetadata.php
  52. +11 −0 src/Symfony/Component/Validator/Tests/ConstraintValidatorTest.php
  53. +17 −0 src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php
  54. +65 −0 src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php
  55. +2 −0  src/Symfony/Component/Validator/ValidationVisitor.php
  56. +10 −0 src/Symfony/Component/Validator/ValidatorContext.php
  57. +10 −0 src/Symfony/Component/Validator/ValidatorFactory.php
View
1  src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
@@ -143,6 +143,7 @@ public function guessMaxLength($class, $property)
*/
public function guessMinLength($class, $property)
{
+ trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
}
/**
View
4 src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
@@ -63,7 +63,7 @@ public function validate($entity, Constraint $constraint)
$em = $this->registry->getManagerForClass(get_class($entity));
}
- $className = $this->context->getCurrentClass();
+ $className = $this->context->getClassName();
$class = $em->getClassMetadata($className);
/* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */
@@ -120,6 +120,6 @@ public function validate($entity, Constraint $constraint)
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
- $this->context->addViolationAtSubPath($errorPath, $constraint->message, array(), $criteria[$fields[0]]);
+ $this->context->addViolationAt($errorPath, $constraint->message, array(), $criteria[$fields[0]]);
}
}
View
1  src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php
@@ -126,6 +126,7 @@ public function guessMaxLength($class, $property)
*/
public function guessMinLength($class, $property)
{
+ trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
}
/**
View
2  src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
@@ -68,6 +68,8 @@ protected function getExtensions()
protected function tearDown()
{
$this->engine = null;
+
+ parent::tearDown();
}
protected function renderEnctype(FormView $view)
View
2  src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
@@ -69,6 +69,8 @@ protected function getExtensions()
protected function tearDown()
{
$this->engine = null;
+
+ parent::tearDown();
}
protected function renderEnctype(FormView $view)
View
10 src/Symfony/Component/Form/AbstractType.php
@@ -51,8 +51,10 @@ public function finishView(FormView $view, FormInterface $form, array $options)
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
$resolver->setDefaults($this->getDefaultOptions(array()));
$resolver->addAllowedValues($this->getAllowedOptionValues(array()));
+ restore_error_handler();
}
/**
@@ -67,6 +69,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
*/
public function getDefaultOptions(array $options)
{
+ trigger_error('getDefaultOptions() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
+
return array();
}
@@ -82,6 +86,8 @@ public function getDefaultOptions(array $options)
*/
public function getAllowedOptionValues(array $options)
{
+ trigger_error('getAllowedOptionValues() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
+
return array();
}
@@ -104,6 +110,8 @@ public function getParent()
*/
public function setExtensions(array $extensions)
{
+ trigger_error('setExtensions() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
$this->extensions = $extensions;
}
@@ -117,6 +125,8 @@ public function setExtensions(array $extensions)
*/
public function getExtensions()
{
+ trigger_error('getExtensions() is deprecated since version 2.1 and will be removed in 2.3. Use ResolvedFormTypeInterface::getTypeExtensions instead.', E_USER_DEPRECATED);
+
return $this->extensions;
}
}
View
6 src/Symfony/Component/Form/AbstractTypeExtension.php
@@ -44,8 +44,10 @@ public function finishView(FormView $view, FormInterface $form, array $options)
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
$resolver->setDefaults($this->getDefaultOptions());
$resolver->addAllowedValues($this->getAllowedOptionValues());
+ restore_error_handler();
}
/**
@@ -58,6 +60,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
*/
public function getDefaultOptions()
{
+ trigger_error('getDefaultOptions() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
+
return array();
}
@@ -71,6 +75,8 @@ public function getDefaultOptions()
*/
public function getAllowedOptionValues()
{
+ trigger_error('getAllowedOptionValues() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
+
return array();
}
}
View
4 src/Symfony/Component/Form/CallbackValidator.php
@@ -27,6 +27,8 @@ class CallbackValidator implements FormValidatorInterface
*/
public function __construct($callback)
{
+ trigger_error('CallbackValidator is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
$this->callback = $callback;
}
@@ -35,6 +37,8 @@ public function __construct($callback)
*/
public function validate(FormInterface $form)
{
+ trigger_error('validate() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
return call_user_func($this->callback, $form);
}
}
View
2  src/Symfony/Component/Form/Event/DataEvent.php
@@ -33,6 +33,8 @@ class DataEvent extends Event
*/
public function __construct(FormInterface $form, $data)
{
+ trigger_error('DataEvent is deprecated since version 2.1 and will be removed in 2.3. Code against \Symfony\Component\Form\FormEvent instead.', E_USER_DEPRECATED);
+
$this->form = $form;
$this->data = $data;
}
View
5 src/Symfony/Component/Form/Extension/Core/Type/FieldType.php
@@ -22,6 +22,11 @@
*/
class FieldType extends AbstractType
{
+ function __construct()
+ {
+ trigger_error('FieldType is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+ }
+
/**
* {@inheritdoc}
*/
View
1  src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
@@ -70,6 +70,7 @@ public function guessMaxLength($class, $property)
*/
public function guessMinLength($class, $property)
{
+ trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
}
/**
View
34 src/Symfony/Component/Form/Form.php
@@ -210,6 +210,8 @@ public function getPropertyPath()
*/
public function getTypes()
{
+ trigger_error('getTypes() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getType() instead.', E_USER_DEPRECATED);
+
$types = array();
for ($type = $this->config->getType(); null !== $type; $type = $type->getParent()) {
@@ -279,6 +281,8 @@ public function getParent()
*/
public function hasParent()
{
+ trigger_error('hasParent() is deprecated since version 2.1 and will be removed in 2.3. Use getParent() or inverse isRoot() instead.', E_USER_DEPRECATED);
+
return null !== $this->parent;
}
@@ -310,6 +314,8 @@ public function isRoot()
*/
public function hasAttribute($name)
{
+ trigger_error('hasAttribute() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::hasAttribute() instead.', E_USER_DEPRECATED);
+
return $this->config->hasAttribute($name);
}
@@ -325,6 +331,8 @@ public function hasAttribute($name)
*/
public function getAttribute($name)
{
+ trigger_error('getAttribute() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getAttribute() instead.', E_USER_DEPRECATED);
+
return $this->config->getAttribute($name);
}
@@ -358,7 +366,9 @@ public function setData($modelData)
// Hook to change content of the data
if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA) || $dispatcher->hasListeners(FormEvents::SET_DATA)) {
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
$event = new FormEvent($this, $modelData);
+ restore_error_handler();
$dispatcher->dispatch(FormEvents::PRE_SET_DATA, $event);
// BC until 2.3
$dispatcher->dispatch(FormEvents::SET_DATA, $event);
@@ -470,6 +480,8 @@ public function getViewData()
*/
public function getClientData()
{
+ trigger_error('getClientData() is deprecated since version 2.1 and will be removed in 2.3. Use getViewData() instead.', E_USER_DEPRECATED);
+
return $this->getViewData();
}
@@ -519,7 +531,9 @@ public function bind($submittedData)
// Hook to change content of the data bound by the browser
if ($dispatcher->hasListeners(FormEvents::PRE_BIND) || $dispatcher->hasListeners(FormEvents::BIND_CLIENT_DATA)) {
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
$event = new FormEvent($this, $submittedData);
+ restore_error_handler();
$dispatcher->dispatch(FormEvents::PRE_BIND, $event);
// BC until 2.3
$dispatcher->dispatch(FormEvents::BIND_CLIENT_DATA, $event);
@@ -579,7 +593,9 @@ public function bind($submittedData)
// Hook to change content of the data into the normalized
// representation
if ($dispatcher->hasListeners(FormEvents::BIND) || $dispatcher->hasListeners(FormEvents::BIND_NORM_DATA)) {
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
$event = new FormEvent($this, $normData);
+ restore_error_handler();
$dispatcher->dispatch(FormEvents::BIND, $event);
// BC until 2.3
$dispatcher->dispatch(FormEvents::BIND_NORM_DATA, $event);
@@ -603,9 +619,11 @@ public function bind($submittedData)
$dispatcher->dispatch(FormEvents::POST_BIND, $event);
}
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
foreach ($this->config->getValidators() as $validator) {
$validator->validate($this);
}
+ restore_error_handler();
return $this;
}
@@ -627,6 +645,8 @@ public function bind($submittedData)
*/
public function bindRequest(Request $request)
{
+ trigger_error('bindRequest() is deprecated since version 2.1 and will be removed in 2.3. Use FormConfigInterface::bind() instead.', E_USER_DEPRECATED);
+
return $this->bind($request);
}
@@ -635,7 +655,7 @@ public function bindRequest(Request $request)
*/
public function addError(FormError $error)
{
- if ($this->parent && $this->getErrorBubbling()) {
+ if ($this->parent && $this->config->getErrorBubbling()) {
$this->parent->addError($error);
} else {
$this->errors[] = $error;
@@ -654,6 +674,8 @@ public function addError(FormError $error)
*/
public function getErrorBubbling()
{
+ trigger_error('getErrorBubbling() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getErrorBubbling() instead.', E_USER_DEPRECATED);
+
return $this->config->getErrorBubbling();
}
@@ -725,6 +747,8 @@ public function isValid()
*/
public function hasErrors()
{
+ trigger_error('hasErrors() is deprecated since version 2.1 and will be removed in 2.3. Count getErrors() instead.', E_USER_DEPRECATED);
+
return count($this->errors) > 0;
}
@@ -774,6 +798,8 @@ public function getErrorsAsString($level = 0)
*/
public function getNormTransformers()
{
+ trigger_error('getNormTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getModelTransformers() instead.', E_USER_DEPRECATED);
+
return $this->config->getModelTransformers();
}
@@ -787,6 +813,8 @@ public function getNormTransformers()
*/
public function getClientTransformers()
{
+ trigger_error('getClientTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getViewTransformers() instead.', E_USER_DEPRECATED);
+
return $this->config->getViewTransformers();
}
@@ -808,6 +836,8 @@ public function all()
*/
public function getChildren()
{
+ trigger_error('getChilren() is deprecated since version 2.1 and will be removed in 2.3. Use all() instead.', E_USER_DEPRECATED);
+
return $this->all();
}
@@ -821,6 +851,8 @@ public function getChildren()
*/
public function hasChildren()
{
+ trigger_error('hasChildren() is deprecated since version 2.1 and will be removed in 2.3. Use count() instead.', E_USER_DEPRECATED);
+
return count($this->children) > 0;
}
View
2  src/Symfony/Component/Form/FormBuilder.php
@@ -295,6 +295,8 @@ public function getIterator()
*/
public function getTypes()
{
+ trigger_error('getTypes() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getType() instead.', E_USER_DEPRECATED);
+
$types = array();
for ($type = $this->getType(); null !== $type; $type = $type->getParent()) {
View
20 src/Symfony/Component/Form/FormConfigBuilder.php
@@ -196,6 +196,8 @@ public function addEventSubscriber(EventSubscriberInterface $subscriber)
*/
public function addValidator(FormValidatorInterface $validator)
{
+ trigger_error('addValidator() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
if ($this->locked) {
throw new FormException('The config builder cannot be modified anymore.');
}
@@ -251,6 +253,8 @@ public function resetViewTransformers()
*/
public function appendClientTransformer(DataTransformerInterface $viewTransformer)
{
+ trigger_error('appendClientTransformer() is deprecated since version 2.1 and will be removed in 2.3. Use addViewTransformer() instead.', E_USER_DEPRECATED);
+
if ($this->locked) {
throw new FormException('The config builder cannot be modified anymore.');
}
@@ -271,6 +275,8 @@ public function appendClientTransformer(DataTransformerInterface $viewTransforme
*/
public function prependClientTransformer(DataTransformerInterface $viewTransformer)
{
+ trigger_error('prependClientTransformer() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
if ($this->locked) {
throw new FormException('The config builder cannot be modified anymore.');
}
@@ -290,6 +296,8 @@ public function prependClientTransformer(DataTransformerInterface $viewTransform
*/
public function resetClientTransformers()
{
+ trigger_error('resetClientTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use resetViewTransformers() instead.', E_USER_DEPRECATED);
+
if ($this->locked) {
throw new FormException('The config builder cannot be modified anymore.');
}
@@ -342,6 +350,8 @@ public function resetModelTransformers()
*/
public function appendNormTransformer(DataTransformerInterface $modelTransformer)
{
+ trigger_error('appendNormTransformer() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
if ($this->locked) {
throw new FormException('The config builder cannot be modified anymore.');
}
@@ -363,6 +373,8 @@ public function appendNormTransformer(DataTransformerInterface $modelTransformer
*/
public function prependNormTransformer(DataTransformerInterface $modelTransformer)
{
+ trigger_error('prependNormTransformer() is deprecated since version 2.1 and will be removed in 2.3. Use addModelTransformer() instead.', E_USER_DEPRECATED);
+
if ($this->locked) {
throw new FormException('The config builder cannot be modified anymore.');
}
@@ -382,6 +394,8 @@ public function prependNormTransformer(DataTransformerInterface $modelTransforme
*/
public function resetNormTransformers()
{
+ trigger_error('resetNormTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use resetModelTransformers() instead.', E_USER_DEPRECATED);
+
if ($this->locked) {
throw new FormException('The config builder cannot be modified anymore.');
}
@@ -471,6 +485,8 @@ public function getViewTransformers()
*/
public function getClientTransformers()
{
+ trigger_error('getClientTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getViewTransformers() instead.', E_USER_DEPRECATED);
+
return $this->getViewTransformers();
}
@@ -492,6 +508,8 @@ public function getModelTransformers()
*/
public function getNormTransformers()
{
+ trigger_error('getNormTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getModelTransformers() instead.', E_USER_DEPRECATED);
+
return $this->getModelTransformers();
}
@@ -508,6 +526,8 @@ public function getDataMapper()
*/
public function getValidators()
{
+ trigger_error('getValidators() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
return $this->validators;
}
View
8 src/Symfony/Component/Form/FormFactory.php
@@ -99,7 +99,9 @@ public function createBuilderForProperty($class, $property, $data = null, array
$typeGuess = $guesser->guessType($class, $property);
$maxLengthGuess = $guesser->guessMaxLength($class, $property);
// Keep $minLengthGuess for BC until Symfony 2.3
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
$minLengthGuess = $guesser->guessMinLength($class, $property);
+ restore_error_handler();
$requiredGuess = $guesser->guessRequired($class, $property);
$patternGuess = $guesser->guessPattern($class, $property);
@@ -146,6 +148,8 @@ public function createBuilderForProperty($class, $property, $data = null, array
*/
public function hasType($name)
{
+ trigger_error('hasType() is deprecated since version 2.1 and will be removed in 2.3. Use FormRegistryInterface::hasType() instead.', E_USER_DEPRECATED);
+
return $this->registry->hasType($name);
}
@@ -160,6 +164,8 @@ public function hasType($name)
*/
public function addType(FormTypeInterface $type)
{
+ trigger_error('addType() is deprecated since version 2.1 and will be removed in 2.3. Use form extensions or type registration in the Dependency Injection Container instead.', E_USER_DEPRECATED);
+
$parentType = $type->getParent();
$this->registry->addType($this->resolvedTypeFactory->createResolvedType(
@@ -185,6 +191,8 @@ public function addType(FormTypeInterface $type)
*/
public function getType($name)
{
+ trigger_error('getType() is deprecated since version 2.1 and will be removed in 2.3. Use FormRegistryInterface::getType() instead.', E_USER_DEPRECATED);
+
return $this->registry->getType($name)->getInnerType();
}
View
4 src/Symfony/Component/Form/FormRegistry.php
@@ -68,6 +68,8 @@ public function __construct(array $extensions, ResolvedFormTypeFactoryInterface
*/
public function addType(ResolvedFormTypeInterface $type)
{
+ trigger_error('addType() is deprecated since version 2.1 and will be removed in 2.3. Use form extensions or type registration in the Dependency Injection Container instead.', E_USER_DEPRECATED);
+
$this->types[$type->getName()] = $type;
}
@@ -129,11 +131,13 @@ private function resolveAndAddType(FormTypeInterface $type)
);
}
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handleBC'));
$this->addType($this->resolvedTypeFactory->createResolvedType(
$type,
$typeExtensions,
$parentType ? $this->getType($parentType) : null
));
+ restore_error_handler();
}
/**
View
2  src/Symfony/Component/Form/FormTypeGuesserChain.php
@@ -75,6 +75,8 @@ public function guessMaxLength($class, $property)
*/
public function guessMinLength($class, $property)
{
+ trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
+
return $this->guess(function ($guesser) use ($class, $property) {
return $guesser->guessMinLength($class, $property);
});
View
27 src/Symfony/Component/Form/FormView.php
@@ -64,6 +64,7 @@ public function __construct(FormView $parent = null)
*/
public function getName()
{
+ trigger_error('getName() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead which contains an entry named "name".', E_USER_DEPRECATED);
return $this->vars['name'];
}
@@ -78,6 +79,8 @@ public function getName()
*/
public function set($name, $value)
{
+ trigger_error('set() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
+
$this->vars[$name] = $value;
return $this;
@@ -93,6 +96,8 @@ public function set($name, $value)
*/
public function has($name)
{
+ trigger_error('has() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
+
return array_key_exists($name, $this->vars);
}
@@ -107,6 +112,8 @@ public function has($name)
*/
public function get($name, $default = null)
{
+ trigger_error('get() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
+
if (false === $this->has($name)) {
return $default;
}
@@ -122,6 +129,8 @@ public function get($name, $default = null)
*/
public function all()
{
+ trigger_error('all() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
+
return $this->vars;
}
@@ -135,6 +144,8 @@ public function all()
*/
public function getVars()
{
+ trigger_error('getVars() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
+
return $this->vars;
}
@@ -152,6 +163,8 @@ public function getVars()
*/
public function setAttribute($name, $value)
{
+ trigger_error('setAttribute() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead which contains an entry named "attr".', E_USER_DEPRECATED);
+
$this->vars['attr'][$name] = $value;
return $this;
@@ -207,6 +220,8 @@ public function setRendered()
*/
public function setParent(FormView $parent = null)
{
+ trigger_error('setParent() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'parent\' instead.', E_USER_DEPRECATED);
+
$this->parent = $parent;
return $this;
@@ -222,6 +237,8 @@ public function setParent(FormView $parent = null)
*/
public function getParent()
{
+ trigger_error('getParent() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'parent\' instead.', E_USER_DEPRECATED);
+
return $this->parent;
}
@@ -235,6 +252,8 @@ public function getParent()
*/
public function hasParent()
{
+ trigger_error('hasParent() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'parent\' instead.', E_USER_DEPRECATED);
+
return null !== $this->parent;
}
@@ -250,6 +269,8 @@ public function hasParent()
*/
public function setChildren(array $children)
{
+ trigger_error('setChildren() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'children\' instead.', E_USER_DEPRECATED);
+
$this->children = $children;
return $this;
@@ -265,6 +286,8 @@ public function setChildren(array $children)
*/
public function getChildren()
{
+ trigger_error('getChildren() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'children\' instead.', E_USER_DEPRECATED);
+
return $this->children;
}
@@ -280,6 +303,8 @@ public function getChildren()
*/
public function getChild($name)
{
+ trigger_error('getChild() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'children\' instead.', E_USER_DEPRECATED);
+
return $this->children[$name];
}
@@ -293,6 +318,8 @@ public function getChild($name)
*/
public function hasChildren()
{
+ trigger_error('hasChildren() is deprecated since version 2.1 and will be removed in 2.3. Use count() instead.', E_USER_DEPRECATED);
+
return count($this->children) > 0;
}
View
2  src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -45,6 +45,8 @@ protected function tearDown()
{
$this->csrfProvider = null;
$this->factory = null;
+
+ parent::tearDown();
}
protected function assertXpathNodeValue(\DomElement $element, $expression, $nodeValue)
View
18 src/Symfony/Component/Form/Tests/CompoundFormTest.php
@@ -118,12 +118,16 @@ public function testHasChildren()
{
$this->form->add($this->getBuilder()->getForm());
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->assertTrue($this->form->hasChildren());
+ restore_error_handler();
}
public function testHasNoChildren()
{
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->assertFalse($this->form->hasChildren());
+ restore_error_handler();
}
public function testAdd()
@@ -151,7 +155,9 @@ public function testRemove()
$this->form->remove('foo');
$this->assertNull($child->getParent());
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->assertFalse($this->form->hasChildren());
+ restore_error_handler();
}
/**
@@ -364,7 +370,7 @@ public function testBindPostOrPutRequest($method)
$form->add($this->getBuilder('name')->getForm());
$form->add($this->getBuilder('image')->getForm());
- $form->bindRequest($request);
+ $form->bind($request);
$file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK);
@@ -413,7 +419,7 @@ public function testBindPostOrPutRequestWithEmptyRootFormName($method)
$form->add($this->getBuilder('name')->getForm());
$form->add($this->getBuilder('image')->getForm());
- $form->bindRequest($request);
+ $form->bind($request);
$file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK);
@@ -454,7 +460,7 @@ public function testBindPostOrPutRequestWithSingleChildForm($method)
->addEventSubscriber(new BindRequestListener())
->getForm();
- $form->bindRequest($request);
+ $form->bind($request);
$file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK);
@@ -487,7 +493,7 @@ public function testBindPostOrPutRequestWithSingleChildFormUploadedFile($method)
->addEventSubscriber(new BindRequestListener())
->getForm();
- $form->bindRequest($request);
+ $form->bind($request);
$this->assertEquals('Bernhard', $form->getData());
@@ -519,7 +525,7 @@ public function testBindGetRequest()
$form->add($this->getBuilder('firstName')->getForm());
$form->add($this->getBuilder('lastName')->getForm());
- $form->bindRequest($request);
+ $form->bind($request);
$this->assertEquals('Bernhard', $form['firstName']->getData());
$this->assertEquals('Schussek', $form['lastName']->getData());
@@ -549,7 +555,7 @@ public function testBindGetRequestWithEmptyRootFormName()
$form->add($this->getBuilder('firstName')->getForm());
$form->add($this->getBuilder('lastName')->getForm());
- $form->bindRequest($request);
+ $form->bind($request);
$this->assertEquals('Bernhard', $form['firstName']->getData());
$this->assertEquals('Schussek', $form['lastName']->getData());
View
36 src/Symfony/Component/Form/Tests/DeprecationErrorHandler.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace Symfony\Component\Form\Tests;
+
+use Symfony\Component\Form\FormInterface as NonTestFormInterface;
+use Symfony\Component\Form\FormEvent;
+
+class DeprecationErrorHandler
+{
+ public static function handle($errorNumber, $message, $file, $line, $context)
+ {
+ if ($errorNumber & E_USER_DEPRECATED) {
+ return true;
+ }
+
+ return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line);
+ }
+
+ public static function handleBC($errorNumber, $message, $file, $line, $context)
+ {
+ if ($errorNumber & E_USER_DEPRECATED) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static function getFormEvent(NonTestFormInterface $form, $data)
+ {
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
+ $event = new FormEvent($form, $data);
+ restore_error_handler();
+
+ return $event;
+ }
+}
View
8 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixRadioInputListenerTest.php
@@ -11,9 +11,9 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\Extension\Core\EventListener\FixRadioInputListener;
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
{
@@ -42,7 +42,7 @@ public function testFixRadio()
{
$data = '1';
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$this->listener->preBind($event);
@@ -53,7 +53,7 @@ public function testFixZero()
{
$data = '0';
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$this->listener->preBind($event);
@@ -64,7 +64,7 @@ public function testIgnoreEmptyString()
{
$data = '';
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$this->listener->preBind($event);
View
8 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php
@@ -11,8 +11,8 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
{
@@ -27,7 +27,7 @@ public function testFixHttpUrl()
{
$data = "www.symfony.com";
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$filter = new FixUrlProtocolListener('http');
$filter->onBind($event);
@@ -39,7 +39,7 @@ public function testSkipKnownUrl()
{
$data = "http://www.symfony.com";
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$filter = new FixUrlProtocolListener('http');
$filter->onBind($event);
@@ -51,7 +51,7 @@ public function testSkipOtherProtocol()
{
$data = "ftp://www.symfony.com";
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$filter = new FixUrlProtocolListener('http');
$filter->onBind($event);
View
20 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
@@ -11,8 +11,8 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
abstract class MergeCollectionListenerTest extends \PHPUnit_Framework_TestCase
{
@@ -84,7 +84,7 @@ public function testAddExtraEntriesIfAllowAdd($allowDelete)
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
// The original object was modified
@@ -108,7 +108,7 @@ public function testAddExtraEntriesIfAllowAddDontOverwriteExistingIndices($allow
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
// The original object was modified
@@ -133,7 +133,7 @@ public function testDoNothingIfNotAllowAdd($allowDelete)
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
// We still have the original object
@@ -157,7 +157,7 @@ public function testRemoveMissingEntriesIfAllowDelete($allowAdd)
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
// The original object was modified
@@ -182,7 +182,7 @@ public function testDoNothingIfNotAllowDelete($allowAdd)
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
// We still have the original object
@@ -201,7 +201,7 @@ public function testDoNothingIfNotAllowDelete($allowAdd)
public function testRequireArrayOrTraversable($allowAdd, $allowDelete)
{
$newData = 'no array or traversable';
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener = new MergeCollectionListener($allowAdd, $allowDelete);
$listener->onBind($event);
}
@@ -215,7 +215,7 @@ public function testDealWithNullData()
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
$this->assertSame($originalData, $event->getData());
@@ -233,7 +233,7 @@ public function testDealWithNullOriginalDataIfAllowAdd($allowDelete)
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
$this->assertSame($newData, $event->getData());
@@ -251,7 +251,7 @@ public function testDontDealWithNullOriginalDataIfNotAllowAdd($allowDelete)
$this->form->setData($originalData);
- $event = new FormEvent($this->form, $newData);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $newData);
$listener->onBind($event);
$this->assertNull($event->getData());
View
30 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
@@ -11,9 +11,9 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
use Symfony\Component\Form\FormBuilder;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase
{
@@ -80,7 +80,7 @@ public function testPreSetDataResizesForm()
->will($this->returnValue($this->getForm('2')));
$data = array(1 => 'string', 2 => 'string');
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array('max_length' => '10'), false, false);
$listener->preSetData($event);
@@ -95,7 +95,7 @@ public function testPreSetDataResizesForm()
public function testPreSetDataRequiresArrayOrTraversable()
{
$data = 'no array or traversable';
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, false);
$listener->preSetData($event);
}
@@ -105,7 +105,7 @@ public function testPreSetDataDealsWithNullData()
$this->factory->expects($this->never())->method('createNamed');
$data = null;
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, false);
$listener->preSetData($event);
}
@@ -120,7 +120,7 @@ public function testPreBindResizesUpIfAllowAdd()
->will($this->returnValue($this->getForm('1')));
$data = array(0 => 'string', 1 => 'string');
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array('max_length' => 10), true, false);
$listener->preBind($event);
@@ -134,7 +134,7 @@ public function testPreBindResizesDownIfAllowDelete()
$this->form->add($this->getForm('1'));
$data = array(0 => 'string');
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, true);
$listener->preBind($event);
@@ -148,7 +148,7 @@ public function testPreBindRemovesZeroKeys()
$this->form->add($this->getForm('0'));
$data = array();
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, true);
$listener->preBind($event);
@@ -161,7 +161,7 @@ public function testPreBindDoesNothingIfNotAllowAddNorAllowDelete()
$this->form->add($this->getForm('1'));
$data = array(0 => 'string', 2 => 'string');
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, false);
$listener->preBind($event);
@@ -176,7 +176,7 @@ public function testPreBindDoesNothingIfNotAllowAddNorAllowDelete()
public function testPreBindRequiresArrayOrTraversable()
{
$data = 'no array or traversable';
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, false);
$listener->preBind($event);
}
@@ -186,7 +186,7 @@ public function testPreBindDealsWithNullData()
$this->form->add($this->getForm('1'));
$data = null;
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, true);
$listener->preBind($event);
@@ -199,7 +199,7 @@ public function testPreBindDealsWithEmptyData()
$this->form->add($this->getForm('1'));
$data = '';
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, true);
$listener->preBind($event);
@@ -211,7 +211,7 @@ public function testOnBindNormDataRemovesEntriesMissingInTheFormIfAllowDelete()
$this->form->add($this->getForm('1'));
$data = array(0 => 'first', 1 => 'second', 2 => 'third');
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, true);
$listener->onBind($event);
@@ -223,7 +223,7 @@ public function testOnBindNormDataDoesNothingIfNotAllowDelete()
$this->form->add($this->getForm('1'));
$data = array(0 => 'first', 1 => 'second', 2 => 'third');
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, false);
$listener->onBind($event);
@@ -236,7 +236,7 @@ public function testOnBindNormDataDoesNothingIfNotAllowDelete()
public function testOnBindNormDataRequiresArrayOrTraversable()
{
$data = 'no array or traversable';
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, false);
$listener->onBind($event);
}
@@ -246,7 +246,7 @@ public function testOnBindNormDataDealsWithNullData()
$this->form->add($this->getForm('1'));
$data = null;
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$listener = new ResizeFormListener($this->factory, 'text', array(), false, true);
$listener->onBind($event);
View
8 src/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php
@@ -11,8 +11,8 @@
namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
class TrimListenerTest extends \PHPUnit_Framework_TestCase
{
@@ -27,7 +27,7 @@ public function testTrim()
{
$data = " Foo! ";
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$filter = new TrimListener();
$filter->preBind($event);
@@ -39,7 +39,7 @@ public function testTrimSkipNonStrings()
{
$data = 1234;
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$filter = new TrimListener();
$filter->preBind($event);
@@ -60,7 +60,7 @@ public function testTrimUtf8($chars)
$data = $data."ab\ncd".$data;
$form = $this->getMock('Symfony\Component\Form\Tests\FormInterface');
- $event = new FormEvent($form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($form, $data);
$filter = new TrimListener();
$filter->preBind($event);
View
4 src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
@@ -11,9 +11,9 @@
namespace Symfony\Component\Form\Tests\Extension\Csrf\EventListener;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
class CsrfValidationListenerTest extends \PHPUnit_Framework_TestCase
{
@@ -67,7 +67,7 @@ protected function getMockForm()
public function testStringFormData()
{
$data = "XP4HUzmHPi";
- $event = new FormEvent($this->form, $data);
+ $event = DeprecationErrorHandler::getFormEvent($this->form, $data);
$validation = new CsrfValidationListener('csrf', $this->csrfProvider, 'unknown');
$validation->preBind($event);
View
18 src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php
@@ -14,9 +14,9 @@
use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigBuilder;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\UploadedFile;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
@@ -98,7 +98,7 @@ public function testBindRequest($method)
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$config = new FormConfigBuilder('author', null, $dispatcher);
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
@@ -125,7 +125,7 @@ public function testBindRequestWithEmptyName($method)
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$config = new FormConfigBuilder('', null, $dispatcher);
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
@@ -154,7 +154,7 @@ public function testBindEmptyRequestToCompoundForm($method)
$config->setCompound(true);
$config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface'));
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
@@ -180,7 +180,7 @@ public function testBindEmptyRequestToSimpleForm($method)
$config = new FormConfigBuilder('author', null, $dispatcher);
$config->setCompound(false);
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
@@ -203,7 +203,7 @@ public function testBindGetRequest()
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$config = new FormConfigBuilder('author', null, $dispatcher);
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
@@ -227,7 +227,7 @@ public function testBindGetRequestWithEmptyName()
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$config = new FormConfigBuilder('', null, $dispatcher);
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
@@ -253,7 +253,7 @@ public function testBindEmptyGetRequestToCompoundForm()
$config->setCompound(true);
$config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface'));
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
@@ -275,7 +275,7 @@ public function testBindEmptyGetRequestToSimpleForm()
$config = new FormConfigBuilder('author', null, $dispatcher);
$config->setCompound(false);
$form = new Form($config);
- $event = new FormEvent($form, $request);
+ $event = DeprecationErrorHandler::getFormEvent($form, $request);
$listener = new BindRequestListener();
$listener->preBind($event);
View
8 src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Tests\Extension\Validator\EventListener;
-use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormError;
@@ -19,6 +18,7 @@
use Symfony\Component\Form\Extension\Validator\Constraints\Form;
use Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener;
use Symfony\Component\Validator\ConstraintViolation;
+use Symfony\Component\Form\Tests\DeprecationErrorHandler;
class ValidationListenerTest extends \PHPUnit_Framework_TestCase
{
@@ -111,7 +111,7 @@ public function testMapViolation()
->method('mapViolation')
->with($violation, $form, false);
- $this->listener->validateForm(new FormEvent($form, null));
+ $this->listener->validateForm(DeprecationErrorHandler::getFormEvent($form, null));
}
public function testMapViolationAllowsNonSyncIfInvalid()
@@ -128,7 +128,7 @@ public function testMapViolationAllowsNonSyncIfInvalid()
// pass true now
->with($violation, $form, true);
- $this->listener->validateForm(new FormEvent($form, null));
+ $this->listener->validateForm(DeprecationErrorHandler::getFormEvent($form, null));
}
public function testValidateIgnoresNonRoot()
@@ -144,6 +144,6 @@ public function testValidateIgnoresNonRoot()
$this->violationMapper->expects($this->never())
->method('mapViolation');
- $this->listener->validateForm(new FormEvent($form, null));
+ $this->listener->validateForm(DeprecationErrorHandler::getFormEvent($form, null));
}
}
View
6 src/Symfony/Component/Form/Tests/FormFactoryTest.php
@@ -85,7 +85,9 @@ public function testAddType()
->method('addType')
->with($resolvedType);
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->factory->addType($type);
+ restore_error_handler();
}
public function testHasType()
@@ -95,7 +97,9 @@ public function testHasType()
->with('name')
->will($this->returnValue('RESULT'));
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->assertSame('RESULT', $this->factory->hasType('name'));
+ restore_error_handler();
}
public function testGetType()
@@ -112,7 +116,9 @@ public function testGetType()
->with('name')
->will($this->returnValue($resolvedType));
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->assertEquals($type, $this->factory->getType('name'));
+ restore_error_handler();
}
public function testCreateNamedBuilderWithTypeName()
View
7 src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php
@@ -32,6 +32,13 @@ protected function setUp()
$this->factory = Forms::createFormFactoryBuilder()
->addExtensions($this->getExtensions())
->getFormFactory();
+
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
+ }
+
+ protected function tearDown()
+ {
+ restore_error_handler();
}
protected function getExtensions()
View
4 src/Symfony/Component/Form/Tests/FormRegistryTest.php
@@ -76,7 +76,9 @@ public function testGetTypeReturnsAddedType()
->method('getName')
->will($this->returnValue('foo'));
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->registry->addType($resolvedType);
+ restore_error_handler();
$this->assertSame($resolvedType, $this->registry->getType('foo'));
}
@@ -223,7 +225,9 @@ public function testHasTypeAfterAdding()
$this->assertFalse($this->registry->hasType('foo'));
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$this->registry->addType($resolvedType);
+ restore_error_handler();
$this->assertTrue($this->registry->hasType('foo'));
}
View
2  src/Symfony/Component/Form/Tests/SimpleFormTest.php
@@ -644,9 +644,11 @@ public function testBindValidatesAfterTransformation()
{
$test = $this;
$validator = $this->getFormValidator();
+ set_error_handler(array('Symfony\Component\Form\Tests\DeprecationErrorHandler', 'handle'));
$form = $this->getBuilder()
->addValidator($validator)
->getForm();
+ restore_error_handler();
$validator->expects($this->once())
->method('validate')
View
2  src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php
@@ -23,7 +23,7 @@ class VirtualFormAwareIterator extends \ArrayIterator implements \RecursiveItera
{
public function getChildren()
{
- return new self($this->current()->getChildren());
+ return new self($this->current()->all());
}
public function hasChildren()
View
4 src/Symfony/Component/HttpFoundation/Request.php
@@ -466,6 +466,8 @@ public function overrideGlobals()
*/
public static function trustProxyData()
{
+ trigger_error('trustProxyData() is deprecated since version 2.0 and will be removed in 2.3. Use setTrustedProxies() instead.', E_USER_DEPRECATED);
+
self::$trustProxy = true;
}
@@ -1420,6 +1422,8 @@ public function isXmlHttpRequest()
*/
public function splitHttpAcceptHeader($header)
{
+ trigger_error('splitHttpAcceptHeader() is deprecated since version 2.2 and will be removed in 2.3.', E_USER_DEPRECATED);
+
$headers = array();
foreach (AcceptHeader::fromString($header)->all() as $item) {
$key = $item->getValue();