Skip to content

Commit

Permalink
fixup! Document changes in the deprecation error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Olena Kirichok authored and javiereguiluz committed May 31, 2019
1 parent 2a750ea commit 988badf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ of Symfony and the latest beta release:
include:
# Minimum supported dependencies with the latest and oldest PHP version
- php: 7.2
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[internal]=0"
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
- php: 7.0
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[internal]=0"
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="max[self]=0"
# Test the latest stable release
- php: 7.0
Expand Down
27 changes: 14 additions & 13 deletions components/phpunit_bridge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ arbitrary threshold by setting ``SYMFONY_DEPRECATIONS_HELPER`` to
higher number of deprecation notices is reached (``0`` is the default
value).

You can even finer-grained control by using other keys of the ``max``
array, which are ``internal``, ``direct``, and ``indirect``. The
You can have even finer-grained control by using other keys of the ``max``
array, which are ``self``, ``direct``, and ``indirect``. The
``SYMFONY_DEPRECATIONS_HELPER`` environment variable accept a
url-encoded string, meaning you can combine thresholds and any other
configuration setting, like this:
``SYMFONY_DEPRECATIONS_HELPER=max[total]=42&max[internal]=0&verbose=0``
``SYMFONY_DEPRECATIONS_HELPER=max[total]=42&max[self]=0&verbose=0``

Internal deprecations
.....................
Expand All @@ -221,7 +221,7 @@ but:
* forget to fix the deprecated calls if there are any;
* forget to mark appropriate tests with the ``@group legacy`` annotations.

By using ``SYMFONY_DEPRECATIONS_HELPER=max[internal]=0``,
By using ``SYMFONY_DEPRECATIONS_HELPER=max[self]=0``,
deprecations that are triggered outside the ``vendors`` directory will
be accounted for seperately, while deprecations triggered from a library
inside it will not (unless you reach 999999 of these), giving you
Expand All @@ -234,33 +234,34 @@ When working on a project, you might be more interested in
``max[direct]``. Let's say you want to fix deprecations as soon as
they appear. A problem many people experience is that some dependencies
they have tend to lag behind their own dependencies, meaning they do not
fix deprecations as soon as possible, which means there is nothing you
can do to fix those (apart from a pull request on the outdated vendor).
This key allows you to put a threshold on direct deprecations only,
allowing you to notice when *your code* is using deprecated APIs, and to
keep up with the changes. You can of course still use ``max[indirect]``
if you want to keep indirect deprecations under a given threshold.
fix deprecations as soon as possible, which means you should create a pull
request on the outdated vendor, and ignore these deprecations until your
pull request is merged. This key allows you to put a threshold on direct
deprecations only,allowing you to notice when *your code* is using
deprecated APIs, and to keep up with the changes. You can of course
still use ``max[indirect]`` if you want to keep indirect deprecations
under a given threshold.

Here is a summary that should help you pick the right configuration:

+------------------------+-----------------------------------------------------+
| Value | Recommended situation |
+========================+=====================================================+
| max[total]=0 | Recommended for actively maintained projects |
| | with little to no dependencies |
| | with robust/no dependencies |
+------------------------+-----------------------------------------------------+
| max[direct]=0 | Recommended for projects with dependencies |
| | that fail to keep up with new deprecations. |
+------------------------+-----------------------------------------------------+
| max[internal]=0 | Recommended for libraries that use |
| max[self]=0 | Recommended for libraries that use |
| | the deprecation system themselves and |
| | cannot afford to use one of the modes above. |
+------------------------+-----------------------------------------------------+

Disabling the verbose output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, the brige will display a detailed output with the number of
By default, the bridge will display a detailed output with the number of
deprecations and where they arise. If this is too much for you, you can
use ``SYMFONY_DEPRECATIONS_HELPER=verbose=0`` to turn the verbose output
off.
Expand Down

0 comments on commit 988badf

Please sign in to comment.