You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Contributing] [Standards] Add note about trigger_error() and deprecation messages
| Q | A
| ------------- | ---
| Doc fix? | no
| New docs? | no
| Applies to | 2.3+
| Fixed tickets |
Add note and example on how to trigger proper deprecation messages.
Copy file name to clipboardExpand all lines: contributing/code/standards.rst
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,18 @@ example containing most features described below:
50
50
$this->fooBar = $this->transformText($dummy);
51
51
}
52
52
53
+
/**
54
+
* @return string
55
+
*
56
+
* @deprecated
57
+
*/
58
+
public function someDeprecatedMethod()
59
+
{
60
+
@trigger_error(sprintf('The %s() method is deprecated since version 2.8 and will be removed in 3.0. Use Acme\Baz::someMethod() instead.', __METHOD__), E_USER_DEPRECATED);
61
+
62
+
return Baz::someMethod();
63
+
}
64
+
53
65
/**
54
66
* Transforms the input given as first argument.
55
67
*
@@ -151,7 +163,11 @@ Structure
151
163
* Use parentheses when instantiating classes regardless of the number of
152
164
arguments the constructor has;
153
165
154
-
* Exception message strings should be concatenated using :phpfunction:`sprintf`.
166
+
* Exception and error message strings should be concatenated using :phpfunction:`sprintf`.
167
+
168
+
* Calls to :phpfunction:`trigger_error` with type ``E_USER_DEPRECATED`` should be
169
+
switched to opt-in via ``@`` operator.
170
+
Read more at :ref:`contributing-code-conventions-deprecations`;
0 commit comments