Skip to content

Opt in deprecations docs#3123

Merged
jwage merged 2 commits intodoctrine:2.7from
greg0ire:opt-in_deprecations
May 2, 2018
Merged

Opt in deprecations docs#3123
jwage merged 2 commits intodoctrine:2.7from
greg0ire:opt-in_deprecations

Conversation

@greg0ire
Copy link
Copy Markdown
Member

@greg0ire greg0ire commented May 1, 2018

No description provided.

@greg0ire greg0ire force-pushed the opt-in_deprecations branch from 009c04b to c8a5ef4 Compare May 1, 2018 10:58
.. code-block:: php

<?php
set_error_handler(function (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it actually a good idea to overwrite handler for all messages like that? Can we maybe suggest this instead only for deprecations?

set_error_handler(
    function (int $code, string $message, string $file, int $line) : void {
        echo sprintf('Deprecation: "%s" in %s:%d', $message, $file, $line);
    },
    E_USER_DEPRECATED
);

https://3v4l.org/AFfPk

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

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 display deprecations
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to expand on the symfony/phpunit-bridge part. Imho that's the most convenient opt-in method.

@greg0ire greg0ire force-pushed the opt-in_deprecations branch from c8a5ef4 to 041a769 Compare May 1, 2018 15:06
@jwage jwage merged commit a6b7bb8 into doctrine:2.7 May 2, 2018
@Majkl578
Copy link
Copy Markdown
Contributor

Majkl578 commented May 2, 2018

Uh, we don't usually merge to 2.x branches, rather cherry-pick from master. This needs to be picked up to master now. :|

@jwage jwage mentioned this pull request May 2, 2018
@Majkl578 Majkl578 added this to the 2.7.2 milestone May 2, 2018
@greg0ire greg0ire deleted the opt-in_deprecations branch May 2, 2018 05:46
@greg0ire
Copy link
Copy Markdown
Member Author

greg0ire commented May 2, 2018

Uh, we don't usually merge to 2.x branches, rather cherry-pick from master. This needs to be picked up to master now. :|

Ah right, sorry for this

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants