Skip to content

[Form] add deprecation log (#12607) #12667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,36 +77,61 @@ 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 = 7;

/**
* 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 = 8;

/**
* 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 = 9;

/**
* @var int|float
*/
protected $precision;

/**
* @var boolean
*/
protected $grouping;

/**
* @var integer
*/
protected $roundingMode;

/**
* @param int|float $precision
* @param boolean $grouping
* @param integer $roundingMode
*/
public function __construct($precision = null, $grouping = false, $roundingMode = self::ROUND_HALF_UP)
{
if (null === $grouping) {
$grouping = false;
switch ($roundingMode) {
case self::ROUND_HALFEVEN:
trigger_error('The constant ROUND_HALFEVEN is deprecated since version 2.4 and will be removed in 3.0. Use ROUND_HALF_EVEN instead.', E_USER_DEPRECATED);
$roundingMode = self::ROUND_HALF_EVEN;
break;
case self::ROUND_HALFDOWN:
trigger_error('The constant ROUND_HALFDOWN is deprecated since version 2.4 and will be removed in 3.0. Use ROUND_HALF_DOWN instead.', E_USER_DEPRECATED);
$roundingMode = self::ROUND_HALF_DOWN;
break;
case self::ROUND_HALFUP:
trigger_error('The constant ROUND_HALFUP is deprecated since version 2.4 and will be removed in 3.0. Use ROUND_HALF_UP instead.', E_USER_DEPRECATED);
case null:
$roundingMode = self::ROUND_HALF_UP;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the case of null is already handled later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops! Thanks!

}

if (null === $roundingMode) {
$roundingMode = self::ROUND_HALF_UP;
if (null === $grouping) {
$grouping = false;
}

$this->precision = $precision;
Expand Down