xref: /template/strap/vendor/symfony/deprecation-contracts/function.php (revision 04fd306c7c155fa133ebb3669986875d65988276)
1*04fd306cSNickeau<?php
2*04fd306cSNickeau
3*04fd306cSNickeau/*
4*04fd306cSNickeau * This file is part of the Symfony package.
5*04fd306cSNickeau *
6*04fd306cSNickeau * (c) Fabien Potencier <fabien@symfony.com>
7*04fd306cSNickeau *
8*04fd306cSNickeau * For the full copyright and license information, please view the LICENSE
9*04fd306cSNickeau * file that was distributed with this source code.
10*04fd306cSNickeau */
11*04fd306cSNickeau
12*04fd306cSNickeauif (!function_exists('trigger_deprecation')) {
13*04fd306cSNickeau    /**
14*04fd306cSNickeau     * Triggers a silenced deprecation notice.
15*04fd306cSNickeau     *
16*04fd306cSNickeau     * @param string $package The name of the Composer package that is triggering the deprecation
17*04fd306cSNickeau     * @param string $version The version of the package that introduced the deprecation
18*04fd306cSNickeau     * @param string $message The message of the deprecation
19*04fd306cSNickeau     * @param mixed  ...$args Values to insert in the message using printf() formatting
20*04fd306cSNickeau     *
21*04fd306cSNickeau     * @author Nicolas Grekas <p@tchwork.com>
22*04fd306cSNickeau     */
23*04fd306cSNickeau    function trigger_deprecation(string $package, string $version, string $message, ...$args): void
24*04fd306cSNickeau    {
25*04fd306cSNickeau        @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
26*04fd306cSNickeau    }
27*04fd306cSNickeau}
28