Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4b13fab

Browse filesBrowse files
committed
Completed the section "Look for Deprecations and Fix Them"
1 parent 0e585b4 commit 4b13fab
Copy full SHA for 4b13fab

File tree

Expand file treeCollapse file tree

1 file changed

+54
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+54
-6
lines changed
Open diff view settings
Collapse file

‎cookbook/upgrade/bundles.rst‎

Copy file name to clipboardExpand all lines: cookbook/upgrade/bundles.rst
+54-6Lines changed: 54 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Most third-party bundles define their Symfony dependencies using the ``~2.N`` or
2222
"require": {
2323
"symfony/framework-bundle": "~2.3",
2424
"symfony/finder": "~2.3",
25-
"symfony/validator": "~2.3",
25+
"symfony/validator": "~2.3"
2626
}
2727
}
2828
@@ -39,18 +39,61 @@ The above example can be updated to work with Symfony 3 as follows:
3939
"require": {
4040
"symfony/framework-bundle": "~2.3|~3.0",
4141
"symfony/finder": "~2.3|~3.0",
42-
"symfony/validator": "~2.3|~3.0",
42+
"symfony/validator": "~2.3|~3.0"
4343
}
4444
}
4545
4646
Look for Deprecations and Fix Them
4747
----------------------------------
4848

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 ...
5068
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\Component\Security\Core\SecurityContext 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".
5497

5598
Test your Bundle in Symfony 3
5699
-----------------------------
@@ -60,3 +103,8 @@ Test your Bundle in Symfony 3
60103
* Upgrade a test app to Sf3 or create an empty app (symfony new my_app 3.0)
61104
* Use the "ln -s my_bundle vendor/.../my_bundle" trick to use the new code in the 3.0 app
62105
* 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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.