Symfony 3.4: How to get a list of all Deprecated warnings?
Asked Answered
C

4

8

I have quite a big project in Symfony 3.4 and I wish to update to Symfony 4.
And I get a lot of deprecation warnings. Which is ok I need to fix those, but I cant check each route for my site... there is too many.

Is there a way to get all the depreciation for Symfony 3.4 in my project?

Corrosion answered 28/2, 2018 at 12:42 Comment(0)
V
5

I use the sensiolabs-de/deprecation-detector first to find a lot of them but you never cover them all with that tool.

After that, you can go trough the .md files in your Symfony project, they are located at

  • vendor/symfony/symfony/UPGRADE-3.0.md
  • vendor/symfony/symfony/UPGRADE-3.1.md
  • vendor/symfony/symfony/UPGRADE-3.2.md
  • vendor/symfony/symfony/UPGRADE-3.3.md
  • vendor/symfony/symfony/UPGRADE-3.4.md
  • vendor/symfony/symfony/UPGRADE-4.0.md

Or you can read them online https://github.com/symfony/symfony/tree/3.4

Start with the first one (3.0). Take your time and read carefully.

Make use of a good tool to search your Symfony project (PHPStorm, Netbeans, Sublime, ...)

Everything should be in there, good luck!

When you have a good IDE (like PHPStorm) you can use its code inspection tool. I just inspected the src code of a legacy project in PHPStorm and got this as result:

PHPStorm inspection result

So still a lot of work to do ;)

Vittoria answered 23/12, 2018 at 18:1 Comment(2)
Using PHPStorm's code inspection crashed the tool both times, gave an out of memory warning for the Mac (16GB), and took over a day to even get that far; I had to force close it because the Mac was overheating.Hoatzin
I never had any problem with this feature until today with WSL2, it's extremly slow.Goeselt
H
4

may be this will help you to get all deprications:

composer global require sensiolabs-de/deprecation-detector
$ deprecation-detector check src/ vendor/
$ deprecation-detector check src/ composer.lock

You can look here for more information: https://github.com/sensiolabs-de/deprecation-detector

Harpist answered 28/2, 2018 at 13:18 Comment(2)
I tried that sadly it doesn't list all the deprecations just some...at least for Symfony 3.4Corrosion
Deprecation detector relays on @deprecated annotation. If that's not there, this tool won't help you. Another consideration is that it's static code analysis, which means it can be defeated by newer versions of PHP that aren't properly parsed or by self-modifying code (e.g. eval() or even $$var().Elfrieda
H
1

This is how you scan your files for deprecated code:

$ git clone [email protected]:sensiolabs-de/deprecation-detector.git
$ cd deprecation-detector
$ composer install
$ ./bin/deprecation-detector check /path/to/your-project/src /path/to/your-project/vendor

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

Hilda answered 6/5, 2020 at 19:12 Comment(0)
S
0

In addition to previous tips:

Deprecation notices are triggered whenever you end up using a deprecated feature. When visiting your application in the dev environment in your browser, these notices are shown in the web dev toolbar. All these deprecation warnings are also logged in your log files (ex: local/var/logs/dev.log).

I suggest to test all the features of you application and then retrieve the depreciation notices from the log file to get an "exhaustive" list.

Spirula answered 9/3, 2022 at 16:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.