@@ -22,7 +22,7 @@ Most third-party bundles define their Symfony dependencies using the ``~2.N`` or
22
22
"require" : {
23
23
"symfony/framework-bundle" : " ~2.3" ,
24
24
"symfony/finder" : " ~2.3" ,
25
- "symfony/validator" : " ~2.3" ,
25
+ "symfony/validator" : " ~2.3"
26
26
}
27
27
}
28
28
@@ -39,18 +39,61 @@ The above example can be updated to work with Symfony 3 as follows:
39
39
"require" : {
40
40
"symfony/framework-bundle" : " ~2.3|~3.0" ,
41
41
"symfony/finder" : " ~2.3|~3.0" ,
42
- "symfony/validator" : " ~2.3|~3.0" ,
42
+ "symfony/validator" : " ~2.3|~3.0"
43
43
}
44
44
}
45
45
46
46
Look for Deprecations and Fix Them
47
47
----------------------------------
48
48
49
- .. TODO
49
+ Besides allowing to install Symfony 3 component, your bundle must stop using
50
+ any feature deprecated in 2.8 version, because they'll throw exceptions in 3.0
51
+ version. The easiest way to detect deprecations is to install the `PHPUnit Bridge `_
52
+ component and then run the test suite.
53
+
54
+ First, install the component as a ``dev `` dependency of your bundle:
55
+
56
+ .. code-block :: bash
57
+
58
+ $ composer require --dev " symfony/phpunit-bridge"
59
+
60
+ Then, run your test suite and look for the deprecation list displayed after the
61
+ PHPUnit test report:
62
+
63
+ .. code-block :: bash
64
+
65
+ $ phpunit
66
+
67
+ // ... PHPUnit output ...
50
68
51
- * Install: composer require --dev "symfony/phpunit-bridge" and run your test suite
52
- * Use for basic fixes: https://github.com/umpirsky/Symfony-Upgrade-Fixer
53
- * Read the "UPGRADE from 2.x to Sf3" guide (https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md)
69
+ Remaining deprecation notices (3)
70
+
71
+ The " pattern" option in file ... is deprecated since version 2.2 and will be
72
+ removed in 3.0. Use the " path" option in the route definition instead ...
73
+
74
+ Twig Function " form_enctype" is deprecated. Use " form_start" instead in ...
75
+
76
+ The Symfony\C omponent\S ecurity\C ore\S ecurityContext class is deprecated since
77
+ version 2.6 and will be removed in 3.0. Use ...
78
+
79
+ Fix the reported deprecations, run the test suite again and repeat the process
80
+ until no deprecation usage is reported.
81
+
82
+ Useful Resources
83
+ ~~~~~~~~~~~~~~~~
84
+
85
+ There are several resources that can help you detect, understand and fix the use
86
+ of deprecated features:
87
+
88
+ * `Official Symfony Guide to Upgrade from 2.x to 3.0 `_, the full list of changes
89
+ required to upgrade to Symfony 3.0 and grouped by component.
90
+ * `SensioLabs DeprecationDetector `_, it runs a static code analysis against your
91
+ project's source code to find usages of deprecated methods, classes and
92
+ interfaces. It works for any PHP application, but it includes special detectors
93
+ for Symfony application, where it can also detect usages of deprecated services.
94
+ * `Symfony Upgrade Fixer `_, it analyzes Symfony projects to find deprecations. In
95
+ addition it solves automatically some of them thanks to the growing list of
96
+ supported "fixers".
54
97
55
98
Test your Bundle in Symfony 3
56
99
-----------------------------
@@ -60,3 +103,8 @@ Test your Bundle in Symfony 3
60
103
* Upgrade a test app to Sf3 or create an empty app (symfony new my_app 3.0)
61
104
* Use the "ln -s my_bundle vendor/.../my_bundle" trick to use the new code in the 3.0 app
62
105
* Configure Travis CI to test your bundle in both 2 and 3 versions.
106
+
107
+ .. _`PHPUnit Bridge` : https://github.com/symfony/phpunit-bridge
108
+ .. _`Official Symfony Guide to Upgrade from 2.x to 3.0` : https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md
109
+ .. _`SensioLabs DeprecationDetector` : https://github.com/sensiolabs-de/deprecation-detector
110
+ .. _`Symfony Upgrade Fixer` : https://github.com/umpirsky/Symfony-Upgrade-Fixer
0 commit comments