[Form] Log deprecation of constants, fixes #12607 #12667

This commit is contained in:
Nicolas Grekas 2014-12-15 09:12:18 +01:00
parent 1d58df471a
commit badf8fcc16
4 changed files with 66 additions and 6 deletions

View File

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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()
{
}
}

View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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()
{
}
}

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Form\Extension\Core\DataTransformer;
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;

View File

@ -10,6 +10,8 @@
namespace Symfony\Component\Form;
use Symfony\Component\Form\Deprecated\FormEvents as Deprecated;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
@ -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()
{