@@ -43,19 +43,26 @@ The above example can be updated to work with Symfony 3 as follows:
4343 }
4444 }
4545
46+ .. tip ::
47+
48+ Another common version constraint found on third-party bundles is ``>=2.N ``.
49+ You should avoid using that constraint because it can wrongly consider as
50+ valid some Symfony versions which are in fact incompatible with your bundle.
51+ Use instead ``~2.N|~3.0 `` or ``^2.N|~3.0 `` to make your bundle future-proof.
52+
4653Look for Deprecations and Fix Them
4754----------------------------------
4855
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.
56+ Besides allowing to install Symfony 3 packages , your bundle must stop using
57+ any feature deprecated in 2.8 version, because they are removed (and you'll get
58+ exceptions or PHP errors) . The easiest way to detect deprecations is to install
59+ the ` symfony/phpunit-bridge package `_ and then run the test suite.
5360
5461First, install the component as a ``dev `` dependency of your bundle:
5562
5663.. code-block :: bash
5764
58- $ composer require --dev " symfony/phpunit-bridge"
65+ $ composer require --dev symfony/phpunit-bridge
5966
6067 Then, run your test suite and look for the deprecation list displayed after the
6168PHPUnit test report:
@@ -64,7 +71,7 @@ PHPUnit test report:
6471
6572 $ phpunit
6673
67- // ... PHPUnit output ...
74+ # ... PHPUnit output
6875
6976 Remaining deprecation notices (3)
7077
@@ -85,15 +92,17 @@ Useful Resources
8592There are several resources that can help you detect, understand and fix the use
8693of deprecated features:
8794
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".
95+ `Official Symfony Guide to Upgrade from 2.x to 3.0 `_
96+ The full list of changes required to upgrade to Symfony 3.0 and grouped
97+ by component.
98+ `SensioLabs DeprecationDetector `_
99+ It runs a static code analysis against your project's source code to find
100+ usages of deprecated methods, classes and interfaces. It works for any PHP
101+ application, but it includes special detectors for Symfony applications,
102+ where it can also detect usages of deprecated services.
103+ `Symfony Upgrade Fixer `_
104+ It analyzes Symfony projects to find deprecations. In addition it solves
105+ automatically some of them thanks to the growing list of supported "fixers".
97106
98107Test your Bundle in Symfony 3
99108-----------------------------
@@ -103,12 +112,12 @@ in a Symfony 3 application. Assuming that you already have a Symfony 3 applicati
103112you can test the updated bundle locally without having to install it through
104113Composer.
105114
106- If your operating system supports symbolic lings , just point the appropriate
115+ If your operating system supports symbolic links , just point the appropriate
107116vendor directory to your local bundle root directory:
108117
109118.. code-block :: bash
110119
111- $ ln -s /path/to/your/local/bundle/ vendor/you-vendor-name/your-buncle -name
120+ $ ln -s /path/to/your/local/bundle/ vendor/you-vendor-name/your-bundle -name
112121
113122 If your operating system doesn't support symbolic links, you'll need to copy
114123your local bundle directory into the appropriate directory inside ``vendor/ ``.
@@ -143,13 +152,13 @@ following recommended configuration as the starting point of your own configurat
143152 before_install :
144153 - composer self-update
145154 - if [ "$DEPENDENCIES" == "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
146- - if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION}; fi;
155+ - if [ "$SYMFONY_VERSION" != "" ]; then composer --no-update require symfony/symfony:${SYMFONY_VERSION}; fi;
147156
148157 install : composer update $COMPOSER_FLAGS
149158
150- script : phpunit -v
159+ script : phpunit
151160
152- .. _`PHPUnit Bridge ` : https://github.com/symfony/phpunit-bridge
161+ .. _`symfony/phpunit-bridge package ` : https://github.com/symfony/phpunit-bridge
153162.. _`Official Symfony Guide to Upgrade from 2.x to 3.0` : https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md
154163.. _`SensioLabs DeprecationDetector` : https://github.com/sensiolabs-de/deprecation-detector
155164.. _`Symfony Upgrade Fixer` : https://github.com/umpirsky/Symfony-Upgrade-Fixer
0 commit comments