trigger_deprecation example


    public function setCallback(string $callback = null)static
    {
        if (1 > \func_num_args()) {
            trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
        }
        if (null !== $callback) {
            // partially taken from https://geekality.net/2011/08/03/valid-javascript-identifier/             // partially taken from https://github.com/willdurand/JsonpCallbackValidator             // JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details.             // (c) William Durand <william.durand1@gmail.com>             $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u';
            $reserved = [
                'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while',
                'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super',  'const', 'export',
                'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false',
            ];

        return $this->addPart((new DataPart(new File($path)$name$contentType))->asInline());
    }

    /** * @return $this * * @deprecated since Symfony 6.2, use addPart() instead */
    public function attachPart(DataPart $part)static
    {
        @trigger_deprecation('symfony/mime', '6.2', 'The "%s()" method is deprecated, use "addPart()" instead.', __METHOD__);

        return $this->addPart($part);
    }

    /** * @return $this */
    public function addPart(DataPart $part)static
    {
        $this->cachedBody = null;
        $this->attachments[] = $part;

        


namespace Symfony\Component\Messenger\EventListener;

use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\SignalableCommandInterface;

trigger_deprecation('symfony/messenger', '6.3', '"%s" is deprecated, use the "%s" instead.', StopWorkerOnSigtermSignalListener::class, SignalableCommandInterface::class);

/** * @author Tobias Schultze <http://tobion.de> * * @deprecated since Symfony 6.3, use the {@see SignalableCommandInterface} instead */
class StopWorkerOnSigtermSignalListener extends StopWorkerOnSignalsListener
{
    public function __construct(LoggerInterface $logger = null)
    {
        parent::__construct(\defined('SIGTERM') ? [\SIGTERM] : []$logger);
    }
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Bridge\MailPace\Transport\MailPaceSmtpTransport;
use Symfony\Component\Mailer\Envelope;
use Symfony\Component\Mailer\Header\TagHeader;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\RawMessage;

trigger_deprecation('symfony/oh-my-smtp-mailer', '6.2', 'The "%s" class is deprecated, use "%s" instead.', OhMySmtpSmtpTransport::class, MailPaceSmtpTransport::class);

/** * @author Paul Oms <support@ohmysmtp.com> * * @deprecated since Symfony 6.2, use MailPaceSmtpTransport instead */
final class OhMySmtpSmtpTransport extends EsmtpTransport
{
    public function __construct(string $id, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
    {
        parent::__construct('smtp.ohmysmtp.com', 587, false, $dispatcher$logger);

        

class TraceableSerializer implements SerializerInterface, NormalizerInterface, DenormalizerInterface, EncoderInterface, DecoderInterface
{
    public const DEBUG_TRACE_ID = 'debug_trace_id';

    public function __construct(
        private SerializerInterface&NormalizerInterface&DenormalizerInterface&EncoderInterface&DecoderInterface $serializer,
        private SerializerDataCollector $dataCollector,
    ) {
        if (!method_exists($serializer, 'getSupportedTypes')) {
            trigger_deprecation('symfony/serializer', '6.3', 'Not implementing the "NormalizerInterface::getSupportedTypes()" in "%s" is deprecated.', get_debug_type($serializer));
        }
    }

    public function serialize(mixed $data, string $format, array $context = []): string
    {
        $context[self::DEBUG_TRACE_ID] = $traceId = uniqid();

        $startTime = microtime(true);
        $result = $this->serializer->serialize($data$format$context);
        $time = microtime(true) - $startTime;

        
'dot',
    ];

    public function __construct($workflows)
    {
        parent::__construct();

        if ($workflows instanceof ServiceLocator) {
            $this->workflows = $workflows;
        } elseif (\is_array($workflows)) {
            $this->definitions = $workflows;
            trigger_deprecation('symfony/framework-bundle', '6.2', 'Passing an array of definitions in "%s()" is deprecated. Inject a ServiceLocator filled with all workflows instead.', __METHOD__);
        } else {
            throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an array or a ServiceLocator, "%s" given.', __METHOD__, \gettype($workflows)));
        }
    }

    protected function configure(): void
    {
        $this
            ->setDefinition([
                new InputArgument('name', InputArgument::REQUIRED, 'A workflow name'),
                new InputArgument('marking', InputArgument::IS_ARRAY, 'A marking (a list of places)'),
                
$credentials['password'] = $this->propertyAccessor->getValue($data$this->options['password_path']);
            $this->propertyAccessor->setValue($data$this->options['password_path'], null);

            if (!\is_string($credentials['password'])) {
                throw new BadRequestHttpException(sprintf('The key "%s" must be a string.', $this->options['password_path']));
            }
        } catch (AccessException $e) {
            throw new BadRequestHttpException(sprintf('The key "%s" must be provided.', $this->options['password_path'])$e);
        }

        if ('' === $credentials['username'] || '' === $credentials['password']) {
            trigger_deprecation('symfony/security', '6.2', 'Passing an empty string as username or password parameter is deprecated.');
        }

        return $credentials;
    }
}
private string $ldapServiceId;
    private string $dnString;
    private string $searchDn;
    private string $searchPassword;
    private ?string $queryString;

    public function __construct(string $ldapServiceId, string $dnString = '{user_identifier}', string $searchDn = '', string $searchPassword = '', string $queryString = null)
    {
        $this->ldapServiceId = $ldapServiceId;
        $dnString = str_replace('{username}', '{user_identifier}', $dnString$replaceCount);
        if ($replaceCount > 0) {
            trigger_deprecation('symfony/ldap', '6.2', 'Using "{username}" parameter in LDAP configuration is deprecated, consider using "{user_identifier}" instead.');
        }
        $this->dnString = $dnString;
        $this->searchDn = $searchDn;
        $this->searchPassword = $searchPassword;
        $queryString = str_replace('{username}', '{user_identifier}', $queryString ?? '', $replaceCount);
        if ($replaceCount > 0) {
            trigger_deprecation('symfony/ldap', '6.2', 'Using "{username}" parameter in LDAP configuration is deprecated, consider using "{user_identifier}" instead.');
        }
        $this->queryString = $queryString;
    }

    


namespace Symfony\Component\Messenger\Transport;

use Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport as BaseInMemoryTransport;

trigger_deprecation('symfony/messenger', '6.3', 'The "%s" class is deprecated, use "%s" instead. ', InMemoryTransport::class, BaseInMemoryTransport::class);

/** * @deprecated since Symfony 6.3, use {@link BaseInMemoryTransport} instead */
class InMemoryTransport extends BaseInMemoryTransport
{
}

        if (!$container->hasAlias($id)) {
            return $id;
        }

        $alias = $container->getAlias($id);

        if ($alias->isDeprecated()) {
            $referencingDefinition = $container->hasDefinition($this->currentId) ? $container->getDefinition($this->currentId) : $container->getAlias($this->currentId);
            if (!$referencingDefinition->isDeprecated()) {
                $deprecation = $alias->getDeprecation($id);
                trigger_deprecation($deprecation['package']$deprecation['version']rtrim($deprecation['message'], '. ').'. It is being referenced by the "%s" '.($container->hasDefinition($this->currentId) ? 'service.' : 'alias.')$this->currentId);
            }
        }

        $seen = [];
        do {
            if (isset($seen[$id])) {
                throw new ServiceCircularReferenceException($idarray_merge(array_keys($seen)[$id]));
            }

            $seen[$id] = true;
            $id = (string) $container->getAlias($id);
        }
break;
                    }

                    $key = substr($key, 0, -1 * (1 + array_pop($namePartsLength)));
                }
            }

            throw new ParameterNotFoundException($name, null, null, null, $alternatives$nonNestedAlternative);
        }

        if (isset($this->deprecatedParameters[$name])) {
            trigger_deprecation(...$this->deprecatedParameters[$name]);
        }

        return $this->parameters[$name];
    }

    /** * @return void */
    public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value)
    {
        if (is_numeric($name)) {
            


namespace Symfony\Bridge\Doctrine\SchemaListener;

use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Tools\ToolEvents;
use Symfony\Bridge\Doctrine\Security\RememberMe\DoctrineTokenProvider;

trigger_deprecation('symfony/doctrine-bridge', '6.3', 'The "%s" class is deprecated. Use "%s" instead.', RememberMeTokenProviderDoctrineSchemaSubscriber::class, RememberMeTokenProviderDoctrineSchemaListener::class);

/** * Automatically adds the rememberme table needed for the {@see DoctrineTokenProvider}. * * @author Wouter de Jong <wouter@wouterj.nl> * * @deprecated since Symfony 6.3, use {@link RememberMeTokenProviderDoctrineSchemaListener} instead */
final class RememberMeTokenProviderDoctrineSchemaSubscriber extends RememberMeTokenProviderDoctrineSchemaListener implements EventSubscriber
{
    public function getSubscribedEvents(): array
    {

    public function setExpires(\DateTimeInterface $date = null)static
    {
        if (1 > \func_num_args()) {
            trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
        }
        if (null === $date) {
            $this->headers->remove('Expires');

            return $this;
        }

        if ($date instanceof \DateTime) {
            $date = \DateTimeImmutable::createFromMutable($date);
        }

        
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
            if (!($type = $reflectionProperty->getType()) instanceof \ReflectionNamedType) {
                continue;
            }
            $doc = false;
            if (!$reflectionProperty->getAttributes(Required::class)
                && ((false === $doc = $reflectionProperty->getDocComment()) || false === stripos($doc, '@required') || !preg_match('#(?:^/\*\*|\n\s*+\*)\s*+@required(?:\s|\*/$)#i', $doc))
            ) {
                continue;
            }
            if ($doc) {
                trigger_deprecation('symfony/dependency-injection', '6.3', 'Using the "@required" annotation on property "%s::$%s" is deprecated, use the "Symfony\Contracts\Service\Attribute\Required" attribute instead.', $reflectionProperty->class, $reflectionProperty->name);
            }
            if (\array_key_exists($name = $reflectionProperty->getName()$properties)) {
                continue;
            }

            $type = $type->getName();
            $value->setProperty($namenew TypedReference($type$type, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name));
        }

        return $value;
    }
}
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */

namespace Symfony\Component\Templating\Helper;

trigger_deprecation('symfony/templating', '6.4', '"%s" is deprecated since version 6.4 and will be removed in 7.0. Use Twig instead.', SlotsHelper::class);

/** * SlotsHelper manages template slots. * * @author Fabien Potencier <fabien@symfony.com> * * @deprecated since Symfony 6.4, use Twig instead */
class SlotsHelper extends Helper
{
    protected $slots = [];
    
Home | Imprint | This part of the site doesn't use cookies.