Skip to content

Commit 9b2e565

Browse files
committed
Document the weak_vendors value
1 parent 7893772 commit 9b2e565

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

components/phpunit_bridge.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,25 @@ an arbitrary value (ex: ``320``) will make the tests fails only if a higher
119119
number of deprecation notices is reached (``0`` is the default value). You can
120120
also set the value ``"weak"`` which will make the bridge ignore any deprecation
121121
notices. This is useful to projects that must use deprecated interfaces for
122-
backward compatibility reasons.
122+
backward compatibility reasons, or for libraries with lots of vendors that
123+
can create a sudden backlog of deprecations to fix that would otherwise prevent
124+
unrelated pull requests from being merged… which leads us to ``"weak_vendors"``.
125+
126+
When you maintain a library with a lot of vendors, having the test suite fail
127+
as soon as a dependency introduces a new deprecation is not desirable, because
128+
it shifts the burden of fixing that deprecation to any contributor that happens
129+
to submit a pull request shortly after a new vendor release is made with that
130+
deprecation. To mitigate this, you can either use tighter requirements, in the
131+
hope that dependencies will not introduce deprecations in a patch version, or
132+
even commit the Composer lock file, which would create another class of issues.
133+
Libraries will often use ``SYMFONY_DEPRECATIONS_HELPER=weak`` because of this.
134+
This has the drawback of allowing contributions that introduce deprecations but:
135+
* forget to fix the deprecated calls if there are any;
136+
* forget to mark appropriate tests with the ``@group legacy`` annotations.
137+
By using the ``"weak_vendors"`` value, deprecations that are triggered outside
138+
the ``vendors`` directory will make the test suite fail, while deprecations
139+
triggered from a library inside it will not, giving you the best of both
140+
worlds.
123141

124142
Disabling the Deprecation Helper
125143
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)