Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opt in deprecations docs #3123

Merged
merged 2 commits into from
May 2, 2018
Merged

Opt in deprecations docs #3123

merged 2 commits into from
May 2, 2018

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented May 1, 2018

No description provided.

.. code-block:: php

<?php
set_error_handler(function (
Copy link
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
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
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.

@jwage jwage merged commit a6b7bb8 into doctrine:2.7 May 2, 2018
@Majkl578
Copy link
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
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