-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Deprecations #12968
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
Deprecations #12968
Changes from all commits
70012c1
b5a315d
cb70632
ab4d9b8
e2a19ee
1d58df4
badf8fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
{ | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
{ | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not convinced this is worth the overhead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should benchmark with https://blackfire.io/ :) |
||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will autoload the referenced class or not? and thus trigger the deprecation even when the constant is no used at all?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the trick: PHP lazy loads values of constants, so this won't be triggered unless used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it true for HHVM too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like so: http://3v4l.org/vETtp