@@ -43,19 +43,26 @@ The above example can be updated to work with Symfony 3 as follows:
43
43
}
44
44
}
45
45
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
+
46
53
Look for Deprecations and Fix Them
47
54
----------------------------------
48
55
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.
53
60
54
61
First, install the component as a ``dev `` dependency of your bundle:
55
62
56
63
.. code-block :: bash
57
64
58
- $ composer require --dev " symfony/phpunit-bridge"
65
+ $ composer require --dev symfony/phpunit-bridge
59
66
60
67
Then, run your test suite and look for the deprecation list displayed after the
61
68
PHPUnit test report:
@@ -64,7 +71,7 @@ PHPUnit test report:
64
71
65
72
$ phpunit
66
73
67
- // ... PHPUnit output ...
74
+ # ... PHPUnit output
68
75
69
76
Remaining deprecation notices (3)
70
77
@@ -85,15 +92,17 @@ Useful Resources
85
92
There are several resources that can help you detect, understand and fix the use
86
93
of deprecated features:
87
94
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".
97
106
98
107
Test your Bundle in Symfony 3
99
108
-----------------------------
@@ -103,12 +112,12 @@ in a Symfony 3 application. Assuming that you already have a Symfony 3 applicati
103
112
you can test the updated bundle locally without having to install it through
104
113
Composer.
105
114
106
- If your operating system supports symbolic lings , just point the appropriate
115
+ If your operating system supports symbolic links , just point the appropriate
107
116
vendor directory to your local bundle root directory:
108
117
109
118
.. code-block :: bash
110
119
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
112
121
113
122
If your operating system doesn't support symbolic links, you'll need to copy
114
123
your local bundle directory into the appropriate directory inside ``vendor/ ``.
@@ -143,13 +152,13 @@ following recommended configuration as the starting point of your own configurat
143
152
before_install :
144
153
- composer self-update
145
154
- 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;
147
156
148
157
install : composer update $COMPOSER_FLAGS
149
158
150
- script : phpunit -v
159
+ script : phpunit
151
160
152
- .. _`PHPUnit Bridge ` : https://github.com/symfony/phpunit-bridge
161
+ .. _`symfony/phpunit-bridge package ` : https://github.com/symfony/phpunit-bridge
153
162
.. _`Official Symfony Guide to Upgrade from 2.x to 3.0` : https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md
154
163
.. _`SensioLabs DeprecationDetector` : https://github.com/sensiolabs-de/deprecation-detector
155
164
.. _`Symfony Upgrade Fixer` : https://github.com/umpirsky/Symfony-Upgrade-Fixer
0 commit comments