You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.2 KiB

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