buted with this source code.
 */

namespace Symfony\Component\Uid\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Uid\Exception\InvalidArgumentException;
use Symfony\Component\Uid\Uuid47Transformer;
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV7;

#[RequiresPhpExtension('sodium')]
class Uuid47TransformerTest extends TestCase
{

adcfe'));
    }

    #[TestWith([''])]
    #[TestWith(['x'])]
    #[TestWith(['tooshort'])]
    #[TestWith(['123456789012345'])]
    public function testConstructorRequiresAtLeast16ByteKey(string $secret)
    {
        $this->expectException(InvalidArgumen

private function createConverter(): Uuid47Transformer
    {
        // K0 = 0x0123456789abcdef, K1 = 0xfedcba9876543210 (little-endian byte representation)
        return new Uuid47Transformer(hex2bin('efcdab89674523011032547698b


se Symfony\Component\Uid\UuidV5;
use Symfony\Component\Uid\UuidV6;
use Symfony\Component\Uid\UuidV7;

class UuidTest extends TestCase
{
    private const A_UUID_V1 = 'd9e7a184-5d5b-11ea-a62a-3499710062d0';
    private const A_UUID_V4 = 'd6b3345b-2905-4048-a83c-b5988e765d98';
    private const A_UUID_V7 = '017f22e2-79b0-7cc3-98c4-dc0c0c07398f';

    #[DataProvider('provideInvalidUuids')]
    public function testConstructorWithInvalidUuid(string $uuid)
    {
        $this->expectException(InvalidArgumentExcep

'these are just thirty-six characters'];
    }

    public function testInvalidUuidContainsInvalidValue()
    {
        $invalidUuid = 'this is not a uuid';

        try {
            Uuid::fromString($invalidUuid);
            $this->fail(\sprintf('Expect

tion::class);
        $this->expectExceptionMessage('Invalid UUID.');

        Uuid::fromString($uuid);
    }

    public static function provideInvalidUuids(): iterable
    {
        yield ['this is not a uuid'];
        yield [


rgumentException;
use Symfony\Component\Uid\Exception\LogicException;
use Symfony\Component\Uid\Factory\MockUuidFactory;
use Symfony\Component\Uid\UuidV1;
use Symfony\Component\Uid\UuidV3;
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV5;
use Symfony\Component\Uid\UuidV6;
use Symfony\Component\Uid\UuidV7;
use Symfony\Component\Uid\UuidV8;

class MockUuidFactoryTest extends TestCase
{
    #[DataProvider('provideSequences')]
    public function testCreate(iterable $sequence, array $expected)

    {
        $factory = new MockUuidFactory($sequence);
        foreach ($expected as $expectedUuid) {
            $this->assertEquals($expectedUuid, $factory->create());
        }
    }

    public static function provideSeque


 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\Uid\Tests\Factory;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Uid\Exception\InvalidArgumentException;
use Symfony\Component\Uid\Factory\UlidFactory;

final class UlidFactoryTest extends TestCase
{
    public function testCreate()
    {
        $u

        $ulid2 = $ulidFactory->create(new \DateTimeImmutable('@999999.123000'));
        $this->assertSame('999999.123000', $ulid2->getDateTime()->format('U.u'));

        $this->assertFalse($ulid1->equals($ulid2));
        $this->assertSame(-1, $ulid1->co

lidFactory = new UlidFactory();

        $ulidFactory->create();

        $ulid1 = $ulidFactory->create(new \DateTimeImmutable('@999999.123000'));
        $this->assertSame('999999.123000', $ulid1->getDateTime()->format('U.u'));


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Uid\Tests\Factory;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Uid\Exception\InvalidArgumentException;
use Symfony\Component\Uid\Factory\UuidFactory;
use Symfony\Component\Uid\NilUuid;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Uid\UuidV1;
use Symfony\Component\Uid\UuidV3;
use Symfony\Component\Uid\UuidV4;
use Symfony\Compon

:class, (new UuidFactory())->nameBased('6f80c216-0492-4421-bd82-c10ab929ae84')->create('foo'));
        $this->assertInstanceOf(UuidV3::class, (new UuidFactory(6, 6, 3))->nameBased('6f80c216-0492-4421-bd82-c10ab929ae84')->create('foo'));
    }

    public

ent\Uid\UuidV5;
use Symfony\Component\Uid\UuidV6;
use Symfony\Component\Uid\UuidV7;

final class UuidFactoryTest extends TestCase
{
    public function testCreateNamedDefaultVersion()
    {
        $this->assertInstanceOf(UuidV5:


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Uid\Tests\Command;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandCompletionTester;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Uid\Command\GenerateUlidComman

).substr($time, 1, 4);

        $commandTester = new CommandTester(new GenerateUlidCommand());

        $this->assertSame(0, $commandTester->execute([]));

        $ulid = Ulid::fromBase32(trim($commandTester->getDisplay()));
        $this->assertEquals(\D

d;
use Symfony\Component\Uid\Ulid;

final class GenerateUlidCommandTest extends TestCase
{
    #[Group('time-sensitive')]
    public function testDefaults()
    {
        $time = microtime(false);
        $time = substr($time, 11


se Symfony\Component\Console\Tester\CommandCompletionTester;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Uid\Command\GenerateUuidCommand;
use Symfony\Component\Uid\Factory\UuidFactory;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Uid\UuidV1;
use Symfony\Component\Uid\UuidV3;
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV5;
use Symfony\Component\Uid\UuidV7;

final class GenerateUuidCommandTest extends TestCase
{
    public function testDefaults()

))));

        $commandTester = new CommandTester(new GenerateUuidCommand(new UuidFactory(UuidV4::class)));
        $this->assertSame(0, $commandTester->execute([]));
        $this->assertInstanceOf(UuidV4::class, Uuid::fromRfc4122(trim($commandTester->get

{
        $commandTester = new CommandTester(new GenerateUuidCommand());
        $this->assertSame(0, $commandTester->execute([]));
        $this->assertInstanceOf(UuidV7::class, Uuid::fromRfc4122(trim($commandTester->getDisplay(


 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\Uid\Tests\Command;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Uid\Command\InspectUlidCommand;

final class InspectUlidCommandTest extends TestCase
{
    public function test()
    {
        $commandTester =

 ([
            '01E439TP9XJZ9RPFH3T1PYBCR8',
            '1BKocMc5BnrVcuq2ti4Eqm',
            '0171069d-593d-97d3-8b3e-23d06de5b308',
        ] as $ulid) {
            $this->assertSame(0, $commandTester->execute(['ulid' => $ulid]));
            $this->a

new CommandTester(new InspectUlidCommand());

        $this->assertSame(1, $commandTester->execute(['ulid' => 'foobar']));
        $this->assertStringContainsString('Invalid ULID.', $commandTester->getDisplay());

        foreach


ctUuidCommand;

final class InspectUuidCommandTest extends TestCase
{
    public function testInvalid()
    {
        $commandTester = new CommandTester(new InspectUuidCommand());

        $this->assertSame(1, $commandTester->execute(['uuid' => 'foobar']));
        $this->assertStringContainsString('Invalid UUID.', $commandTester->getDisplay());
    }

    public function testNil()
    {
        $commandTester = new CommandTester(new InspectUuidCommand());

        $this->assertSame(0, $commandTester->execu


GEX = '(?i:_?[A-Z][A-Z0-9_]*+)';
    public const STATE_VARNAME = 0;
    public const STATE_VALUE = 1;

    private string $path;
    private int $cursor;
    private int $lineno;
    private string $data;
    private int $end;
    private array $values = [];
    private array $overriddenValues = [];
    private array $loadedRawVars = [];
    private array $prodEnvs = ['prod'];
    private bool $usePutenv = false;
    private bool $deferPutenv = false;
    private array $pendingPutenv = [];

    public func

    $this->prodEnvs = $prodEnvs;

        return $this;
    }

    /**
     * @param bool $usePutenv If `putenv()` should be used to define environment variables or not.
     *                        Beware that `putenv()` is not thread safe, that's why it

tion __construct(
        private string $envKey = 'APP_ENV',
        private string $debugKey = 'APP_DEBUG',
    ) {
    }

    /**
     * @return $this
     */
    public function setProdEnvs(array $prodEnvs): static
    {


ony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Dotenv\Exception;

/**
 * Thrown when a file has a syntax error.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
final class FormatException extends \LogicException implements ExceptionInterface
{
    public function __construct(
        string $message,
        private FormatExceptionContext $context,
        int $code = 0,

ent::__construct(\sprintf("%s in \"%s\" at line %d.\n%s", $message, $context->getPath(), $context->getLineno(), $context->getDetails()), $code, $previous);
    }

    public function getContext(): FormatExceptionContext
    {
        return $this->context;

   ?\Throwable $previous = null,
    ) {
        par


hp

/*
 * 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\Dotenv\Exception;

/**
 * @author Fabien Potencier <fabien@symfony.com>
 */
final class FormatExceptionContext
{
    public function __construct(
        private string $data,
        private string $path,
        private int $lineno,
        privat

    {
        $before = str_replace("\n", '\n', substr($this->data, max(0, $this->cursor - 20), min(20, $this->cursor)));
        $after = str_replace("\n", '\n', substr($this->data, $this->cursor, 20));

        return '...'.$before.$after."...\n".str_re

e int $cursor,
    ) {
    }

    public function getPath(): string
    {
        return $this->path;
    }

    public function getLineno(): int
    {
        return $this->lineno;
    }

    public function getDetails(): string


buted with this source code.
 */

namespace Symfony\Component\Dotenv\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

de>
 */
#[AsCommand(name: 'debug:dotenv', description: 'List all dotenv files with variables and values')]
final class DebugCommand extends Command
{
    public function __construct(
        private string $kernelEnvironment,
        private string $projec

use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Dotenv\Dotenv;

/**
 * A console command to debug current dotenv files with variables and values.
 *
 * @author Christopher Hertel <mail@christopher-hertel.


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Dotenv\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Depen

 as a service, e.g in your services.yaml file:
 *
 *     ```yaml
 *     services:
 *         # [...]
 *         Symfony\Component\Dotenv\Command\DotenvDumpCommand: ~
 *     ```
 */
#[Autoconfigure(bind: ['$projectDir' => '%kernel.project_dir%', '$defaultEn

dencyInjection\Attribute\Autoconfigure;
use Symfony\Component\Dotenv\Dotenv;

/**
 * A console command to compile .env files into a PHP-optimized file called .env.local.php.
 *
 * To use this command, first register it explicitly


          ^ line 1 offset 8"],
            ['FOO=\'foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo...\n          ^ line 1 offset 8"],
            ["FOO=\"foo\nBAR=\"bar\"", "Missing quote to end the value in \".env\" at line 1.\n...FOO=\"foo\\nBAR=\"bar\"...\n                     ^ line 1 offset 18"],
            ['FOO=\'foo'."\n", "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo\\n...\n            ^ line 1 offset 9"],
            ['export FOO', "Unable to unset

fset 9"],
            ['FOO= BAR', "Whitespace are not supported before the value in \".env\" at line 1.\n...FOO= BAR...\n      ^ line 1 offset 4"],
            ['Стасян', "Invalid character in variable name in \".env\" at line 1.\n...Стасян...\n  ^ line 1

an environment variable in \".env\" at line 1.\n...export FOO...\n            ^ line 1 offset 10"],
            ['FOO=${FOO', "Unclosed braces on variable expansion in \".env\" at line 1.\n...FOO=\${FOO...\n           ^ line 1 of


lication;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Tester\CommandCompletionTester;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Dotenv\Command\DebugCommand;
use Symfony\Component\Dotenv\Dotenv;

class DebugCommandTest extends TestCase
{
    #[RunInSeparateProcess]
    public function testErrorOnUninitializedDotenv()
    {
        unset($_SERVER['SYMFONY_DOTENV_VARS']);

        $command =

r->getDisplay();

        $this->assertStringContainsString('[ERROR] Dotenv component is not initialized', $output);
    }

    #[RunInSeparateProcess]
    public function testEmptyDotEnvVarsList()
    {
        $_SERVER['SYMFONY_DOTENV_VARS'] = '';

new DebugCommand('dev', __DIR__.'/Fixtures/Scenario1');
        $command->setHelperSet(new HelperSet([new FormatterHelper()]));
        $tester = new CommandTester($command);
        $tester->execute([]);
        $output = $teste


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Dotenv\Tests\Command;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Dotenv\Command\DotenvDumpCommand;

class DotenvDumpCommandTest extends TestCase
{
    protected function setUp(): void
    {
        unset($_SERVER['SYMFONY_DOTENV_PATH']);

<EOF
            APP_LOCAL=yes
            EOF
        );
    }

    protected function tearDown(): void
    {
        @unlink(__DIR__.'/.env');
        @unlink(__DIR__.'/.env.local');
        @unlink(__DIR__.'/.env.path');
        @unlink(__DIR__.'/.env.p

     unset($_SERVER['APP_RUNTIME_OPTIONS']);

        file_put_contents(__DIR__.'/.env', <<<EOF
            APP_ENV=dev
            APP_SECRET=abc123
            EOF
        );

        file_put_contents(__DIR__.'/.env.local', <<


 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\WebLink;

use Psr\Link\EvolvableLinkProviderInterface;
use Psr\Link\LinkInterface;

class GenericLinkProvider implements EvolvableLinkProviderInterface
{
    /**
     * @var LinkInterface[]
     */
    private array $links = [];

    /**
     * @param LinkIn

nks;
    }

    public function getLinks(): array
    {
        return array_values($this->links);
    }

    public function getLinksByRel(string $rel): array
    {
        $links = [];

        foreach ($this->links as $link) {
            if (\in_array(

terface[] $links
     */
    public function __construct(array $links = [])
    {
        $that = $this;

        foreach ($links as $link) {
            $that = $that->withLink($link);
        }

        $this->links = $that->li


ge.
 *
 * (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\WebLink;

use Psr\Link\EvolvableLinkProviderInterface;

/**
 * Parse a list of HTTP Link headers into a list of Link instances.
 *
 * @see https://tools.ietf.org/html/rfc5988
 *
 * @author Jérôme Tamarelle <jerome@tamarelle.net>
 */
class HttpHeaderParser
{
    // Regex to match each link entry:

_PATTERN = '/;\s*([a-zA-Z0-9\-_]+)(?:\s*=\s*(?:"((?:[^"\\\\]|\\\\.)*)"|([^";,\s]+)))?/';

    /**
     * @param string|string[] $headers Value of the "Link" HTTP header
     */
    public function parse(string|array $headers): EvolvableLinkProviderInterfac


 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\WebLink;

use Psr\Link\LinkInterface;

/**
 * Serializes a list of Link instances to an HTTP Link header.
 *
 * @see https://tools.ietf.org/html/rfc5988
 *
 * @author Kévin Dunglas <dunglas@gmail.com>
 */
class HttpHeaderSerializer
{
    /**
     * Builds the value of th

k->isTemplated()) {
                continue;
            }

            $attributesParts = ['', \sprintf('rel="%s"', implode(' ', $link->getRels()))];
            foreach ($link->getAttributes() as $key => $value) {
                if (\is_array($value))

e "Link" HTTP header.
     *
     * @param LinkInterface[]|\Traversable $links
     */
    public function serialize(iterable $links): ?string
    {
        $elements = [];
        foreach ($links as $link) {
            if ($lin


k-relations/link-relations.xhtml
    public const REL_ABOUT = 'about';
    public const REL_ACL = 'acl';
    public const REL_ALTERNATE = 'alternate';
    public const REL_AMPHTML = 'amphtml';
    public const REL_APPENDIX = 'appendix';
    public const REL_APPLE_TOUCH_ICON = 'apple-touch-icon';
    public const REL_APPLE_TOUCH_STARTUP_IMAGE = 'apple-touch-startup-image';
    public const REL_ARCHIVES = 'archives';
    public const REL_AUTHOR = 'author';
    public const REL_BLOCKED_BY = 'blocked-by';
    p

onst REL_CONTENTS = 'contents';
    public const REL_CONVERTEDFROM = 'convertedfrom';
    public const REL_COPYRIGHT = 'copyright';
    public const REL_CREATE_FORM = 'create-form';
    public const REL_CURRENT = 'current';
    public const REL_DESCRIBEDBY

ublic const REL_BOOKMARK = 'bookmark';
    public const REL_CANONICAL = 'canonical';
    public const REL_CHAPTER = 'chapter';
    public const REL_CITE_AS = 'cite-as';
    public const REL_COLLECTION = 'collection';
    public c


 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\WebLink\EventListener;

use Psr\Link\LinkProviderInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\WebLink\HttpHeaderSerial

dLinkHeaderListener implements EventSubscriberInterface
{
    public function __construct(
        private readonly HttpHeaderSerializer $serializer = new HttpHeaderSerializer(),
    ) {
    }

    public function onKernelResponse(ResponseEvent $event): vo

izer;

// Help opcache.preload discover always-needed symbols
class_exists(HttpHeaderSerializer::class);

/**
 * Adds the Link HTTP header to the response.
 *
 * @author Kévin Dunglas <dunglas@gmail.com>
 *
 * @final
 */
class Ad


riableCount;
    private ?\SplObjectStorage $inlinedDefinitions = null;
    private ?array $serviceCalls = null;
    private array $reservedVariables = ['instance', 'class', 'this', 'container'];
    private ExpressionLanguage $expressionLanguage;
    private ?string $targetDirRegex = null;
    private int $targetDirMaxMatches;
    private string $docStar;
    private array $serviceIdToMethodNameMap;
    private array $usedMethodNames;
    private string $namespace;
    private bool $asFiles;
    private st

UsePrivateIds = [];
    private array $preload = [];
    private bool $addGetService = false;
    private array $locatedIds = [];
    private string $serviceLocatorTag;
    private array $exportedVariables = [];
    private array $dynamicParameters = [];

ring $hotPathTag;
    private array $preloadTags;
    private bool $inlineFactories;
    private bool $inlineRequires;
    private array $inlinedRequires = [];
    private array $circularReferences = [];
    private array $single


nt;
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
use Symfony\Component\DependencyInjection\Argument\EnvClosureArgument;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony

ter;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\Yaml\Dumper as YmlDumper;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Tag\TaggedValue;
use Symfony\Compon

\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Parame


ment\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ExpressionLanguage\Expression;

/**
 * XmlDumper dumps a service container as an XML string.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 * @author Martin Hasoň

xml version="1.0" encoding="utf-8"?>
            <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/servi

<martin.hason@gmail.com>
 */
class XmlDumper extends Dumper
{
    /**
     * Dumps the service container as an XML string.
     */
    public function dump(array $options = []): string
    {
        $xml = <<<EOXML
            <?


ackage.
 *
 * (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\Uid;

if (interface_exists(\Ds\Key::class)) {
    /**
     * @internal
     */
    interface HashableInterface extends \Ds\Key
    {
        public function equals(mixed $other): bool;

        public function hash(): string;
    }
} elseif (interface_exists(\Ds\Hashable::class)) {
    /**

ce extends \Ds\Hashable
    {
        public function hash(): string;
    }
} else {
    /**
     * @internal
     */
    interface HashableInterface
    {
        public function equals(mixed $other): bool;

        public function hash(): string;
    }
}


buted with this source code.
 */

namespace Symfony\Component\Uid;

use Symfony\Component\Uid\Exception\InvalidArgumentException;

/**
 * @author Grégoire Pineau <lyrixx@lyrixx.info>
 *
 * @see https://datatracker.ietf.org/doc/html/rfc9562/#section-6.6 for details about namespaces
 */
class Uuid extends AbstractUid
{
    public const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
    public const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
    public const NAMESPACE_OID = '6ba7b812-9dad

ic const FORMAT_RFC_4122 = 1 << 3;
    public const FORMAT_RFC_9562 = self::FORMAT_RFC_4122;
    public const FORMAT_ALL = -1;

    protected const TYPE = 0;
    protected const NIL = '00000000-0000-0000-0000-000000000000';
    protected const MAX = 'fffff

-11d1-80b4-00c04fd430c8';
    public const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';

    public const FORMAT_BINARY = 1;
    public const FORMAT_BASE_32 = 1 << 1;
    public const FORMAT_BASE_58 = 1 << 2;
    publ


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Uid;

use Symfony\Component\Uid\Exception\InvalidArgumentException;
use Symfony\Component\Uid\Exception\LogicException;

/**
 * Converts between UUIDv7 and UUIDv4 using SipHash-2-4 timestamp masking.
 *
 * This allows storing time-ordered UUIDv7 in databases while emitting
 * UUIDv4-looking identifiers at API boundaries, hiding timing information

del: this is timestamp obfuscation, not authenticated encryption.
 * The transformation carries no integrity tag, so any well-formed v4 will
 * decode to some v7; callers must not treat decoded values as authentic and
 * should validate them against applic

.
 *
 * The 48-bit timestamp of a UUIDv7 is XOR-masked with a keyed SipHash-2-4
 * digest derived from the UUID's own random bits, producing a valid UUIDv4.
 * The transformation is reversible with the same key.
 *
 * Security mo


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Uid;

use Symfony\Component\Uid\Exception\InvalidArgumentException;

/**
 * A v6 UUID is lexicographically sortable and contains a 60-bit timestamp and 62 extra unique bits.
 *
 * Unlike UUIDv1, this implementation of UUIDv6 doesn't leak the MAC address of the host.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class UuidV6 extends Uuid implem

        } else {
            parent::__construct($uuid, true);
        }
    }

    public function getDateTime(): \DateTimeImmutable
    {
        return BinaryUtil::hexToDateTime('0'.substr($this->uid, 0, 8).substr($this->uid, 9, 4).substr($this->uid, 15

ents TimeBasedUidInterface
{
    protected const TYPE = 6;

    private static string $node;

    public function __construct(?string $uuid = null)
    {
        if (null === $uuid) {
            $this->uid = static::generate();


buted with this source code.
 */

namespace Symfony\Component\Uid;

use Symfony\Component\Uid\Exception\InvalidArgumentException;

/**
 * A v7 UUID is lexicographically sortable and contains a 58-bit timestamp and 64 extra unique bits.
 *
 * Within the same millisecond, the unique bits are incremented by a 24-bit random number.
 * This method provides microsecond precision for the timestamp, and minimizes both the
 * risk of collisions and the consumption of the OS' entropy pool.
 *
 * @author Nicolas Greka

rivate static string $seed;
    private static array $seedParts;
    private static int $seedIndex = 0;

    public function __construct(?string $uuid = null)
    {
        if (null === $uuid) {
            $this->uid = static::generate();
        } else {

s <p@tchwork.com>
 */
class UuidV7 extends Uuid implements TimeBasedUidInterface
{
    protected const TYPE = 7;

    private static string $time = '';
    private static int $subMs = 0;
    private static array $rand = [];
    p


n 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\DependencyInjection\Tests\LazyProxy\PhpDumper;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper;

/**
 * Tests for {@see NullDumper}.
 *
 * @author Marco Pivetta <ocramius@gmail.com>
 */
class NullDumperTe

mper()
    {
        $dumper = new NullDumper();
        $definition = new Definition('stdClass');

        $this->assertFalse($dumper->isProxyCandidate($definition));
        $this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo', '(false)'

st extends TestCase
{
    public function testNullDu


<?php

/*
 * 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\DependencyInjection\Tests\LazyProxy\Instantiator;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\LazyProxy\Inst

y()
    {
        $instantiator = new RealServiceInstantiator();
        $instance = new \stdClass();
        $callback = static fn () => $instance;

        $this->assertSame($instance, $instantiator->instantiateProxy(new Container(), new Definition(), 'f

antiator\RealServiceInstantiator;

/**
 * Tests for {@see RealServiceInstantiator}.
 *
 * @author Marco Pivetta <ocramius@gmail.com>
 */
class RealServiceInstantiatorTest extends TestCase
{
    public function testInstantiateProx


nent\DependencyInjection\Tests\Compiler\Listener2;
use Symfony\Component\DependencyInjection\Tests\Compiler\ListenerResolver;
use Symfony\Component\DependencyInjection\Tests\Compiler\MyCallable;
use Symfony\Component\DependencyInjection\Tests\Compiler\MyFactory;
use Symfony\Component\DependencyInjection\Tests\Compiler\MyInlineService;
use Symfony\Component\DependencyInjection\Tests\Compiler\SingleMethodInterface;
use Symfony\Component\DependencyInjection\Tests\Compiler\Wither;
use Symfony\Component\Dependen

cyInjection\Tests\Fixtures\Bar;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition;
use Symfony\Component\DependencyInjection\Tests\Fixtures\DependencyContainer;
use Symfony\Component\DependencyInjection\Te


\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
use Symfony\Component\DependencyInjection\Argument\EnvClosureArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Compon

ent\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Dumper\XmlDumper;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\


ony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Config;

use Symfony\Component\Config\Resource\ResourceInterface;

/**
 * Tracks container parameters.
 *
 * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
 *
 * @final
 */
class ContainerParametersResource implements ResourceInterface
{
    /**
     * @param array $parameters The container parameters to t

  private array $parameters,
    ) {
    }

    public function __toString(): string
    {
        return 'container_parameters_'.hash('xxh128', serialize($this->parameters));
    }

    public function getParameters(): array
    {
        return $this->pa

rack
     */
    public function __construct(


buted with this source code.
 */

namespace Symfony\Component\DependencyInjection\LazyProxy\PhpDumper;

use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\VarExporter\Exception\LogicException;
use Symfony\Component\VarExporter\ProxyHelper;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 */
final class LazyServiceDumper implements DumperInterface
{
    public function __construct(
        private string $sa

       if (!$definition->isLazy()) {
                throw new InvalidArgumentException(\sprintf('Invalid definition for service "%s": setting the "proxy" tag on a service requires it to be "lazy".', $id ?? $definition->getClass()));
            }

lt = '',
    ) {
    }

    public function isProxyCandidate(Definition $definition, ?bool &$asGhostObject = null, ?string $id = null): bool
    {
        $asGhostObject = false;

        if ($definition->hasTag('proxy')) {


 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\DependencyInjection\LazyProxy\Instantiator;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;

/**
 * Lazy proxy instantiator, capable of instantiating a proxy given a container, the
 * service definition

-callable $realInstantiator
     *
     * @param string                                        $id               Identifier of the requested service
     * @param (callable(): object)|(callable(object): void) $realInstantiator A callback that creates or in

s and a callback that produces the real service instance.
 *
 * @author Marco Pivetta <ocramius@gmail.com>
 */
interface InstantiatorInterface
{
    /**
     * Instantiates a proxy object.
     *
     * @param-immediately-invoked


 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\DependencyInjection\LazyProxy\Instantiator;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\Dependency

stantiator
     */
    public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator): object
    {
        $dumper = new LazyServiceDumper();

        if (!$dumper->isProxyCandidate($definit

Injection\LazyProxy\PhpDumper\LazyServiceDumper;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 */
final class LazyServiceInstantiator implements InstantiatorInterface
{
    /**
     * @param-immediately-invoked-callable $realIn


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Dumper;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 */
final class Preloader
{
    public static function append(string $file, array $list): void
    {
        if (!file_exists($file)) {
            throw new \LogicException(\sprintf('File "%s" does not exist.', $file));
        }

        $cacheDir = \dirname($file);

acheDir)), \DIRECTORY_SEPARATOR, '/'), true)), \FILE_APPEND);
                continue;
            }

            $classes[] = \sprintf("\$classes[] = %s;\n", var_export($item, true));
        }

        file_put_contents($file, \sprintf("\n\$classes = []

    $classes = [];

        foreach ($list as $item) {
            if (str_starts_with($item, $cacheDir)) {
                file_put_contents($file, \sprintf("require_once __DIR__.%s;\n", var_export(strtr(substr($item, \strlen($c


buted with this source code.
 */

namespace Symfony\Component\Uid;

use Symfony\Component\Uid\Exception\InvalidArgumentException;

/**
 * @internal
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class BinaryUtil
{
    public const BASE10 = [
        '' => '0123456789',
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
    ];

    public const BASE58 = [
        '' => '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
        1 => 0, 1, 2, 3, 4, 5, 6, 7, 8, 'A' => 9,
        'B' => 10, 'C' => 11, 'D' => 12,


p and 80-bit of crypto-random entropy.
 *
 * @see https://github.com/ulid/spec
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class Ulid extends AbstractUid implements TimeBasedUidInterface
{
    public const FORMAT_BINARY = 1;
    public const FORMAT_BASE_32 = 1 << 1;
    public const FORMAT_BASE_58 = 1 << 2;
    public const FORMAT_RFC_4122 = 1 << 3;
    public const FORMAT_RFC_9562 = self::FORMAT_RFC_4122;
    public const FORMAT_ALL = -1;

    protected const NIL = '00000000000000000000000000';
    pr

$this->uid = static::generate();
        } elseif (self::NIL === $ulid) {
            $this->uid = self::NIL;
        } else {
            $this->uid = strtoupper($ulid);

            if (self::MAX === $this->uid) {
                $this->uid = self::MAX;

otected const MAX = '7ZZZZZZZZZZZZZZZZZZZZZZZZZ';

    private static string $time = '';
    private static array $rand = [];

    public function __construct(?string $ulid = null)
    {
        if (null === $ulid) {


 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\Uid;

/**
 * A v4 UUID contains a 122-bit random number.
 *
 * @author Grégoire Pineau <lyrixx@lyrixx.info>
 */
class UuidV4 extends Uuid
{
    protected const TYPE = 4;

    public function __construct(?string $uuid = null)
    {
        if (null === $uuid)

/ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
            $uuid[8] = $uuid[13] = $uuid[18] = $uuid[23] = '-';
            // Set the UUID version to 4
            // xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx
            $uuid[14] = '4';
            // Set the UUID var

 {
            // Generate 36 random hex characters (144 bits)
            // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            $uuid = bin2hex(random_bytes(18));
            // Insert dashes to match the UUID format
            /


 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\DependencyInjection\Tests\LazyProxy\Instantiator;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\Laz

iator = new LazyServiceInstantiator();
        $instance = new class extends AbstractSayClass {
            public int $calls = 0;

            public function say(): string
            {
                ++$this->calls;

                return 'Hello from

yServiceInstantiator;
use Symfony\Component\DependencyInjection\Tests\Fixtures\AbstractSayClass;

class LazyServiceInstantiatorTest extends TestCase
{
    public function testInstantiateAbstractClassProxy()
    {
        $instant


ge.
 *
 * (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\DependencyInjection\Tests\Dumper;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Dumper\Preloader;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\A;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\B;
use Symfony\Component\DependencyIn

s\Preload\DummyWithInterface;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\E;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\F;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\G;
use Symfony\Component\

jection\Tests\Fixtures\Preload\C;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\D;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Preload\Dummy;
use Symfony\Component\DependencyInjection\Tests\Fixture


 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\DependencyInjection\LazyProxy\PhpDumper;

use Symfony\Component\DependencyInjection\Definition;

/**
 * Lazy proxy dumper capable of generating the instantiation logic PHP code for proxied services.
 *
 * @author Marco Pivetta <ocramius@gmail.com>
 */
interf

is a ghost object
     */
    public function isProxyCandidate(Definition $definition, ?bool &$asGhostObject = null, ?string $id = null): bool;

    /**
     * Generates the code to be used to instantiate a proxy in the dumped factory code.
     */
    pub

ace DumperInterface
{
    /**
     * Inspects whether the given definitions should produce proxy instantiation logic in the dumped container.
     *
     * @param bool|null &$asGhostObject Set to true after the call if the proxy


ntainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Reference;

/**
 * GraphvizDumper dumps a service container as a graphviz file.
 *
 * You can convert the generated dot file with the dot utility (http://www.graphviz.org/):
 *
 *   dot -Tpng contai

[
        'graph' => ['ratio' => 'compress'],
        'node' => ['fontsize' => '11', 'fontname' => 'Arial', 'shape' => 'record'],
        'edge' => ['fontsize' => '9', 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => '0.5'],

ner.dot > foo.png
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class GraphvizDumper extends Dumper
{
    private array $nodes;
    private array $edges;
    // All values should be strings
    private array $options =


buted with this source code.
 */

namespace Symfony\Component\Uid;

use Symfony\Component\Uid\Exception\InvalidArgumentException;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 */
abstract class AbstractUid implements \JsonSerializable, \Stringable, HashableInterface
{
    /**
     * The identifier in its canonic representation.
     */
    protected string $uid;

    /**
     * Whether the passed value is valid for the constructor of the current class.
     */
    abstract public static function isValid(s

ic static function fromString(string $uid): static;

    /**
     * @throws InvalidArgumentException When the passed value is not valid
     */
    public static function fromBinary(string $uid): static
    {
        if (16 !== \strlen($uid)) {

tring $uid): bool;

    /**
     * Creates an AbstractUid from an identifier represented in any of the supported formats.
     *
     * @throws InvalidArgumentException When the passed value is not valid
     */
    abstract publ


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests\LazyProxy\PhpDumper;

use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\LazyServiceDumper;
use Symfony\Compo

    $dumper = new LazyServiceDumper();
        $definition = (new Definition(ContainerInterface::class))->setLazy(true);

        $this->assertTrue($dumper->isProxyCandidate($definition));
        $this->assertStringContainsString('function get(', $dumper-

nent\DependencyInjection\Tests\Fixtures\AbstractSayClass;
use Symfony\Component\DependencyInjection\Tests\Fixtures\ReadOnlyClass;

class LazyServiceDumperTest extends TestCase
{
    public function testProxyInterface()
    {


\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
use Symfony\Component\DependencyInjection\Argument\EnvClosureArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection

ncyInjection\Dumper\YamlDumper;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooClassWithDefaultArrayAttribute;
use Symfony\Co

\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\Depende


n 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\DependencyInjection\LazyProxy\PhpDumper;

use Symfony\Component\DependencyInjection\Definition;

/**
 * Null dumper, negates any proxy code generation for any given service definition.
 *
 * @author Marco Pivetta <ocramius@gmail.com>
 *
 * @final
 */
class NullDumper implements DumperInterface
{
    public function

GhostObject = null, ?string $id = null): bool
    {
        return $asGhostObject = false;
    }

    public function getProxyFactoryCode(Definition $definition, string $id, string $factoryCode): string
    {
        return '';
    }

    public function g

isProxyCandidate(Definition $definition, ?bool &$as


ge.
 *
 * (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\Uid;

/**
 * A v1 UUID contains a 60-bit timestamp and 62 extra unique bits.
 *
 * @author Grégoire Pineau <lyrixx@lyrixx.info>
 */
class UuidV1 extends Uuid implements TimeBasedUidInterface
{
    protected const TYPE = 1;

    private static string $clockSeq;

    public function __construct(?st

e(): \DateTimeImmutable
    {
        return BinaryUtil::hexToDateTime('0'.substr($this->uid, 15, 3).substr($this->uid, 9, 4).substr($this->uid, 0, 8));
    }

    public function getNode(): string
    {
        return substr($this->uid, -12);
    }

    p

ring $uuid = null)
    {
        if (null === $uuid) {
            $this->uid = strtolower(uuid_create(static::TYPE));
        } else {
            parent::__construct($uuid, true);
        }
    }

    public function getDateTim


/*
 * 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\DependencyInjection\Config;

use Symfony\Component\Config\Resource\ResourceInterface;
use Symfony\Component\Config\ResourceCheckerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * @author Maxime Steinhausser <maxime.stein

ourceInterface $metadata): bool
    {
        return $metadata instanceof ContainerParametersResource;
    }

    public function isFresh(ResourceInterface $resource, int $timestamp): bool
    {
        foreach ($resource->getParameters() as $key => $value

hausser@gmail.com>
 */
class ContainerParametersResourceChecker implements ResourceCheckerInterface
{
    public function __construct(
        private ContainerInterface $container,
    ) {
    }

    public function supports(Res


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\DependencyInjection\Tests\Dumper;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper;
use Symfony\Component\DependencyInjection\Reference;

class GraphvizDumperTest extends TestCase
{

raphvizDumper($container = new ContainerBuilder());

        $this->assertStringEqualsGeneratedFile('services1.dot', $dumper->dump(), '->dump() dumps an empty container as an empty dot file');

        $container = include self::$fixturesPath.'/containers/

protected static string $fixturesPath;

    public static function setUpBeforeClass(): void
    {
        self::$fixturesPath = realpath(__DIR__.'/../Fixtures');
    }

    public function testDump()
    {
        $dumper = new G


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\WebLink\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\WebLink\HttpHeaderParser;

class HttpHeaderParserTest extends TestCase
{
    public function testParse()
    {
        $parser = new HttpHeaderParser();

        $header = [
            '</1>; rel="prerender",</2>; rel="dns-prefetc

;
        $links = $provider->getLinks();

        self::assertCount(5, $links);

        self::assertSame(['prerender'], $links[0]->getRels());
        self::assertSame('/1', $links[0]->getHref());
        self::assertSame([], $links[0]->getAttributes());

h"; pr="0.7",</3>; rel="preload"; as="script"',
            '</4>; rel="preload"; as="image"; nopush,</5>; rel="alternate next"; hreflang="fr"; hreflang="de"; title="Hello"',
        ];
        $provider = $parser->parse($header)


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DnsMock;

class DnsMockTest extends TestCase
{
    protected function tearDown(): void
    {
        DnsMock::withMockedHosts([]);
    }

    public function testCheckdnsrr()
    {
        DnsMock::withMockedHosts(['example.com' => [['type' => 'MX']]]);
        $this->assertT

ple.com', 'a'));
        $this->assertTrue(DnsMock::checkdnsrr('example.com', 'any'));
        $this->assertFalse(DnsMock::checkdnsrr('foobar.com', 'ANY'));
    }

    public function testGetmxrr()
    {
        DnsMock::withMockedHosts([
            'exam

rue(DnsMock::checkdnsrr('example.com'));

        DnsMock::withMockedHosts(['example.com' => [['type' => 'A']]]);
        $this->assertFalse(DnsMock::checkdnsrr('example.com'));
        $this->assertTrue(DnsMock::checkdnsrr('exam


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClassExistsMock;
use Symfony\Bridge\PhpUnit\Tests\Fixtures\ExistingEnum;
use Symfony\Bridge\PhpUnit\Tests\Fixtures\ExistingEnumReal;

class EnumExistsMockTest extends TestCase
{
    public static function setUpBeforeClass(): void
    {
        // Require the fixture file to a

withMockedEnums([
            ExistingEnum::class => false,
            'NonExistingEnum' => true,
        ]);
    }

    public static function tearDownAfterClass(): void
    {
        ClassExistsMock::withMockedEnums([]);
    }

    public function testC

llow PHP to be fully aware of the enum existence
        require __DIR__.'/Fixtures/ExistingEnumReal.php';

        ClassExistsMock::register(__CLASS__);
    }

    protected function setUp(): void
    {
        ClassExistsMock::


ge.
 *
 * (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\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

#[RequiresPhpunit('<10.0.0')]
final class ExpectDepreca

      $this->expectDeprecation('foo');
        @trigger_error('foo', \E_USER_DEPRECATED);
    }

    /**
     * Do not remove this test in the next major version.
     *
     * @group legacy
     *
     * @runInSeparateProcess
     */
    #[Group('legacy')

tionTraitTest extends TestCase
{
    use ExpectDeprecationTrait;

    /**
     * Do not remove this test in the next major version.
     *
     * @group legacy
     */
    #[Group('legacy')]
    public function testOne()
    {


hp

/*
 * 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\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCase;

#[RequiresPhpunit('<10.0.0')]
final class ExpectedDeprecationAnnotationTest extends TestCase
{
    /**
     * Do

ED);
    }

    /**
     * Do not remove this test in the next major versions.
     *
     * @group legacy
     *
     * @expectedDeprecation foo
     * @expectedDeprecation bar
     */
    #[Group('legacy')]
    public function testMany()
    {
        @t

not remove this test in the next major versions.
     *
     * @group legacy
     *
     * @expectedDeprecation foo
     */
    #[Group('legacy')]
    public function testOne()
    {
        @trigger_error('foo', \E_USER_DEPRECAT


ackage.
 *
 * (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\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;

/**
 * This test is meant to be skipped.
 *
 * @requires extension ext-dummy
 */
#[RequiresPhpExtension('ext-dummy')]
final class OnlyExpectingDeprecati

ot remove this test in the next major versions.
     *
     * @group legacy
     *
     * @expectedDeprecation unreachable
     */
    #[Group('legacy')]
    public function testExpectingOnlyDeprecations()
    {
        $this->fail('should never be ran.');

onSkippedTest extends TestCase
{
    /**
     * Do n


/*
 * 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\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\TestCase;

/**
 * Don't remove this test case, it tests the legacy group.
 *
 * @group legacy

        @trigger_error('Test abc', \E_USER_DEPRECATED);
        $this->addToAssertionCount(1);
    }

    public function testCallingOtherErrorHandler()
    {
        $this->expectException(Exception::class);
        $this->expectExceptionMessage('Test tha

 *
 * @runTestsInSeparateProcesses
 */
#[RequiresPhpunit('<10.0.0')]
#[Group('legacy')]
class ProcessIsolationTest extends TestCase
{
    /**
     * @expectedDeprecation Test abc
     */
    public function testIsolation()
    {


buted with this source code.
 */

namespace Symfony\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\Attribute\DnsSensitive;
use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive;
use Symfony\Bridge\PhpUnit\Tests\Fixtures\symfonyextension\src\ClassExtendingFinalClass;
use Symfony\Bridge\PhpUnit\Tests\Fixtures\symfonyextension\src\FinalClass;

#[DnsSensitive('App\Foo\A')]
#[TimeSensitive('App\

ce as of its next major version. You should not extend it from "%s".', FinalClass::class, ClassExtendingFinalClass::class));

        new ClassExtendingFinalClass();
    }

    #[DataProvider('mockedNamespaces')]
    #[Group('time-sensitive')]
    #[TimeSe

Foo\A')]
class SymfonyExtension extends TestCase
{
    public function testExtensionOfFinalClass()
    {
        $this->expectUserDeprecationMessage(\sprintf('The "%s" class is considered final. It may change without further noti


 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\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClockMock;
use Symfony\Bridge\PhpUnit\DnsMock;

class SymfonyExtensionWithManualRegister extends TestCase
{
    public static function setUpBeforeClass(): void
    {
        ClockMock::register(self:

3.4'],
            ],
        ]);
    }

    public static function tearDownAfterClass(): void
    {
        ClockMock::withClockMock(false);
        DnsMock::withMockedHosts([]);
    }

    public function testDate()
    {
        self::assertSame('2024-0

:class);
        ClockMock::withClockMock(strtotime('2024-05-20 15:30:00'));

        DnsMock::register(self::class);
        DnsMock::withMockedHosts([
            'example.com' => [
                ['type' => 'A', 'ip' => '1.2.


 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.
 */

use Symfony\Bridge\PhpUnit\Tests\Fixtures\symfonyextension\src\ClassExtendingFinalClass;
use Symfony\Bridge\PhpUnit\Tests\Fixtures\symfonyextension\src\FinalClass;

spl_autoload_register(function ($class) {
    if (FinalClass::class === $class) {
        require __DIR__.'/../src/FinalC

Attribute/DnsSensitive.php';
require __DIR__.'/../../../../Attribute/TimeSensitive.php';
require __DIR__.'/../../../../Extension/EnableClockMockSubscriber.php';
require __DIR__.'/../../../../Extension/RegisterClockMockSubscriber.php';
require __DIR__.'/../

lass.php';
    } elseif (ClassExtendingFinalClass::class === $class) {
        require __DIR__.'/../src/ClassExtendingFinalClass.php';
    }
});

require __DIR__.'/../../../../SymfonyExtension.php';
require __DIR__.'/../../../../


ishValue()
    {
        $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage('hi');
        Configuration::fromUrlEncodedString('hi');
    }

    public function testItThrowsOnUnknownConfigurationOption()
    {
        $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage('min');
        Configuration::fromUrlEncodedString('min[total]=42');
    }

    public function testItThrowsOnUnknownThreshold()
    {
        $this->ex

    $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage('forty-two');
        Configuration::fromUrlEncodedString('max[total]=forty-two');
    }

    public function testItNoticesExceededTotalThreshold()
    {

pectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage('deep');
        Configuration::fromUrlEncodedString('max[deep]=42');
    }

    public function testItThrowsOnStringishThreshold()
    {


 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\Bridge\PhpUnit\Tests\DeprecationErrorHandler;

use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup;

#[RequiresPhpunit('<10.0.0')]
final class DeprecationGroupTest extend

ller',
            'get5klocMethod'
        );
        $group->addNoticeFromProceduralCode('Calling sfContext::getInstance() is deprecated');
        $this->assertCount(1, $group->notices());
        $this->assertSame(2, $group->count());
    }

    public

s TestCase
{
    public function testItGroupsByMessage()
    {
        $group = new DeprecationGroup();
        $group->addNoticeFromObject(
            'Calling sfContext::getInstance() is deprecated',
            'MonsterContro


 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\Bridge\PhpUnit\Tests\DeprecationErrorHandler;

use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationNotice;

#[RequiresPhpunit('<10.0.0')]
final class DeprecationNoticeTest extends TestCase

tice->addObjectOccurrence('MyOtherAction', '__invoke');

        $countsByCaller = $notice->getCountsByCaller();

        $this->assertCount(2, $countsByCaller);
        $this->assertArrayHasKey('MyAction::__invoke', $countsByCaller);
        $this->assert

{
    public function testItGroupsByCaller()
    {
        $notice = new DeprecationNotice();
        $notice->addObjectOccurrence('MyAction', '__invoke');
        $notice->addObjectOccurrence('MyAction', '__invoke');
        $no


it\Framework\TestCase;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV7;

#[RequiresPhpunit('<10.0.0')]
class DeprecationTest extends TestCase
{
    private static $vendorDir;
    private static $prefixDirsPsr4;

    private static function getVendorDir()
    {
        if (null !== self::$vendorDir) {
            return self::$vendorDir;
        }

        foreach (get_declared_clas

        if (file_exists($vendorDir.'/composer/installed.json') && @mkdir($vendorDir.'/myfakevendor/myfakepackage1', 0o777, true)) {
                    break;
                }
            }
        }

        self::$vendorDir = $vendorDir;
        @mkdir(

ses() as $class) {
            if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
                $r = new \ReflectionClass($class);
                $vendorDir = \dirname($r->getFileName(), 2);


/*
 * 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.
 */

class ComposerLoaderFakeFallbackPsr0
{
    public function getPrefixes()
    {
        return [];
    }

    public function getPrefixesPsr4()
    {
        return [];
    }

    public function getFallbackDirs()
    {
        return [__DIR__.'/../../fake_app_fallback/'];
    }

'.php';
            if (file_exists($file)) {
                require $file;

                return;
            }
        }
    }
}

class ComposerAutoloaderInitFakeFallbackPsr0
{
    private static $loader;

    public static function getLoader()
    {

    public function getFallbackDirsPsr4()
    {
        return [];
    }

    public function loadClass($className)
    {
        foreach ($this->getFallbackDirs() as $dir) {
            $file = $dir.strtr($className, '\\', '/').


 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.
 */

class ComposerLoaderFakeBis
{
    public function getPrefixes()
    {
        return [];
    }

    public function getPrefixesPsr4()
    {
        return [
            'foo\\lib\\' => [__DIR__.'/../foo/lib/'],
        ];
    }

    public function getFallbackDirs()
    {
        retur

ts_with($className, $prefix)) {
                continue;
            }

            foreach ($baseDirs as $baseDir) {
                $file = str_replace([$prefix, '\\'], [$baseDir, '/'], $className.'.php');
                if (file_exists($file)) {

n [];
    }

    public function getFallbackDirsPsr4()
    {
        return [];
    }

    public function loadClass($className)
    {
        foreach ($this->getPrefixesPsr4() as $prefix => $baseDirs) {
            if (!str_star


 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 App\Services;

use acme\lib\SomeService;
use foo\lib\SomeOtherService;

final class AppService
{
    public function directDeprecationsTwoVendors()
    {
        $service1 = new SomeService();
        $service1->deprecatedApi();

        $service2 = new SomeOtherService();
        $servic

%s is deprecated, use %s_new instead.', ...$args));
        } else {
            @trigger_error(\sprintf('Since App 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED);
        }
    }

    public function directDeprecation(bool $us

e2->deprecatedApi();
    }

    public function selfDeprecation(bool $useContracts = false)
    {
        $args = [__FUNCTION__, __FUNCTION__];
        if ($useContracts) {
            trigger_deprecation('App', '3.0', \sprintf('


 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.
 */

class ComposerLoaderFake
{
    public function getPrefixes()
    {
        return [];
    }

    public function getPrefixesPsr4()
    {
        return [
            'App\\Services\\' => [__DIR__.'/../../fake_app/'],
            'acme\\lib\\' => [__DIR__.'/../acme/lib/'],
            'bar\\lib\\' =

urn [];
    }

    public function loadClass($className)
    {
        if ($file = $this->findFile($className)) {
            require $file;
        }
    }

    public function findFile($class)
    {
        foreach ($this->getPrefixesPsr4() as $prefix =>

> [__DIR__.'/../bar/lib/'],
            'fcy\\lib\\' => [__DIR__.'/../fcy/lib/'],
        ];
    }

    public function getFallbackDirs()
    {
        return [];
    }

    public function getFallbackDirsPsr4()
    {
        ret


ackage.
 *
 * (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 acme\lib;

use bar\lib\AnotherService;

class SomeService
{
    public function deprecatedApi(bool $useContracts = false)
    {
        $args = [__FUNCTION__, __FUNCTION__];
        if ($useContracts) {
            trigger_deprecation('acme/lib', '3.0', \sprintf('%s is deprecated, use %s_new instead.', ...$arg

rintf('Since acme/lib 3.0: %s is deprecated, use %s_new instead.', ...$args), \E_USER_DEPRECATED);
        }
    }

    public function indirectDeprecatedApi(bool $useContracts = false)
    {
        (new AnotherService())->deprecatedApi($useContracts);

s));
        } else {
            @trigger_error(\sp


/*
 * 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.
 */

eval(<<<'EOPHP'
    namespace PHPUnit\Util;

    class Test
    {
        public static function getGroups()
        {
            return array();
        }
    }
    EOPHP
);

@trigger_error('root deprecation', \E_USER_DEPRECATED);

class FooTestCase
{
    public function testLe

D);
        trigger_error('unsilenced foo deprecation', \E_USER_DEPRECATED);
    }

    public function testNonLegacyBar()
    {
        @trigger_error('silenced bar deprecation', \E_USER_DEPRECATED);
        trigger_error('unsilenced bar deprecation', \E_

gacyFoo()
    {
        @trigger_error('silenced foo deprecation', \E_USER_DEPRECATED);
        trigger_error('unsilenced foo deprecation', \E_USER_DEPRECATED);
        @trigger_error('silenced foo deprecation', \E_USER_DEPRECATE


/*
 * 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.
 */

class ComposerLoaderFakeFallbackPsr4
{
    public function getPrefixes()
    {
        return [];
    }

    public function getPrefixesPsr4()
    {
        return [];
    }

    public function getFallbackDirs()
    {
        return [];
    }

    public function getFallbackDirs

/').'.php';
            if (file_exists($file)) {
                require $file;

                return;
            }
        }
    }
}

class ComposerAutoloaderInitFakeFallbackPsr4
{
    private static $loader;

    public static function getLoader()

Psr4()
    {
        return [__DIR__.'/../../fake_app_fallback/'];
    }

    public function loadClass($className)
    {
        foreach ($this->getFallbackDirsPsr4() as $dir) {
            $file = $dir.strtr($className, '\\', '


 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\Bridge\PhpUnit\Tests\FailTests;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

/**
 *

.0.0')]
final class ExpectDeprecationTraitTestFail extends TestCase
{
    use ExpectDeprecationTrait;

    /**
     * Do not remove this test in the next major version.
     *
     * @group legacy
     */
    #[Group('legacy')]
    public function testOne(

 Class ExpectDeprecationTraitTestFail.
 *
 * This class is deliberately suffixed with *TestFail.php so that it is ignored
 * by PHPUnit. This test is designed to fail. See ../expectdeprecationfail.phpt.
 */
#[RequiresPhpunit('<10


ackage.
 *
 * (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\Bridge\PhpUnit\Tests\FailTests;

use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

/**
 * This class is deliberately suffixed with *TestRisky.php so that it is ignored
 * by PHPUnit. This test is designed to fail. See .

0')]
final class NoAssertionsTestNotRisky extends TestCase
{
    use ExpectDeprecationTrait;

    /**
     * Do not remove this test in the next major version.
     */
    public function testOne()
    {
        $this->expectNotToPerformAssertions();
    }

./expectnotrisky.phpt.
 */
#[RequiresPhpunit('<10.0.


/*
 * 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\Bridge\PhpUnit\Tests\FailTests;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpunit;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

/**
 * This class is deliberately suffixed with *TestRi

     * Do not remove this test in the next major version.
     *
     * @group legacy
     */
    #[Group('legacy')]
    public function testOne()
    {
        $this->expectNotToPerformAssertions();
        $this->expectDeprecation('foo');
        @trigge

sky.php so that it is ignored
 * by PHPUnit. This test is designed to fail. See ../expectrisky.phpt.
 */
#[RequiresPhpunit('<10.0.0')]
final class NoAssertionsTestRisky extends TestCase
{
    use ExpectDeprecationTrait;

    /**


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\PhpUnit\Tests\Metadata;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\Attribute\DnsSensitive;
use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive;
use Symfony\Bridge\PhpUnit\Metadata\AttributeReader;
use Symfony\Bridge\PhpUnit\Tests\Metadata\Fixtures\FooBar;

class AttributeReaderTest exten

= new AttributeReader();

        $attributes = $reader->forClassAndMethod(FooBar::class, $method, $attributeClass);

        self::assertContainsOnlyInstancesOf($attributeClass, $attributes);
        self::assertSame($expected, array_column($attributes, '

ds TestCase
{
    /**
     * @dataProvider provideReadCases
     */
    #[DataProvider('provideReadCases')]
    public function testAttributesAreRead(string $method, string $attributeClass, array $expected)
    {
        $reader


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\Bridge\PhpUnit\Tests\Metadata\Fixtures;

use Symfony\Bridge\PhpUnit\Attribute\DnsSensitive;
use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive;

#[DnsSensitive('App\Foo\Bar\A')]
#[DnsSensitive('App\Foo\Bar\B')]
#[TimeSensitive('App\Foo\Bar\A')]
final class FooBar
{
    #[DnsSens

)
    {
    }

    #[TimeSensitive('App\Foo\Qux\D')]
    #[TimeSensitive('App\Foo\Qux\E')]
    public function testTwo()
    {
    }

    #[DnsSensitive('App\Foo\Corge\F')]
    #[TimeSensitive('App\Foo\Corge\G')]
    public function testThree()
    {
    }

itive('App\Foo\Baz\C')]
    public function testOne(


ge.
 *
 * (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\Bridge\PhpUnit\Metadata;

/**
 * @internal
 *
 * @template T of object
 */
final class AttributeReader
{
    /**
     * @var array<string, array<class-string<T>, list<T>>>
     */
    private array $cache = [];

    /**
     * @param class-string    $className
     * @param class-string<T> $name
     *

ttributes[$name] ?? [];
    }

    /**
     * @param class-string    $className
     * @param class-string<T> $name
     *
     * @return list<T>
     */
    public function forMethod(string $className, string $methodName, string $name): array
    {

  * @return list<T>
     */
    public function forClass(string $className, string $name): array
    {
        $attributes = $this->cache[$className] ??= $this->readAttributes(new \ReflectionClass($className));

        return $a


name = null;
        $getPhpUnitConfig = static function ($probableConfig) use (&$getPhpUnitConfig) {
            if (!$probableConfig) {
                return null;
            }

            if (is_dir($probableConfig)) {
                return $getPhpUnitConfig($probableConfig.\DIRECTORY_SEPARATOR.'phpunit');
            }

            foreach (['.xml', '.xml.dist', '.dist.xml'] as $suffix) {
                if (file_exists($candidate = $probableConfig.$suffix)) {
                    return $candidate;

g option
            if ('--configuration' === $cliArgument && array_key_exists($cliArgumentIndex + 1, $argv)) {
                $phpunitConfigFilename = $getPhpUnitConfig($argv[$cliArgumentIndex + 1]);
                break;
            }
            // s

                }
            }

            return null;
        };

        foreach ($argv as $cliArgumentIndex => $cliArgument) {
            if ('--' === $cliArgument) {
                break;
            }
            // lon


 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\Bridge\Monolog\Processor;

use Monolog\LogRecord;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

/**
 * The base class for security token processors.
 *
 * @author Da

 protected TokenStorageInterface $tokenStorage,
    ) {
    }

    abstract protected function getKey(): string;

    abstract protected function getToken(): ?TokenInterface;

    public function __invoke(LogRecord $record): LogRecord
    {
        if ($th

ny Maillard <danymaillard93b@gmail.com>
 * @author Igor Timoshenko <igor.timoshenko@i.ua>
 *
 * @internal
 */
abstract class AbstractTokenProcessor
{
    private bool $processing = false;

    public function __construct(


 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\Bridge\Monolog\Processor;

use Monolog\LogRecord;
use Monolog\ResettableInterface;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Contracts\Service\ResetInte

nterface
{
    private array $commandData;

    public function __construct(
        private bool $includeArguments = true,
        private bool $includeOptions = false,
    ) {
    }

    public function __invoke(LogRecord $record): LogRecord
    {

rface;

/**
 * Adds the current console command information to the log entry.
 *
 * @author Piotr Stankowski <git@trakos.pl>
 */
final class ConsoleCommandProcessor implements EventSubscriberInterface, ResetInterface, ResettableI


ge.
 *
 * (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\Bridge\Monolog\Processor;

use Monolog\Level;
use Monolog\LogRecord;
use Monolog\ResettableInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Symfony\Contracts\Service\ResetInterface;

cl

stStack = null,
    ) {
    }

    public function __invoke(LogRecord $record): LogRecord
    {
        $key = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_id($request) : '';

        $this->records[$key][] = [

ass DebugProcessor implements DebugLoggerInterface, ResetInterface, ResettableInterface
{
    private array $records = [];
    private array $errorCount = [];

    public function __construct(
        private ?RequestStack $reque


ge.
 *
 * (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\Bridge\Monolog\Processor;

use Monolog\LogRecord;
use Monolog\ResettableInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
u

esetInterface, ResettableInterface
{
    private array $routeData = [];

    public function __construct(
        private bool $includeParams = true,
    ) {
        $this->reset();
    }

    public function __invoke(LogRecord $record): LogRecord
    {

se Symfony\Contracts\Service\ResetInterface;

/**
 * Adds the current route information to the log entry.
 *
 * @author Piotr Stankowski <git@trakos.pl>
 *
 * @final
 */
class RouteProcessor implements EventSubscriberInterface, R


n 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\Bridge\Monolog\Processor;

use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

/**
 * Adds the original security token to the log entry.
 *
 * @author Igor Timoshenko <igor.timoshenko@i.ua>
 */
final class SwitchUserTokenProcessor

tion getKey(): string
    {
        return 'impersonator_token';
    }

    protected function getToken(): ?TokenInterface
    {
        $token = $this->tokenStorage->getToken();

        if ($token instanceof SwitchUserToken) {
            return $token->

 extends AbstractTokenProcessor
{
    protected func


 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\WebLink\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\WebLink\HttpHeaderSerializer;
use Symfony\Component\WebLink\Link;

class HttpHeaderSerializerTest extends TestCase
{
    private HttpHeaderSerializer $serializer;

    protected function setUp(): void

e('pr', 0.7),
            (new Link('preload', '/3'))->withAttribute('as', 'script')->withAttribute('nopush', false),
            (new Link('preload', '/4'))->withAttribute('as', 'image')->withAttribute('nopush', true),
            (new Link('alternate', '

    {
        $this->serializer = new HttpHeaderSerializer();
    }

    public function testSerialize()
    {
        $links = [
            new Link('prerender', '/1'),
            (new Link('dns-prefetch', '/2'))->withAttribut


ge.
 *
 * (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\WebLink\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\WebLink\Link;

/**
 * Test case borrowed from https://github.com/php-fig/link/.
 */
class LinkTest extends TestCase
{
    public function testCanSetAndRetrieveValues()
    {

  $this->assertContains('next', $link->getRels());
        $this->assertArrayHasKey('me', $link->getAttributes());
        $this->assertSame('you', $link->getAttributes()['me']);
    }

    public function testCanRemoveValues()
    {
        $link = (new L

  $link = (new Link())
            ->withHref('http://www.google.com')
            ->withRel('next')
            ->withAttribute('me', 'you')
        ;

        $this->assertSame('http://www.google.com', $link->getHref());


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\PhpUnit;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 * @author Dominic Tubach <dominic.tubach@to.com>
 */
class ClockMock
{
    private static $now;

    public static function withClockMock($enable = null): ?bool
    {
        if (null === $enable) {
            return null !== self::$now;
        }

        self::$now = is_numeric($enable) ? (

now;
    }

    public static function sleep($s): int
    {
        if (null === self::$now) {
            return \sleep($s);
        }

        self::$now += (int) $s;

        return 0;
    }

    public static function usleep($us): void
    {
        if

float) $enable : ($enable ? microtime(true) : null);

        return null;
    }

    public static function time(): int
    {
        if (null === self::$now) {
            return \time();
        }

        return (int) self::$


HPUnit\Util\ErrorHandler as UtilErrorHandler;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Configuration;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\DeprecationGroup;
use Symfony\Component\ErrorHandler\DebugClassLoader;

/**
 * Catch deprecation notices and print a summary report at the end of the test suite.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class DeprecationErrorHandler
{
    public const MODE_DISABLED = 'disabled

nGroups = [];

    private static $isRegistered = false;
    private static $errorHandler;

    public function __construct()
    {
        $this->resetDeprecationGroups();
    }

    /**
     * Registers and configures the deprecation handler.
     *

';
    public const MODE_WEAK = 'max[total]=999999&verbose=0';
    public const MODE_STRICT = 'max[total]=0';

    private $mode;
    private $configuration;

    /**
     * @var DeprecationGroup[]
     */
    private $deprecatio


buted with this source code.
 */

namespace Symfony\Bridge\PhpUnit;

use Doctrine\Deprecations\Deprecation;
use PHPUnit\Event\Code\Test;
use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Event\Test\BeforeTestMethodErrored;
use PHPUnit\Event\Test\BeforeTestMethodErroredSubscriber;
use PHPUnit\Event\Test\Errored;
use PHPUnit\Event\Test\ErroredSubscriber;
use PHPUnit\Event\Test\Finished;
use PHPUnit\Event\Test\FinishedSubscriber;
use PHPUnit\Event\Test\Skipped;
use PHPUnit\Event\Test\SkippedSubscriber;
use PHPUni

\DnsSensitive;
use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive;
use Symfony\Bridge\PhpUnit\Extension\EnableClockMockSubscriber;
use Symfony\Bridge\PhpUnit\Extension\RegisterClockMockSubscriber;
use Symfony\Bridge\PhpUnit\Extension\RegisterDnsMockSubscri

t\Metadata\Group;
use PHPUnit\Runner\Extension\Extension;
use PHPUnit\Runner\Extension\Facade;
use PHPUnit\Runner\Extension\ParameterCollection;
use PHPUnit\TextUI\Configuration\Configuration;
use Symfony\Bridge\PhpUnit\Attribute


/*
 * 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.
 */

use Doctrine\Deprecations\Deprecation;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;

// Skip if we're using PHPUnit >=10
if (class_exists(PHPUnit\Metadata\Metadata::class)) {
    return;
}

// Detect if we need to serialize deprecations to a file.
if (in_array(\PHP_SAPI, [

OMPOSER_INSTALL') && !class_exists(PHPUnit\TextUI\Command::class, false)) {
    return;
}

if (isset($fileIdentifier)) {
    unset($GLOBALS['__composer_autoload_files'][$fileIdentifier]);
}

if (class_exists(Deprecation::class)) {
    Deprecation::withoutD

'cli', 'phpdbg'], true) && $file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
    DeprecationErrorHandler::collectDeprecations($file);

    return;
}

// Detect if we're loaded by an actual run of phpunit
if (!defined('PHPUNIT_C


 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\Bridge\PhpUnit\Extension;

use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Event\TestSuite\Loaded;
use PHPUnit\Event\TestSuite\LoadedSubscriber;
use PHPUnit\Metadata\Group;
use Symfony\Bridge\PhpUnit\Attribute\TimeSensitive;
use Symfony\Bridge\PhpUnit\ClockMock;
use Sy

lic function notify(Loaded $event): void
    {
        foreach ($event->testSuite()->tests() as $test) {
            if (!$test instanceof TestMethod) {
                continue;
            }

            foreach ($test->metadata() as $metadata) {

mfony\Bridge\PhpUnit\Metadata\AttributeReader;

/**
 * @internal
 */
class RegisterClockMockSubscriber implements LoadedSubscriber
{
    public function __construct(
        private AttributeReader $reader,
    ) {
    }

    pub


ge.
 *
 * (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\Bridge\PhpUnit\Legacy;

use PHPUnit\TextUI\Command as BaseCommand;
use PHPUnit\TextUI\Configuration\Configuration as LegacyConfiguration;
use PHPUnit\TextUI\Configuration\Registry;
use PHPUnit\TextUI\TestRunner as BaseRunner;
use PHPUnit\TextUI\XmlConfiguration\Configuration;
use PHPUnit\TextUI\XmlConfigur

>arguments['listeners'] = [];

        $registeredLocally = false;

        foreach ($this->arguments['listeners'] as $registeredListener) {
            if ($registeredListener instanceof SymfonyTestsListener) {
                $registeredListener->globalL

ation\Loader;
use Symfony\Bridge\PhpUnit\SymfonyTestsListener;

/**
 * @internal
 */
class CommandForV9 extends BaseCommand
{
    protected function createRunner(): BaseRunner
    {
        $this->arguments['listeners'] ?? $this-


hp

/*
 * 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\Bridge\PhpUnit\Legacy;

/**
 * @internal
 */
trait ConstraintTraitForV8
{
    use ConstraintLogicTrait;

    /**
     * @return bool|null
     */
    public function evaluate($other, $description = '', $returnResult = false)
    {
        return $this->doEval

d function additionalFailureDescription($other): string
    {
        return $this->doAdditionalFailureDescription($other);
    }

    protected function failureDescription($other): string
    {
        return $this->doFailureDescription($other);
    }

uate($other, $description, $returnResult);
    }

    public function count(): int
    {
        return $this->doCount();
    }

    public function toString(): string
    {
        return $this->doToString();
    }

    protecte


 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\Bridge\PhpUnit\Legacy;

/**
 * @internal, use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait instead.
 */
trait ExpectDeprecationTraitBeforeV8_4
{
    /**
     * @param string $message
     */
    protected function expectDeprecation($message): void
    {
        // Expected deprec

sultObject()->beStrictAboutTestsThatDoNotTestAnything(false);
            $expectedDeprecations = file_get_contents($file);
            if ($expectedDeprecations) {
                $expectedDeprecations = array_merge(unserialize($expectedDeprecations), [$m

ations set by isolated tests need to be written to a file
        // so that the test running process can take account of them.
        if ($file = getenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE')) {
            $this->getTestRe


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bridge\PhpUnit\Legacy;

use PHPUnit\Framework\Constraint\LogicalNot;
use PHPUnit\Framework\Constraint\TraversableContains;

/**
 * This trait is @internal.
 */
trait PolyfillAssertTrait
{
    /**
     * @param iterable $haystack
     * @param string   $message
     *
     * @return void
     */
    public static function assertContainsEquals($needle, $hays

 $message
     *
     * @return void
     */
    public static function assertNotContainsEquals($needle, $haystack, $message = '')
    {
        $constraint = new LogicalNot(new TraversableContains($needle, false, false));
        static::assertThat($hayst

tack, $message = '')
    {
        $constraint = new TraversableContains($needle, false, false);
        static::assertThat($haystack, $constraint, $message);
    }

    /**
     * @param iterable $haystack
     * @param string


e PHPUnit\Framework\TestCase;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Runner\BaseTestRunner;
use PHPUnit\Runner\PhptTestCase;
use PHPUnit\Util\Blacklist;
use PHPUnit\Util\ExcludeList;
use PHPUnit\Util\Test;
use Symfony\Bridge\PhpUnit\ClockMock;
use Symfony\Bridge\PhpUnit\DnsMock;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Symfony\Component\ErrorHandler\DebugClassLoader;

/**
 * PHP 5.3 compatible trait-like shared implementation.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 *
 * @internal

$state = -1;
    private $skippedFile = false;
    private $wasSkipped = [];
    private $isSkipped = [];
    private $runsInSeparateProcess = false;
    private $checkNumAssertions = false;

    /**
     * @param array $mockedNamespaces List of namespaces

 */
class SymfonyTestsListenerTrait
{
    public static $expectedDeprecations = [];
    public static $previousErrorHandler;
    private static $gatheredDeprecations = [];
    private static $globallyEnabled = false;
    private


ork\TestSuite;
use PHPUnit\Metadata\Api\Groups;
use PHPUnit\Util\Test;
use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor;
use Symfony\Component\ErrorHandler\DebugClassLoader;

class_exists(Groups::class);

/**
 * @internal
 */
class Deprecation
{
    public const PATH_TYPE_VENDOR = 'path_type_vendor';
    public const PATH_TYPE_SELF = 'path_type_internal';
    public const PATH_TYPE_UNDETERMINED = 'path_type_undetermined';

    public const TYPE_SELF = 'type_self';
    public const TYPE_DIRECT = 'ty

   private $originMethod;
    private $triggeringFile;
    private $triggeringClass;

    /** @var string[] Absolute paths to vendor directories */
    private static $vendors;

    /**
     * @var string[] Absolute paths to source or tests of the project,

pe_direct';
    public const TYPE_INDIRECT = 'type_indirect';
    public const TYPE_UNDETERMINED = 'type_undetermined';

    private $trace = [];
    private $message;
    private $languageDeprecation;
    private $originClass;


 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\Bridge\PhpUnit\DeprecationErrorHandler;

/**
 * @internal
 */
final class DeprecationGroup
{
    private $count = 0;

    /**
     * @var DeprecationNotice[] keys are messages
     */
    private $deprecationNotices = [];

    public function addNoticeFromObject(strin

essage): void
    {
        $this->deprecationNotice($message)->addProceduralOccurrence();
        $this->addNotice();
    }

    public function addNotice(): void
    {
        ++$this->count;
    }

    private function deprecationNotice(string $message)

g $message, string $class, string $method): void
    {
        $this->deprecationNotice($message)->addObjectOccurrence($class, $method);
        $this->addNotice();
    }

    public function addNoticeFromProceduralCode(string $m


 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\Bridge\PhpUnit\Tests;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ClockMock;

/**
 * @author Dominic Tubach <dominic.tubach@to.com>
 *
 * @covers \Symfony\Bridge\PhpUnit\ClockMock
 */
#[CoversClass(ClockMock::class)]
cl

125);
    }

    public function testTime()
    {
        $this->assertSame(1234567890, time());
    }

    public function testSleep()
    {
        sleep(2);
        $this->assertSame(1234567892, time());
    }

    public function testMicrotime()
    {

ass ClockMockTest extends TestCase
{
    public static function setUpBeforeClass(): void
    {
        ClockMock::register(__CLASS__);
    }

    protected function setUp(): void
    {
        ClockMock::withClockMock(1234567890.


ge.
 *
 * (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\WebLink\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\WebLink\GenericLinkProvider;
use Symfony\Component\WebLink\Link;

/**
 * Test case borrowed from https://github.com/php-fig/link/.
 */
class GenericLinkProviderTest extends TestCase
{
    public function testCanAddLinksByMethod

>withLink($link);

        $this->assertContains($link, $provider->getLinks());
    }

    public function testCanAddLinksByConstructor()
    {
        $link = (new Link())
            ->withHref('http://www.google.com')
            ->withRel('next')

()
    {
        $link = (new Link())
            ->withHref('http://www.google.com')
            ->withRel('next')
            ->withAttribute('me', 'you')
        ;

        $provider = (new GenericLinkProvider())
            -


ge.
 *
 * (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\Bridge\PhpUnit;

/**
 * @author Roland Franssen <franssen.roland@gmail.com>
 */
class ClassExistsMock
{
    private static $classes = [];

    private static $enums = [];

    /**
     * Configures the classes to be checked upon existence.
     *
     * @param array $classes Mocked class names as keys (cas

ums to be checked upon existence.
     *
     * @param array $enums Mocked enums names as keys (case-sensitive, without leading root namespace slash) and booleans as values
     */
    public static function withMockedEnums(array $enums): void
    {

e-sensitive, without leading root namespace slash) and booleans as values
     */
    public static function withMockedClasses(array $classes): void
    {
        self::$classes = $classes;
    }

    /**
     * Configures the en