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