| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 1 |
+Symfony Deprecation Contracts |
|
| 2 |
+============================= |
|
| 3 |
+ |
|
| 4 |
+A generic function and convention to trigger deprecation notices. |
|
| 5 |
+ |
|
| 6 |
+This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. |
|
| 7 |
+ |
|
| 8 |
+By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, |
|
| 9 |
+the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. |
|
| 10 |
+ |
|
| 11 |
+The function requires at least 3 arguments: |
|
| 12 |
+ - the name of the Composer package that is triggering the deprecation |
|
| 13 |
+ - the version of the package that introduced the deprecation |
|
| 14 |
+ - the message of the deprecation |
|
| 15 |
+ - more arguments can be provided: they will be inserted in the message using `printf()` formatting |
|
| 16 |
+ |
|
| 17 |
+Example: |
|
| 18 |
+```php |
|
| 19 |
+trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin');
|
|
| 20 |
+``` |
|
| 21 |
+ |
|
| 22 |
+This will generate the following message: |
|
| 23 |
+`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` |
|
| 24 |
+ |
|
| 25 |
+While not recommended, the deprecation notices can be completely ignored by declaring an empty |
|
| 26 |
+`function trigger_deprecation() {}` in your application.
|