The first Long Term Support version of Symfony2 will be 2.3, to be released in May 2013. In the meantime, we are in a race where we try to finish and polish everything as we won't allow BC breaks after 2.3 without a very good reason (a security issue for instance). So, since 2.0, instead of just replacing or removing existing features, we deprecate them and they will be removed in 2.3.
But how can you track those deprecated features? Of course, the CHANGELOGs and
the UPGRADE file mention all the BC breaks and the deprecated features. But
the code itself also contains some hints about deprecated methods and classes
as they are tagged with @deprecated
. But what if you miss some occurrences
in your code? Will your code explode when upgrading to 2.3? The short answer
is yes.
So, to provide a smoother transition, Symfony 2.2 introduces a new feature: the logging of deprecated calls. Whenever you call a deprecated method or whenever you create an instance of a deprecated class, Symfony will now log the call and alert you in the debug toolbar:
That's really nice, but there is more. You can also go to the web profiler, and the log panel will tell you exactly where the call occurred:
And if you have some functional tests, or just by browsing your application manually, you can automate everything by parsing the Symfony log file:
1 2 3 4 5 6
[2012-12-17 11:24:03] deprecation.WARNING: foo {
"type":-100,
"file":"/path/to/Controller/SomeController.php",
"line":37,
"stack":[/* stack trace not show here */]
}
Awesome!
One more awesome feature. Thanks.
great idea :-)
great feature! thanx.
I think I'm gonna love this tool :)
Love it :)
+1
Thanks Colin.
For those who ask "why -100 ?" (btw should be why '-100' ?). Twig bugs. I think Tobion has submitted a PR, I'll revisit the code.
This might be one of the best things ever!
Awesome!! +1
Nice feature !
Very nice, but usage of @deprecated annotation was not possible?
AWESOME!