rfc:e-user-deprecated-warning

Request for Comments: E_USER_DEPRECATED

Introduction

In 5.3 we introduced E_DEPRECATED to mark internal functions/classes/syntax elements as deprecated with a separate error level. The same deprecation process applies for user level code. That's why we should introduce E_USER_DEPRECATED similar to the already present user space levels E_USER_WARNING, E_USER_NOTICE and E_USER_ERROR.

Proposal and Patch

Use cases

UC 1: Deprecation warning in a constructor

<?php
class Foo
{
    public function __construct()
    {
        trigger_error('Use Bar instead', E_USER_DEPRECATED);
    }
}

UC 2: Deprecation warning at function call

<?php
function do_something()
{
    trigger_error('Use do_something_else() instead', E_USER_DEPRECATED);
}

UC 3: Deprecation warning when a file is included

<?php
// MY_FUNKY_LIBRARY
trigger_error('Use non-funky library', E_USER_DEPRECATED);
 
...
rfc/e-user-deprecated-warning.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1