Commit c196cbee authored by Grégoire Paris's avatar Grégoire Paris Committed by Jonathan H. Wage

Add page about upgrading

Fixes #3121

Conflicts:
	docs/en/index.rst
parent b37f898d
Upgrading
=========
New versions of Doctrine come with an upgrade guide named UPGRADE.md.
This guide documents BC-breaks and deprecations.
Deprecations
------------
Deprecations are signaled by emitting a silenced ``E_USER_DEPRECATED``
error, like this:
.. code-block:: php
<?php
@trigger_error(
'QuantumDefraculator::__invoke() is deprecated.',
E_USER_DEPRECATED
);
Since this error is silenced, it will not produce any effect unless you
opt-in by setting up an error handler designed to ignore the silence
operator in that case. Such an error handler could look like this:
.. code-block:: php
<?php
set_error_handler(function (
int $errno,
string $errstr,
string $errfile,
int $errline,
array $errcontext
) : void {
if (error_reporting() === 0) {
/* "normal" error handlers would return in this case, but
this one will not */
}
echo "Hey there was a deprecation, here is what it says: $errstr";
}, E_USER_DEPRECATED);
This is of course overly simplified, and if you are looking for such an
error handler, consider the ``symfony/debug``, error handler that will
log deprecations. You may also be interested by the
``symfony/phpunit-bridge`` error handler that will catch deprecations
and nicely display them after running your test suites, and can even
make your build fail in that kind of case if you want to be strict about
that.
......@@ -19,3 +19,4 @@
reference/portability
reference/caching
reference/known-vendor-issues
reference/upgrading
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment