Paving the way for Symfony 3 with the "Deprecation Detector" tool

Symfony 3 will be released at the end of November 2015. Learning from our own history, the transition from Symfony 2 to 3 will be much more pleasant than the transition from symfony 1 to 2 that happened in July 2011.

Technically speaking, Symfony 3 includes no new features comparing it with Symfony 2.8, which will be released at the same time. The main change introduced by Symfony 3 is that any feature, option or behavior marked as deprecated in 2.8 version will be removed.

This means that your Symfony applications won't work on Symfony 3 unless you remove all their deprecations. In order to simplify the task of finding which deprecations affect your applications, a new tool called Deprecation Detector has just been released.

This command console application runs a static code analysis against your project's source code to find usages of deprecated methods, classes, interfaces and services. Specifically, it identifies the use of deprecated code thanks to the @deprecated annotation.

Although this tool is still in a very early stage of development, you can already test it in your own applications:

1
2
3
4
$ git clone git@github.com:sensiolabs-de/deprecation-detector.git
$ cd deprecation-detector
$ composer install
$ ./bin/deprecation-detector check /path/to/your-project/src /path/to/your-project/vendor

Tip

Since you are probably going to use this tool very frequently, it's better to build a PHAR file and install it globally, as explained in its documentation.

Deprecation Detector is a project developed by the team at SensioLabs Deutschland, maintained by Marvin Klemp and published as Open Source. Your issues and pull requests are more than welcome to improve the project.

Comments

Hello,

There may be a typo ? "composer install" should come after "cd deprecation-detector" ?
Thank you for the care!
@Raphaël nice catch! Fixed. Thanks.
Good news. But I think the major problem will be with vendor bundles...
does it work?

11:42 $ ./bin/deprecation-detector check -vvv examples/
Checking your application for deprecations - this could take a while ...
Loading rule sets: 27/27
Checking files for deprecations: 8/8
There are no violations - congratulations!
Checked source files in 1.981 seconds, 7 MB memory used
✔ ~/deprecation-detector [master|✔]
@Karel if you pass the path of the project, you must pass both the src/ and vendor/ directories paths. It may be easier to use it like this:

$ cd project_directory/
$ /path/to/deprecation-detector check
There are many bundles out there which have not updated, I hope someone upgrade them soon so can work with Symfony 3.*
Thanks
With respect to upgrading bundles. almost of of them are open source so roll up your sleeves and get cracking. It will be interesting to see how the 3rd party upgrades play out. What is probably the most widely used bundle, FOSUserBundle, still targets Symfony 2.1. There is an alpha version for S2.3 but it's been a work in progress for years. Will it ever be moved to S3.0? That is the question.
Is the directory structure going to change for Symfony 3 or are we still going to use the old (=
cool
Could you please change git repo url to https?

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.