From 70012c108e16a009e843f69cb73d076ce6d18d2d Mon Sep 17 00:00:00 2001 From: Jerzy Zawadzki Date: Sat, 29 Nov 2014 11:07:30 +0100 Subject: [PATCH 1/7] [Hackday] [2.7] Add a deprecation note about TypeTestCase --- .../Tests/Form/Type/TranslationCollectionTypeTest.php | 2 +- .../Form/Tests/Extension/Core/Type/TypeTestCase.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Propel1/Tests/Form/Type/TranslationCollectionTypeTest.php b/src/Symfony/Bridge/Propel1/Tests/Form/Type/TranslationCollectionTypeTest.php index 0663020cc6f55..0db6c151103bc 100644 --- a/src/Symfony/Bridge/Propel1/Tests/Form/Type/TranslationCollectionTypeTest.php +++ b/src/Symfony/Bridge/Propel1/Tests/Form/Type/TranslationCollectionTypeTest.php @@ -15,7 +15,7 @@ use Symfony\Bridge\Propel1\Form\PropelExtension; use Symfony\Bridge\Propel1\Tests\Fixtures\TranslatableItemI18n; use Symfony\Bridge\Propel1\Tests\Fixtures\TranslatableItem; -use Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase; +use Symfony\Component\Form\Test\TypeTestCase; class TranslationCollectionTypeTest extends TypeTestCase { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php index 733546e382e6d..35f615415ec57 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php @@ -18,4 +18,9 @@ */ abstract class TypeTestCase extends BaseTypeTestCase { + protected function setUp() + { + trigger_error('Abstract class "Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase" is deprecated since version 2.3 and will be removed in 3.0. Use "Symfony\Component\Form\Test\TypeTestCase" instead.', E_USER_DEPRECATED); + parent::setUp(); + } } From b5a315d5ed36bbc3410a454133e3d4e1d0b9e303 Mon Sep 17 00:00:00 2001 From: Daniel Kolvik Date: Sat, 29 Nov 2014 11:14:33 +0100 Subject: [PATCH 2/7] [HttpKernel] Added deprecated error to init() --- src/Symfony/Component/HttpKernel/Kernel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 4d8ddeea9f644..8af95f9298d0a 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -93,6 +93,7 @@ public function __construct($environment, $debug) */ public function init() { + trigger_error('The Kernel::init() method was deprecated in version 2.3 and will be removed in 3.0. Move your logic to the constructor instead.', E_USER_DEPRECATED); } public function __clone() From cb70632077e2a301d8b496928c77b80e599b7673 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 13 Dec 2014 11:00:55 +0100 Subject: [PATCH 3/7] [HttpKernel] fix deprecation notice for Kernel::init() --- .../FrameworkBundle/Tests/Functional/app/AppKernel.php | 4 ---- .../SecurityBundle/Tests/Functional/app/AppKernel.php | 4 ---- src/Symfony/Component/HttpKernel/Kernel.php | 9 +++++++-- .../Tests/DataCollector/ConfigDataCollectorTest.php | 4 ---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index 30bfc56a116d4..b07d44fe22be5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -74,10 +74,6 @@ public function registerBundles() return include $filename; } - public function init() - { - } - public function getRootDir() { return __DIR__; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php index dfce6e4a6c662..977be9162c636 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php @@ -74,10 +74,6 @@ public function registerBundles() return include $filename; } - public function init() - { - } - public function getRootDir() { return __DIR__; diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 8af95f9298d0a..40771d8aad4a7 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -85,7 +85,13 @@ public function __construct($environment, $debug) $this->startTime = microtime(true); } - $this->init(); + $defClass = new \ReflectionMethod($this, 'init'); + $defClass = $defClass->getDeclaringClass()->name; + + if (__CLASS__ !== $defClass) { + trigger_error(sprintf('Calling %s::init() was deprecated in Symfony 2.3 and will be removed in 3.0. Move your logic to the constructor instead.', $defClass), E_USER_DEPRECATED); + $this->init(); + } } /** @@ -93,7 +99,6 @@ public function __construct($environment, $debug) */ public function init() { - trigger_error('The Kernel::init() method was deprecated in version 2.3 and will be removed in 3.0. Move your logic to the constructor instead.', E_USER_DEPRECATED); } public function __clone() diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index 401f1438ea673..0d672a1f0cd50 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -69,10 +69,6 @@ public function registerBundles() { } - public function init() - { - } - public function getBundles() { return array(); From ab4d9b8012a9d1f78ea5d5d174e63f58980ffdf7 Mon Sep 17 00:00:00 2001 From: Botond Dani Date: Sat, 29 Nov 2014 11:44:49 +0100 Subject: [PATCH 4/7] Add a deprecation note about CsrfProviderInterface --- .../Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php | 2 ++ .../Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php | 2 ++ .../Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php | 2 ++ .../Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php | 2 ++ .../Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php | 2 ++ 5 files changed, 10 insertions(+) diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php index 39d52e5c6db48..642d60af441fc 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderAdapter.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider; +trigger_error('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter was deprecated in version 2.4 and will be removed in version 3.0. Please use Symfony\Component\Security\Csrf\CsrfTokenManager instead.', E_USER_DEPRECATED); + use Symfony\Component\Form\Exception\BadMethodCallException; use Symfony\Component\Security\Csrf\CsrfToken; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php index ea8ddd23b11ac..e19531df74661 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider; +trigger_error('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface was deprecated in version 2.4 and will be removed in version 3.0. Please use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface instead.', E_USER_DEPRECATED); + /** * Marks classes able to provide CSRF protection * diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php index 5dbffc2cbcc79..b7db6fa4f639a 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfTokenManagerAdapter.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider; +trigger_error('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfTokenManagerAdapter was deprecated in version 2.4 and will be removed in version 3.0. Please use Symfony\Component\Security\Csrf\CsrfTokenManager instead.', E_USER_DEPRECATED); + use Symfony\Component\Security\Csrf\CsrfToken; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php index 7e38d22f23d5b..ae7c5df7327e3 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider; +trigger_error('Symfony\Component\Security\Csrf\CsrfTokenManager was deprecated in version 2.4 and will be removed in version 3.0. Please use \Symfony\Component\Security\Csrf\TokenStorage\NativeSessionTokenStorage instead.', E_USER_DEPRECATED); + /** * Default implementation of CsrfProviderInterface. * diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php index 6965f0a2ba967..1a1c68bd7f9e6 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider; +trigger_error('Symfony\Component\Security\Csrf\CsrfTokenManager was deprecated in version 2.4 and will be removed in version 3.0. Please use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage instead.', E_USER_DEPRECATED); + use Symfony\Component\HttpFoundation\Session\Session; /** From e2a19ee1855b2dd580d64ee835976a7755d964e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Morales=20Valldep=C3=A9rez?= Date: Sat, 29 Nov 2014 11:49:07 +0100 Subject: [PATCH 5/7] Add a deprecation note about VirtualFormAwareIterator --- .../Component/Form/Util/VirtualFormAwareIterator.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php b/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php index 581e3540e40be..16dbe86e2c433 100644 --- a/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php +++ b/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php @@ -25,6 +25,15 @@ */ class VirtualFormAwareIterator extends \IteratorIterator implements \RecursiveIterator { + public function __construct(\Traversable $iterator) + { + parent::__construct($iterator); + + if ('Symfony\Component\Form\Util\VirtualFormAwareIterator' === get_class()) { + trigger_error('class VirtualFormAwareIterator is deprecated since version 2.7 and will be removed in 3.0. Use InheritDataAwareIterator instead.', E_USER_DEPRECATED); + } + } + /** * {@inheritdoc} */ From 1d58df471acd746582ecf731d10a8cb36574673b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 13 Dec 2014 11:10:32 +0100 Subject: [PATCH 6/7] Fix deprecation notice on VirtualFormAwareIterator --- .../Component/Form/Util/VirtualFormAwareIterator.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php b/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php index 16dbe86e2c433..d49ba78fc0087 100644 --- a/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php +++ b/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Form\Util; +trigger_error('Symfony\Component\Form\Util\VirtualFormAwareIterator is deprecated since Symfony 2.3 and will be removed in 3.0. Use Symfony\Component\Form\Util\InheritDataAwareIterator instead.', E_USER_DEPRECATED); + /** * Iterator that traverses an array of forms. * @@ -25,15 +27,6 @@ */ class VirtualFormAwareIterator extends \IteratorIterator implements \RecursiveIterator { - public function __construct(\Traversable $iterator) - { - parent::__construct($iterator); - - if ('Symfony\Component\Form\Util\VirtualFormAwareIterator' === get_class()) { - trigger_error('class VirtualFormAwareIterator is deprecated since version 2.7 and will be removed in 3.0. Use InheritDataAwareIterator instead.', E_USER_DEPRECATED); - } - } - /** * {@inheritdoc} */ From badf8fcc16e8545966a8c7ecf576020827e2ebf4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 15 Dec 2014 09:12:18 +0100 Subject: [PATCH 7/7] [Form] Log deprecation of constants, fixes #12607 #12667 --- .../Component/Form/Deprecated/FormEvents.php | 28 ++++++++++++++++++ .../NumberToLocalizedStringTransformer.php | 29 +++++++++++++++++++ .../NumberToLocalizedStringTransformer.php | 7 +++-- src/Symfony/Component/Form/FormEvents.php | 8 +++-- 4 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 src/Symfony/Component/Form/Deprecated/FormEvents.php create mode 100644 src/Symfony/Component/Form/Deprecated/NumberToLocalizedStringTransformer.php diff --git a/src/Symfony/Component/Form/Deprecated/FormEvents.php b/src/Symfony/Component/Form/Deprecated/FormEvents.php new file mode 100644 index 0000000000000..862879e75a610 --- /dev/null +++ b/src/Symfony/Component/Form/Deprecated/FormEvents.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Deprecated; + +trigger_error('Constants PRE_BIND, BIND and POST_BIND on class Symfony\Component\Form\FormEvents were deprecated in Symfony 2.3 and will be removed in 3.0. Use PRE_SUBMIT, SUBMIT and POST_SUBMIT instead.', E_USER_DEPRECATED); + +/** + * @deprecated since 2.7, to be removed in 3.0. + * @internal + */ +final class FormEvents +{ + const PRE_BIND = 'form.pre_bind'; + const BIND = 'form.bind'; + const POST_BIND = 'form.post_bind'; + + private function __construct() + { + } +} diff --git a/src/Symfony/Component/Form/Deprecated/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Deprecated/NumberToLocalizedStringTransformer.php new file mode 100644 index 0000000000000..9b94c4e6cf268 --- /dev/null +++ b/src/Symfony/Component/Form/Deprecated/NumberToLocalizedStringTransformer.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Deprecated; + +trigger_error('Constants ROUND_HALFEVEN, ROUND_HALFUP and ROUND_HALFDOWN on class NumberToLocalizedStringTransformer were deprecated in Symfony 2.4 and will be removed in 3.0. Use ROUND_HALF_EVEN, ROUND_HALF_UP and ROUND_HALF_DOWN instead.', E_USER_DEPRECATED); + +/** + * @deprecated since 2.7, to be removed in 3.0. + * @internal + */ +final class NumberToLocalizedStringTransformer +{ + const ROUND_HALFEVEN = \NumberFormatter::ROUND_HALFEVEN; + const ROUND_HALFUP = \NumberFormatter::ROUND_HALFUP; + const ROUND_HALFDOWN = \NumberFormatter::ROUND_HALFDOWN; + + private function __construct() + { + } +} diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index 92f9e63bb9713..1d70af9148a12 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Deprecated\NumberToLocalizedStringTransformer as Deprecated; /** * Transforms between a number type and a localized number with grouping @@ -77,21 +78,21 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface * * @deprecated Deprecated as of Symfony 2.4, to be removed in Symfony 3.0. */ - const ROUND_HALFEVEN = self::ROUND_HALF_EVEN; + const ROUND_HALFEVEN = Deprecated::ROUND_HALFEVEN; /** * Alias for {@link self::ROUND_HALF_UP}. * * @deprecated Deprecated as of Symfony 2.4, to be removed in Symfony 3.0. */ - const ROUND_HALFUP = self::ROUND_HALF_UP; + const ROUND_HALFUP = Deprecated::ROUND_HALFUP; /** * Alias for {@link self::ROUND_HALF_DOWN}. * * @deprecated Deprecated as of Symfony 2.4, to be removed in Symfony 3.0. */ - const ROUND_HALFDOWN = self::ROUND_HALF_DOWN; + const ROUND_HALFDOWN = Deprecated::ROUND_HALFDOWN; protected $precision; diff --git a/src/Symfony/Component/Form/FormEvents.php b/src/Symfony/Component/Form/FormEvents.php index 54c72271c71e5..317472c8a00a4 100644 --- a/src/Symfony/Component/Form/FormEvents.php +++ b/src/Symfony/Component/Form/FormEvents.php @@ -10,6 +10,8 @@ namespace Symfony\Component\Form; +use Symfony\Component\Form\Deprecated\FormEvents as Deprecated; + /** * @author Bernhard Schussek */ @@ -77,7 +79,7 @@ final class FormEvents * * @Event */ - const PRE_BIND = 'form.pre_bind'; + const PRE_BIND = Deprecated::PRE_BIND; /** * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use @@ -85,7 +87,7 @@ final class FormEvents * * @Event */ - const BIND = 'form.bind'; + const BIND = Deprecated::BIND; /** * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use @@ -93,7 +95,7 @@ final class FormEvents * * @Event */ - const POST_BIND = 'form.post_bind'; + const POST_BIND = Deprecated::POST_BIND; private function __construct() { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy