prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Server;
use Psr\Log\LoggerInterface;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* A server c... | '.$host;
}
$this->host = $host;
}
public function start(): void
{
if (!$this->socket = stream_socket_server($this->host, $errno, $errstr)) {
throw new \RuntimeException(\sprintf('Server start failed on "%s" | ar resource|null
*/
private $socket;
public function __construct(
string $host,
private ?LoggerInterface $logger = null,
) {
if (!str_contains($host, '://')) {
$host = 'tcp:// | {
"filepath": "src/Symfony/Component/VarDumper/Server/DumpServer.php",
"language": "php",
"file_size": 3156,
"cut_index": 614,
"middle_length": 229
} |
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\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* @author Nicolas Grekas <p@tchwork... | 'ai_family' => [
1 => 'AF_UNIX',
2 => 'AF_INET',
10 => 'AF_INET6',
44 => 'AF_DIVERT',
],
'ai_socktype' => [
1 => 'SOCK_STREAM',
2 => 'SOCK_DGRAM',
3 => 'SO | I_NUMERICHOST',
8 => 'AI_V4MAPPED',
16 => 'AI_ALL',
32 => 'AI_ADDRCONFIG',
64 => 'AI_IDN',
128 => 'AI_CANONIDN',
1024 => 'AI_NUMERICSERV',
],
| {
"filepath": "src/Symfony/Component/VarDumper/Caster/AddressInfoCaster.php",
"language": "php",
"file_size": 2242,
"cut_index": 563,
"middle_length": 229
} |
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\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Represents a list of function arg... | w CutStub($v) : $v;
}
if (null === $params) {
parent::__construct($values, false);
return;
}
if (\count($values) < \count($params)) {
$params = \array_slice($params, 0, \count($values));
| tion, ?string $class)
{
[$variadic, $params] = self::getParameters($function, $class);
$values = [];
foreach ($args as $k => $v) {
$values[$k] = !\is_scalar($v) && !$v instanceof Stub ? ne | {
"filepath": "src/Symfony/Component/VarDumper/Caster/ArgsStub.php",
"language": "php",
"file_size": 2280,
"cut_index": 563,
"middle_length": 229
} |
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\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/... | ();
}
$properties = [];
foreach ($r->getProperties(\ReflectionProperty::IS_STATIC) as $p) {
$key = match (true) {
$p->isPublic() => $p->getName(),
$p->isProtected() => Caster::PREFIX_PROT | ew \ReflectionClass($class);
$this->type = self::TYPE_OBJECT;
$this->class = $class;
if ($f = $r->getFileName()) {
$this->attr['file'] = $f;
$this->attr['line'] = $r->getStartLine | {
"filepath": "src/Symfony/Component/VarDumper/Caster/ClassDumpStub.php",
"language": "php",
"file_size": 1293,
"cut_index": 524,
"middle_length": 229
} |
/*
* 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\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\St... | * @param array<int, string> $values
*/
public static function fromBitfield(int $value, array $values): self
{
$names = [];
foreach ($values as $v => $name) {
if ($value & $v) {
$names[] = $name; | oat|null $value = null)
{
$this->class = $name;
$this->value = 1 < \func_num_args() ? $value : $name;
}
public function __toString(): string
{
return (string) $this->value;
}
/**
| {
"filepath": "src/Symfony/Component/VarDumper/Caster/ConstStub.php",
"language": "php",
"file_size": 1168,
"cut_index": 518,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts DOM related classes to array representation.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class DOMCaster
{
private const ERROR_CODES = [
... | ED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR',
\DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR',
\DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR',
\DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR',
\DOM_INVALID_STATE_ERR => 'DOM | R',
\DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR',
\DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR',
\DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR',
\DOM_NO_MODIFICATION_ALLOW | {
"filepath": "src/Symfony/Component/VarDumper/Caster/DOMCaster.php",
"language": "php",
"file_size": 7159,
"cut_index": 716,
"middle_length": 229
} |
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\VarDumper\Caster;
use Doctrine\Common\Proxy\Proxy as CommonProxy;
use Doctrine... | _', '__initializer__'] as $k) {
if (\array_key_exists($k, $a)) {
unset($a[$k]);
++$stub->cut;
}
}
return $a;
}
public static function castOrmProxy(OrmProxy $proxy, array $a, | Nicolas Grekas <p@tchwork.com>
*
* @final
*
* @internal
*/
class DoctrineCaster
{
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested): array
{
foreach (['__cloner_ | {
"filepath": "src/Symfony/Component/VarDumper/Caster/DoctrineCaster.php",
"language": "php",
"file_size": 1709,
"cut_index": 537,
"middle_length": 229
} |
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\VarDumper\Caster;
use Ds\Collection;
use Ds\Map;
use Ds\Pair;
use Symfony\Comp... | anceof Map) {
$a += $c->toArray();
}
return $a;
}
public static function castMap(Map $c, array $a, Stub $stub, bool $isNested): array
{
foreach ($c as $k => $v) {
$a[] = new DsPairStub($k, $v);
| tion castCollection(Collection $c, array $a, Stub $stub, bool $isNested): array
{
$a[Caster::PREFIX_VIRTUAL.'count'] = $c->count();
$a[Caster::PREFIX_VIRTUAL.'capacity'] = $c->capacity();
if (!$c inst | {
"filepath": "src/Symfony/Component/VarDumper/Caster/DsCaster.php",
"language": "php",
"file_size": 1590,
"cut_index": 537,
"middle_length": 229
} |
ymfony\Component\RemoteEvent\Event\Mailer\MailerDeliveryEvent;
use Symfony\Component\RemoteEvent\Event\Mailer\MailerEngagementEvent;
$wh1 = new MailerEngagementEvent(
MailerEngagementEvent::CLICK, '7761630', json_decode(
file_get_contents(
... | teFromFormat('U', 1365109999));
$wh2 = new MailerDeliveryEvent(
MailerDeliveryEvent::DEFERRED, '7761631', json_decode(
file_get_contents(
str_repla | )['mandrill_events'][0]
);
$wh1->setRecipientEmail('foo@example.com');
$wh1->setTags(['my_tag_1', 'my_tag_2']);
$wh1->setMetadata(['mandrill-var-1' => 'foo', 'mandrill-var-2' => 'bar']);
$wh1->setDate(\DateTimeImmutable::crea | {
"filepath": "src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Webhook/Fixtures/batch.php",
"language": "php",
"file_size": 1471,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Webhook;
use Symfony\Component\HttpFoundation\ChainRequestMatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Compon... | okException;
final class MailchimpRequestParser extends AbstractRequestParser
{
public function __construct(
private readonly MailchimpPayloadConverter $converter,
) {
}
protected function getRequestMatcher(): RequestMatcherInterf | Converter;
use Symfony\Component\RemoteEvent\Exception\ParseException;
use Symfony\Component\RemoteEvent\RemoteEvent;
use Symfony\Component\Webhook\Client\AbstractRequestParser;
use Symfony\Component\Webhook\Exception\RejectWebho | {
"filepath": "src/Symfony/Component/Mailer/Bridge/Mailchimp/Webhook/MailchimpRequestParser.php",
"language": "php",
"file_size": 4074,
"cut_index": 614,
"middle_length": 229
} |
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\Mailer\Bridge\Mailjet\RemoteEvent;
use Symfony\Component\RemoteEvent\Event\Mailer\AbstractMailerEvent;
u... | array($payload['event'], ['bounce', 'sent', 'blocked'], true)) {
$name = match ($payload['event']) {
'bounce' => MailerDeliveryEvent::BOUNCE,
'sent' => MailerDeliveryEvent::DELIVERED,
'blocked' => | ion;
use Symfony\Component\RemoteEvent\PayloadConverterInterface;
final class MailjetPayloadConverter implements PayloadConverterInterface
{
public function convert(array $payload): AbstractMailerEvent
{
if (\in_ | {
"filepath": "src/Symfony/Component/Mailer/Bridge/Mailjet/RemoteEvent/MailjetPayloadConverter.php",
"language": "php",
"file_size": 2433,
"cut_index": 563,
"middle_length": 229
} |
he 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\Mailer\Test;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\Mailer... | /**
* @dataProvider incompleteDsnProvider
*/
#[DataProvider('incompleteDsnProvider')]
public function testIncompleteDsnException(Dsn $dsn)
{
$factory = $this->getFactory();
$this->expectException(IncompleteDsnExce | static function incompleteDsnProvider(): iterable;
| {
"filepath": "src/Symfony/Component/Mailer/Test/IncompleteDsnTestTrait.php",
"language": "php",
"file_size": 910,
"cut_index": 547,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper;
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoun... | \Component\VarDumper\Dumper\ContextualizedDumper;
use Symfony\Component\VarDumper\Dumper\DataDumperInterface;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\Dumper\ServerDumper;
// Load the global dump() function
requir | mponent\VarDumper\Dumper\ContextProvider\CliContextProvider;
use Symfony\Component\VarDumper\Dumper\ContextProvider\RequestContextProvider;
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
use Symfony | {
"filepath": "src/Symfony/Component/VarDumper/VarDumper.php",
"language": "php",
"file_size": 4331,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts Amqp related classes to array representation.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final
*
* @internal
*/
class AmqpCaster
{
private const FLAGS = [
... | Y',
\AMQP_IMMEDIATE => 'AMQP_IMMEDIATE',
\AMQP_MULTIPLE => 'AMQP_MULTIPLE',
\AMQP_NOWAIT => 'AMQP_NOWAIT',
\AMQP_REQUEUE => 'AMQP_REQUEUE',
];
private const EXCHANGE_TYPES = [
\AMQP_EX_TYPE_DIRECT => 'AMQP_E | L => 'AMQP_INTERNAL',
\AMQP_NOLOCAL => 'AMQP_NOLOCAL',
\AMQP_AUTOACK => 'AMQP_AUTOACK',
\AMQP_IFEMPTY => 'AMQP_IFEMPTY',
\AMQP_IFUNUSED => 'AMQP_IFUNUSED',
\AMQP_MANDATORY => 'AMQP_MANDATOR | {
"filepath": "src/Symfony/Component/VarDumper/Caster/AmqpCaster.php",
"language": "php",
"file_size": 6745,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Represents a PHP class identifier.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
... | try {
if (null !== $callable) {
if ($callable instanceof \Closure) {
$r = new \ReflectionFunction($callable);
} elseif (\is_object($callable)) {
$r = [$callable, '__invoke' | eted by the identifier when it is ambiguous or not a real PHP identifier
*/
public function __construct(string $identifier, callable|array|string|null $callable = null)
{
$this->value = $identifier;
| {
"filepath": "src/Symfony/Component/VarDumper/Caster/ClassStub.php",
"language": "php",
"file_size": 3824,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts DateTimeInterface related classes to array representation.
*
* @author Dany ... | ->diff($d);
$title = $d->format('l, F j, Y')
."\n".self::formatInterval($fromNow).' from now'
.($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '')
;
unset(
$a[Caster::PREFIX_DYNAMIC. | ay $a, Stub $stub, bool $isNested, int $filter): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$location = $d->getTimezone() ? $d->getTimezone()->getLocation() : null;
$fromNow = (new \DateTimeImmutable()) | {
"filepath": "src/Symfony/Component/VarDumper/Caster/DateCaster.php",
"language": "php",
"file_size": 4928,
"cut_index": 614,
"middle_length": 229
} |
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\Mailer\Bridge\Mailjet\Transport;
use Symfony\Component\Mailer\Exception\Unsupp... | getPassword($dsn);
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
$sandbox = $dsn->getBooleanOption('sandbox');
if ('mailjet+api' === $scheme) {
return (new MailjetApiTransport($user, $password, $this-> | lass MailjetTransportFactory extends AbstractTransportFactory
{
public function create(Dsn $dsn): TransportInterface
{
$scheme = $dsn->getScheme();
$user = $this->getUser($dsn);
$password = $this-> | {
"filepath": "src/Symfony/Component/Mailer/Bridge/Mailjet/Transport/MailjetTransportFactory.php",
"language": "php",
"file_size": 1539,
"cut_index": 537,
"middle_length": 229
} |
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\Mailer\Bridge\Mailjet\Webhook;
use Symfony\Component\HttpFoundation\ChainReque... | ymfony\Component\RemoteEvent\Exception\ParseException;
use Symfony\Component\Webhook\Client\AbstractRequestParser;
use Symfony\Component\Webhook\Exception\RejectWebhookException;
final class MailjetRequestParser extends AbstractRequestParser
{
public | uestMatcher;
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
use Symfony\Component\Mailer\Bridge\Mailjet\RemoteEvent\MailjetPayloadConverter;
use Symfony\Component\RemoteEvent\Event\Mailer\AbstractMailerEvent;
use S | {
"filepath": "src/Symfony/Component/Mailer/Bridge/Mailjet/Webhook/MailjetRequestParser.php",
"language": "php",
"file_size": 1869,
"cut_index": 537,
"middle_length": 229
} |
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\VarDumper\Server;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Dumper\Co... | t providers indexed by context name
*/
public function __construct(
string $host,
private array $contextProviders = [],
) {
if (!str_contains($host, '://')) {
$host = 'tcp://'.$host;
}
$this | e string $host;
/**
* @var resource|null
*/
private $socket;
/**
* @param string $host The server host
* @param ContextProviderInterface[] $contextProviders Contex | {
"filepath": "src/Symfony/Component/VarDumper/Server/Connection.php",
"language": "php",
"file_size": 2604,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Helper for filtering out properties in casters.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @final
*/
class Caster
{
public const EXCLUDE_VERBOSE = 1;
public const EXCLUD... | public const PREFIX_DYNAMIC = "\0+\0";
public const PREFIX_PROTECTED = "\0*\0";
// usage: sprintf(Caster::PATTERN_PRIVATE, $class, $property)
public const PATTERN_PRIVATE = "\0%s\0%s";
private static array $classProperties = [];
/* | DE_NULL = 64;
public const EXCLUDE_EMPTY = 128;
public const EXCLUDE_NOT_IMPORTANT = 256;
public const EXCLUDE_STRICT = 512;
public const EXCLUDE_UNINITIALIZED = 1024;
public const PREFIX_VIRTUAL = "\0~\0";
| {
"filepath": "src/Symfony/Component/VarDumper/Caster/Caster.php",
"language": "php",
"file_size": 6985,
"cut_index": 716,
"middle_length": 229
} |
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\Mailer\Bridge\Mailchimp\Tests\Webhook;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Compone... | return new MailchimpRequestParser(new MailchimpPayloadConverter());
}
protected function createRequest(string $payload): Request
{
$decodedPayload = json_decode($payload, true, 512, \JSON_THROW_ON_ERROR);
$mandrillSignat | erInterface;
use Symfony\Component\Webhook\Test\AbstractRequestParserTestCase;
class MailchimpRequestParserTest extends AbstractRequestParserTestCase
{
protected function createRequestParser(): RequestParserInterface
{
| {
"filepath": "src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Webhook/MailchimpRequestParserTest.php",
"language": "php",
"file_size": 2135,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Bridge\Mailjet\Tests\Transport;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\Mailer\Bridge\Mailjet... | ;
class MailjetTransportFactoryTest extends AbstractTransportFactoryTestCase
{
use IncompleteDsnTestTrait;
public function getFactory(): TransportFactoryInterface
{
return new MailjetTransportFactory(null, new MockHttpClient(), new Nu | ymfony\Component\Mailer\Test\AbstractTransportFactoryTestCase;
use Symfony\Component\Mailer\Test\IncompleteDsnTestTrait;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface | {
"filepath": "src/Symfony/Component/Mailer/Bridge/Mailjet/Tests/Transport/MailjetTransportFactoryTest.php",
"language": "php",
"file_size": 3218,
"cut_index": 614,
"middle_length": 229
} |
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\VarDumper\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Represe... | ue instanceof \Closure) {
ReflectionCaster::castClosure($value, [], $this, true, Caster::EXCLUDE_VERBOSE);
}
$this->cut = -1;
break;
case 'array':
$this->type | {
$this->value = $value;
switch (\gettype($value)) {
case 'object':
$this->type = self::TYPE_OBJECT;
$this->class = get_debug_type($value);
if ($val | {
"filepath": "src/Symfony/Component/VarDumper/Caster/CutStub.php",
"language": "php",
"file_size": 1939,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Caster\ArgsStub;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Caster\LinkStub;
use Symfony\Component\VarDumper\Caster\ScalarStub;
us... | n testArgsStubWithDefaults($foo = 234, $bar = 456)
{
$args = [new ArgsStub([123], __FUNCTION__, __CLASS__)];
$expectedDump = <<<'EODUMP'
array:1 [
0 => {
$foo: 123
}
] | umperTestTrait;
use Symfony\Component\VarDumper\Tests\Fixtures\FooInterface;
use Symfony\Component\VarDumper\Tests\Fixtures\VirtualProperty;
class StubCasterTest extends TestCase
{
use VarDumperTestTrait;
public functio | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php",
"language": "php",
"file_size": 8879,
"cut_index": 716,
"middle_length": 229
} |
ImgStub;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\Tests\Fixtures\VirtualProperty;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class HtmlDumperTest extends TestCase
{
public function testGet()
{
if (\ini_ge... | ddCasters([
':stream' => static function ($res, $a) {
unset($a['uri'], $a['wrapper_data']);
return $a;
},
]);
$data = $cloner->cloneVar($var);
ob_start();
$dumper->du | ixtures/dumb-var.php';
$dumper = new HtmlDumper('php://output');
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$cloner = new VarCloner();
$cloner->a | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php",
"language": "php",
"file_size": 16389,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Baptiste Clavié <clavie.b@gmail.com>
*/
class XmlReaderCasterTest extends TestCase
{
use VarDumperTestTrait;
private \... | MP'
XMLReader {%A
+nodeType: ~ int
%A
parserProperties: {
SUBST_ENTITIES: true
…3
}
…12
}
EODUMP;
$this->asse | d function tearDown(): void
{
$this->reader->close();
}
public function testParserProperty()
{
$this->reader->setParserProperty(\XMLReader::SUBST_ENTITIES, true);
$expectedDump = <<<'EODU | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php",
"language": "php",
"file_size": 6830,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Command\Descriptor;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Command\Desc... | imezone);
}
public function testItOutputsStylesAndScriptsOnFirstDescribeCall()
{
$output = new BufferedOutput();
$dumper = $this->createStub(HtmlDumper::class);
$dumper->method('dump')->willReturn('[DUMPED]');
$ | oreClass(): void
{
self::$timezone = date_default_timezone_get();
date_default_timezone_set('UTC');
}
public static function tearDownAfterClass(): void
{
date_default_timezone_set(self::$t | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php",
"language": "php",
"file_size": 7710,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Cloner;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ClassStub;
us... | tFalse(isset($data->{0}));
$this->assertFalse(isset($data[0]));
foreach ($data as $k => $v) {
$this->assertTrue(isset($data->{$k}));
$this->assertTrue(isset($data[$k]));
$this->assertSame(\gettype($value | > 123, 4.5, 'abc', null, false];
$data = $this->cloneVar($values);
$clonedValues = [];
$this->assertInstanceOf(Data::class, $data);
$this->assertCount(\count($values), $data);
$this->asser | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Cloner/DataTest.php",
"language": "php",
"file_size": 3515,
"cut_index": 614,
"middle_length": 229
} |
$o1 = new class {
public string $p1 = 'p1';
};
$o2 = new class {
public string $p2 = 'p2';
};
AbstractCloner::addDefaultCasters([
$o1::class => static function ($obj, $array) {
$array['p1'] = 123;
return $array... | rCloner();
$cloner->addCasters([
$o2::class => static function ($obj, $array) {
$array['p2'] = 456;
return $array;
},
]);
$dumper = new CliDumper('php://output');
$du | int $filter) {
$array = DateCaster::castDateTime($obj, $array, $stub, $isNested, $filter);
$array['foo'] = 'bar';
return $array;
},
]);
$cloner = new Va | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Cloner/VarClonerTest.php",
"language": "php",
"file_size": 27077,
"cut_index": 1331,
"middle_length": 229
} |
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\VarDumper\Tests\Dumper;
use PHPUnit\Framework\Attributes\BackupGlobals;
use PH... | tContextualizedCliDumper()
{
$_ENV['SYMFONY_IDE'] = $_SERVER['SYMFONY_IDE'] = '';
$wrappedDumper = new CliDumper('php://output');
$wrappedDumper->setColors(true);
$wrappedDumper->setDisplayOptions(['fileLinkFormat' => 'f | xtProvider;
use Symfony\Component\VarDumper\Dumper\ContextualizedDumper;
/**
* @author Kévin Thérage <therage.kevin@gmail.com>
*/
#[BackupGlobals(true)]
class ContextualizedDumperTest extends TestCase
{
public function tes | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Dumper/ContextualizedDumperTest.php",
"language": "php",
"file_size": 1520,
"cut_index": 537,
"middle_length": 229
} |
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\VarDumper\Tests\Dumper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Cloner\VarCloner... | $var1 = 'a';
ob_start();
$return = dump($var1);
ob_end_clean();
$this->assertSame($var1, $return);
}
public function testDumpReturnsFirstNamedArgWithoutSectionName()
{
$this->setupVarDumper();
| his->setupVarDumper();
ob_start();
$return = dump();
ob_end_clean();
$this->assertNull($return);
}
public function testDumpReturnsFirstArg()
{
$this->setupVarDumper();
| {
"filepath": "src/Symfony/Component/VarDumper/Tests/Dumper/FunctionsTest.php",
"language": "php",
"file_size": 2146,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
class DOMCasterTest extends TestCase
{
use VarDumperTestTrait;
public function testCastImplementation()
{
$implementation ... | {
Core: "1.0"
XML: "2.0"
}
EODUMP,
$implementation
);
}
public function testCastNode()
{
$doc = new \DOMDocument();
$doc->loadXML('<foo><bar/></foo>');
| $implementation
);
}
public function testCastModernImplementation()
{
$implementation = new \Dom\Implementation();
$this->assertDumpEquals(<<<'EODUMP'
Dom\Implementation | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/DOMCasterTest.php",
"language": "php",
"file_size": 6996,
"cut_index": 716,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use Doctrine\Common\Collections\ArrayCollection;
use D... | tCollection()
{
$classMetadata = new ClassMetadata(__CLASS__);
$entityManager = $this->createStub(EntityManagerInterface::class);
$entityManagerClass = $entityManager::class;
$collection = new PersistentCollection($enti | se;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
#[RequiresMethod(ArrayCollection::class, '__construct')]
class DoctrineCasterTest extends TestCase
{
use VarDumperTestTrait;
public function testCastPersisten | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/DoctrineCasterTest.php",
"language": "php",
"file_size": 1976,
"cut_index": 537,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\... | erTerminated()
{
$fiber = new \Fiber(static fn () => true);
$fiber->start();
$expected = <<<EODUMP
Fiber {
status: "terminated"
}
EODUMP;
$this->assertDumpEquals($expec | fn () => true);
$expected = <<<EODUMP
Fiber {
status: "not started"
}
EODUMP;
$this->assertDumpEquals($expected, $fiber);
}
public function testCastFib | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/FiberCasterTest.php",
"language": "php",
"file_size": 1693,
"cut_index": 537,
"middle_length": 229
} |
\Test\VarDumperTestTrait;
#[RequiresPhpExtension('intl')]
class IntlCasterTest extends TestCase
{
use VarDumperTestTrait;
public function testMessageFormatter()
{
$var = new \MessageFormatter('en', 'Hello {name}');
$expected = <<<EOTXT
MessageFormatter {
locale: ... | _INT_ONLY);
$expectedAttribute2 = $var->getAttribute(\NumberFormatter::GROUPING_USED);
$expectedAttribute3 = $var->getAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN);
$expectedAttribute4 = $var->getAttribute(\NumberFormatter::MAX_ | $var = new \NumberFormatter('en', \NumberFormatter::DECIMAL);
$expectedLocale = $var->getLocale();
$expectedPattern = $var->getPattern();
$expectedAttribute1 = $var->getAttribute(\NumberFormatter::PARSE | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/IntlCasterTest.php",
"language": "php",
"file_size": 15211,
"cut_index": 921,
"middle_length": 229
} |
he 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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\At... | ait;
public function testNotConnected()
{
$driver = new \mysqli_driver();
$driver->report_mode = 3;
$xCast = <<<EODUMP
mysqli_driver {%A
+report_mode: 3
}
EODUMP;
| asterTest extends TestCase
{
use VarDumperTestTr | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/MysqliCasterTest.php",
"language": "php",
"file_size": 912,
"cut_index": 547,
"middle_length": 52
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\Tes... | pped('Unable to generate a key pair');
}
$this->assertDumpMatchesFormat(
<<<'EODUMP'
OpenSSLAsymmetricKey {
bits: 1024
key: """
-----BEGIN PUBLIC KEY-----\ | testAsymmetricKey()
{
$key = openssl_pkey_new([
'private_key_bits' => 1024,
'private_key_type' => \OPENSSL_KEYTYPE_RSA,
]);
if (false === $key) {
$this->markTestSki | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/OpenSSLCasterTest.php",
"language": "php",
"file_size": 2414,
"cut_index": 563,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Require... |
$xCast = <<<'EODUMP'
Redis {
isConnected: false
}
EODUMP;
$this->assertDumpMatchesFormat($xCast, $redis);
}
#[TestWith([\Redis::class])]
#[TestWith([Relay::class])]
publi | as <p@tchwork.com>
*/
#[Group('integration')]
class RedisCasterTest extends TestCase
{
use VarDumperTestTrait;
#[RequiresPhpExtension('redis')]
public function testNotConnected()
{
$redis = new \Redis(); | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/RedisCasterTest.php",
"language": "php",
"file_size": 2125,
"cut_index": 563,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\Requires... | Dba\Connection {
+file: %s
}
EODUMP,
$dba
);
}
#[RequiresPhpExtension('dba')]
public function testCastDbaOnBuggyPhp84()
{
if (\PHP_VERSION_ID >= 80402) {
| hp('>=8.4.2')]
#[RequiresPhpExtension('dba')]
public function testCastDba()
{
$dba = dba_open(sys_get_temp_dir().'/test.db', 'c');
$this->assertDumpMatchesFormat(
<<<'EODUMP'
| {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/ResourceCasterTest.php",
"language": "php",
"file_size": 1389,
"cut_index": 524,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;... |
Socket {
uri: "udp://127.0.0.1:%d"
timed_out: false
blocked: true%A
}
EODUMP,
$socket
);
}
public function testCastSocketIpV | it;
public function testCastSocket()
{
$socket = socket_create(\AF_INET, \SOCK_DGRAM, \SOL_UDP);
@socket_connect($socket, '127.0.0.1', 80);
$this->assertDumpMatchesFormat(
<<<'EODUMP' | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/SocketCasterTest.php",
"language": "php",
"file_size": 1947,
"cut_index": 537,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\... | 83a9db35-3c8c-4040-b3c1-02eccc00b419"
toBase58: "HFzAAuYvev42cCjwqpnKqz"
toBase32: "43N7DKAF4C810B7G82XK601D0S"
}
EODUMP;
$this->assertDumpEquals($expectedDump, $uuid);
$uuid = new UuidV6 | VarDumperTestTrait;
public function testCastUuid()
{
$uuid = new UuidV4('83a9db35-3c8c-4040-b3c1-02eccc00b419');
$expectedDump = <<<EODUMP
Symfony\Component\Uid\UuidV4 {
#uid: " | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/SymfonyCasterTest.php",
"language": "php",
"file_size": 1934,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*/
class SplCasterTest extends TestCase
{
... | Test.php"
aTime: %s-%s-%d %d:%d:%d
mTime: %s-%s-%d %d:%d:%d
cTime: %s-%s-%d %d:%d:%d
inode: %i
size: %d
perms: 0%d
owner: %d
| Caster"
filename: "SplCasterTest.php"
basename: "SplCasterTest.php"
pathname: "%sSplCasterTest.php"
extension: "php"
realPath: "%sSplCaster | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php",
"language": "php",
"file_size": 7003,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Dumper\ContextProvider;
use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use... | private ?string $charset = null,
private ?string $projectDir = null,
private ?FileLinkFormatter $fileLinkFormatter = null,
private int $limit = 9,
) {
}
public function getContext(): ?array
{
$trace = d | t, ...).
*
* @author Nicolas Grekas <p@tchwork.com>
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
*/
final class SourceContextProvider implements ContextProviderInterface
{
public function __construct(
| {
"filepath": "src/Symfony/Component/VarDumper/Dumper/ContextProvider/SourceContextProvider.php",
"language": "php",
"file_size": 4798,
"cut_index": 614,
"middle_length": 229
} |
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\Lock;
use Symfony\Component\Lock\Exception\UnserializableKeyException;
/**
* Key is a container for th... | ction hasState(string $stateKey): bool
{
return isset($this->state[$stateKey]);
}
public function setState(string $stateKey, mixed $state): void
{
$this->state[$stateKey] = $state;
}
public function removeState(str | = [];
private bool $serializable = true;
public function __construct(
private string $resource,
) {
}
public function __toString(): string
{
return $this->resource;
}
public fun | {
"filepath": "src/Symfony/Component/Lock/Key.php",
"language": "php",
"file_size": 2826,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Lock;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Component\Lock\Exception\LockConflictedException;
u... | mum expected lock duration in seconds
* @param bool $autoRelease Whether to automatically release the lock or not when the lock instance is destroyed
*/
public function __construct(
private Key $key,
private PersistingSt | uthor Jérémy Derussé <jeremy@derusse.com>
*/
final class Lock implements SharedLockInterface, LoggerAwareInterface
{
use LoggerAwareTrait;
private bool $dirty = false;
/**
* @param float|null $ttl Maxi | {
"filepath": "src/Symfony/Component/Lock/Lock.php",
"language": "php",
"file_size": 8784,
"cut_index": 716,
"middle_length": 229
} |
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\Lock;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
/**
* ... | The resource to lock
* @param float|null $ttl Maximum expected lock duration in seconds
* @param bool $autoRelease Whether to automatically release the lock or not when the lock instance is destroyed
*/
public function c | erface
{
use LoggerAwareTrait;
public function __construct(
private PersistingStoreInterface $store,
) {
}
/**
* Creates a lock for the given resource.
*
* @param string $resource | {
"filepath": "src/Symfony/Component/Lock/LockFactory.php",
"language": "php",
"file_size": 1860,
"cut_index": 537,
"middle_length": 229
} |
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\Lock;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony... | lock until the release of the lock.
*
* @throws LockConflictedException If the lock is acquired by someone else in blocking mode
* @throws LockAcquiringException If the lock cannot be acquired
*/
public function acquire(bool $block | *
* @author Jérémy Derussé <jeremy@derusse.com>
*/
interface LockInterface
{
/**
* Acquires the lock. If the lock is acquired by someone else, the parameter `blocking` determines whether or not
* the call should b | {
"filepath": "src/Symfony/Component/Lock/LockInterface.php",
"language": "php",
"file_size": 1828,
"cut_index": 537,
"middle_length": 229
} |
<?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\Lock;
/**
* A non locking lock.
*
* This can be us... | lic function isAcquired(): bool
{
return true;
}
public function release(): void
{
}
public function isExpired(): bool
{
return false;
}
public function getRemainingLifetime(): ?float
{
ret | ool $blocking = false): bool
{
return true;
}
public function acquire(bool $blocking = false): bool
{
return true;
}
public function refresh(?float $ttl = null): void
{
}
pub | {
"filepath": "src/Symfony/Component/Lock/NoLock.php",
"language": "php",
"file_size": 1015,
"cut_index": 512,
"middle_length": 229
} |
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\Lock;
use Symfony\Component\Lock\Exception\LockAcquiringException... | ;
/**
* Removes a resource from the storage.
*
* @throws LockReleasingException
*/
public function delete(Key $key): void;
/**
* Returns whether or not the resource exists in the storage.
*/
public function e | ersistingStoreInterface
{
/**
* Stores the resource if it's not locked by someone else.
*
* @throws LockAcquiringException
* @throws LockConflictedException
*/
public function save(Key $key): void | {
"filepath": "src/Symfony/Component/Lock/PersistingStoreInterface.php",
"language": "php",
"file_size": 1284,
"cut_index": 524,
"middle_length": 229
} |
?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\Lock;
use Symfony\Component\Lock\Exception\LockAcquiri... | ether or not the call should block until the release of the lock.
*
* @throws LockConflictedException If the lock is acquired by someone else in blocking mode
* @throws LockAcquiringException If the lock cannot be acquired
*/
publi | ssé <jeremy@derusse.com>
*/
interface SharedLockInterface extends LockInterface
{
/**
* Acquires the lock for reading. If the lock is acquired by someone else in write mode, the parameter `blocking`
* determines wh | {
"filepath": "src/Symfony/Component/Lock/SharedLockInterface.php",
"language": "php",
"file_size": 1057,
"cut_index": 513,
"middle_length": 229
} |
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\Lock\Serializer;
use Symfony\Component\Lock\Key;
use Symfony\Component\Seriali... | true];
}
/**
* @param Key $data
*/
public function normalize(mixed $data, ?string $format = null, array $context = []): array
{
return $data->__serialize();
}
public function supportsNormalization(mixed $data, ?s | * @author Valtteri R <valtzu@gmail.com>
*/
final class LockKeyNormalizer implements NormalizerInterface, DenormalizerInterface
{
public function getSupportedTypes(?string $format): array
{
return [Key::class => | {
"filepath": "src/Symfony/Component/Lock/Serializer/LockKeyNormalizer.php",
"language": "php",
"file_size": 1558,
"cut_index": 537,
"middle_length": 229
} |
/*
* 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\Lock\Strategy;
/**
* ConsensusStrategy is a StrategyInter... | isMet(int $numberOfSuccess, int $numberOfItems): bool
{
return $numberOfSuccess > ($numberOfItems / 2);
}
public function canBeMet(int $numberOfFailure, int $numberOfItems): bool
{
return $numberOfFailure < ($numberOfItems | blic function | {
"filepath": "src/Symfony/Component/Lock/Strategy/ConsensusStrategy.php",
"language": "php",
"file_size": 804,
"cut_index": 517,
"middle_length": 14
} |
ony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Lock\Strategy;
/**
* StrategyInterface defines an interface to indicate when a quorum is met and can be met.
*
* @author Jérémy Derussé <jeremy@... | be met.
*
* This method does not mean the quorum *would* be met for sure, but can be useful to stop a process early when you
* known there is no chance to meet the quorum.
*/
public function canBeMet(int $numberOfFailure, int $numb | /**
* Returns whether or not the quorum *could* | {
"filepath": "src/Symfony/Component/Lock/Strategy/StrategyInterface.php",
"language": "php",
"file_size": 937,
"cut_index": 606,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Store;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lo... |
use LoggerAwareTrait;
/**
* @param PersistingStoreInterface[] $stores The list of synchronized stores
*
* @throws InvalidArgumentException
*/
public function __construct(
private array $stores,
private Stra | lementation able to manage and synchronize several StoreInterfaces.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class CombinedStore implements SharedLockStoreInterface, LoggerAwareInterface
{
use ExpiringStoreTrait; | {
"filepath": "src/Symfony/Component/Lock/Store/CombinedStore.php",
"language": "php",
"file_size": 6630,
"cut_index": 716,
"middle_length": 229
} |
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\Lock\Store;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Ex... | nitialTtl): void
{
if ($gcProbability < 0 || $gcProbability > 1) {
throw new InvalidArgumentException(\sprintf('"%s" requires gcProbability between 0 and 1, "%f" given.', __METHOD__, $gcProbability));
}
if ($initialT | private string $tokenCol = 'key_token';
private string $expirationCol = 'key_expiration';
private float $gcProbability;
private int $initialTtl;
private function init(array $options, float $gcProbability, int $i | {
"filepath": "src/Symfony/Component/Lock/Store/DatabaseTableTrait.php",
"language": "php",
"file_size": 2467,
"cut_index": 563,
"middle_length": 229
} |
eSQLPlatform;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\DBAL\Tools\DsnParser;
use Symfony\Component\Lock\BlockingSharedLockStoreInterface;
use Symfony\Component\Lock\BlockingStoreInterface;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockC... | te Connection $conn;
/**
* You can either pass an existing database connection a Doctrine DBAL Connection
* or a URL that will be used to connect to the database.
*
* @throws InvalidArgumentException When first argument is not Conn | * PostgreSql advisory locks with a Doctrine DBAL Connection.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class DoctrineDbalPostgreSqlStore implements BlockingSharedLockStoreInterface, BlockingStoreInterface
{
priva | {
"filepath": "src/Symfony/Component/Lock/Store/DoctrineDbalPostgreSqlStore.php",
"language": "php",
"file_size": 9416,
"cut_index": 921,
"middle_length": 229
} |
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 Dumper\ContextProvider;
use PHPUnit\Framework\Attributes\RequiresMethod;
use PHPUnit\Framework\T... | RequestStack();
$provider = new RequestContextProvider($requestStack);
$this->assertNull($provider->getContext());
}
public function testGetContextOnRequest()
{
$request = Request::create('https://example.org/', 'POST' | ntextProvider\RequestContextProvider;
#[RequiresMethod(RequestStack::class, '__construct')]
class RequestContextProviderTest extends TestCase
{
public function testGetContextOnNullRequest()
{
$requestStack = new | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Dumper/ContextProvider/RequestContextProviderTest.php",
"language": "php",
"file_size": 1670,
"cut_index": 537,
"middle_length": 229
} |
nfoCaster', 'castAddressInfo'],
'Socket' => ['Symfony\Component\VarDumper\Caster\SocketCaster', 'castSocket'],
'Symfony\Component\VarDumper\Caster\CutStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\... | 'Symfony\Component\VarDumper\Caster\ScalarStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castScalar'],
'Fiber' => ['Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'],
'Closure' => ['Symfony\Component\VarDumpe | y\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'],
| {
"filepath": "src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php",
"language": "php",
"file_size": 22353,
"cut_index": 1331,
"middle_length": 229
} |
/*
* 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\VarDumper\Cloner;
/**
* Represents the current state of a ... | blic int $softRefHandle = 0;
public int $hardRefTo = 0;
public int $hardRefCount = 0;
public int $hardRefHandle = 0;
public int $hashType;
public string|int|null $hashKey = null;
public bool $hashKeyIsBinary;
public int $hashInd | public const HASH_OBJECT = Stub::TYPE_OBJECT;
public const HASH_RESOURCE = Stub::TYPE_RESOURCE;
public int $depth = 0;
public int $refIndex = 0;
public int $softRefTo = 0;
public int $softRefCount = 0;
pu | {
"filepath": "src/Symfony/Component/VarDumper/Cloner/Cursor.php",
"language": "php",
"file_size": 1173,
"cut_index": 518,
"middle_length": 229
} |
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\VarDumper\Cloner;
/**
* Represents the main properties of a PHP variable.
*
* @author Nicolas Grekas ... | public string|int|null $class = '';
public mixed $value = null;
public int $cut = 0;
public int $handle = 0;
public int $refCount = 0;
public int $position = 0;
public array $attr = [];
/**
* @internal
*/
protecte | RCE = 5;
public const TYPE_SCALAR = 6;
public const STRING_BINARY = 1;
public const STRING_UTF8 = 2;
public const ARRAY_ASSOC = 1;
public const ARRAY_INDEXED = 2;
public int $type = self::TYPE_REF;
| {
"filepath": "src/Symfony/Component/VarDumper/Cloner/Stub.php",
"language": "php",
"file_size": 2189,
"cut_index": 563,
"middle_length": 229
} |
ends AbstractCloner
{
private static array $arrayCache = [];
protected function doClone(mixed $var): array
{
$len = 1; // Length of $queue
$pos = 0; // Number of cloned items past the minimum depth
$refsCounter = 0; // Hard r... | $resRefs = []; // Map of original resource handles to their stub object counterpart
$maxItems = $this->maxItems;
$maxString = $this->maxString;
$minDepth = $this->minDepth;
$currentDepth = 0; | $objRefs = []; // Map of original object handles to their stub object counterpart
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
| {
"filepath": "src/Symfony/Component/VarDumper/Cloner/VarCloner.php",
"language": "php",
"file_size": 10204,
"cut_index": 921,
"middle_length": 229
} |
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\VarDumper\Dumper;
use Symfony\Component\VarDumper\Cloner... | }
public function dump(Data $data): ?string
{
$context = $data->getContext();
foreach ($this->contextProviders as $contextProvider) {
$context[$contextProvider::class] = $contextProvider->getContext();
}
| mperInterface
{
/**
* @param ContextProviderInterface[] $contextProviders
*/
public function __construct(
private DataDumperInterface $wrappedDumper,
private array $contextProviders,
) {
| {
"filepath": "src/Symfony/Component/VarDumper/Dumper/ContextualizedDumper.php",
"language": "php",
"file_size": 1077,
"cut_index": 515,
"middle_length": 229
} |
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\VarDumper\Dumper;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Com... | ost
* @param DataDumperInterface|null $wrappedDumper A wrapped instance used whenever we failed contacting the server
* @param ContextProviderInterface[] $contextProviders Context providers indexed by context name
*/
public function | thor Maxime Steinhausser <maxime.steinhausser@gmail.com>
*/
class ServerDumper implements DataDumperInterface
{
private Connection $connection;
/**
* @param string $host The server h | {
"filepath": "src/Symfony/Component/VarDumper/Dumper/ServerDumper.php",
"language": "php",
"file_size": 1578,
"cut_index": 537,
"middle_length": 229
} |
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\VarDumper\Dumper\ContextProvider;
use Symfony\Component\HttpFound... | Stack,
) {
$this->cloner = new VarCloner();
$this->cloner->setMaxItems(0);
$this->cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO);
}
public function getContext(): ?array
{
if (null === $request | xime Steinhausser <maxime.steinhausser@gmail.com>
*/
final class RequestContextProvider implements ContextProviderInterface
{
private VarCloner $cloner;
public function __construct(
private RequestStack $request | {
"filepath": "src/Symfony/Component/VarDumper/Dumper/ContextProvider/RequestContextProvider.php",
"language": "php",
"file_size": 1479,
"cut_index": 524,
"middle_length": 229
} |
/*
* 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\VarDumper\Tests\Command;
use PHPUnit\Framework\Attributes\D... | ommandCompletionTester($this->createCommand());
$this->assertSame($expectedSuggestions, $tester->complete($input));
}
public static function provideCompletionSuggestions()
{
yield 'option --format' => [
['--format' | umper\Server\DumpServer;
class ServerDumpCommandTest extends TestCase
{
#[DataProvider('provideCompletionSuggestions')]
public function testComplete(array $input, array $expectedSuggestions)
{
$tester = new C | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Command/ServerDumpCommandTest.php",
"language": "php",
"file_size": 1203,
"cut_index": 518,
"middle_length": 229
} |
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\VarDumper\Tests\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Cloner\Stub;
use S... | owMany; ++$i) {
$expected .= <<<EODUMP
$i => array:4 [
0 => "a"
1 => "b"
2 => "c"
3 => "d"
]\n
EODUMP;
} | unction testItComparesLargeData()
{
$howMany = 700;
$data = array_fill_keys(range(0, $howMany), ['a', 'b', 'c', 'd']);
$expected = \sprintf("array:%d [\n", $howMany + 1);
for ($i = 0; $i <= $h | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitTest.php",
"language": "php",
"file_size": 2374,
"cut_index": 563,
"middle_length": 229
} |
se;
use Symfony\Component\VarDumper\Caster\ClassDumpStub;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Caster\CutStub;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\Va... | e VarDumperTestTrait;
public function testGet()
{
require __DIR__.'/../Fixtures/dumb-var.php';
$dumper = new CliDumper('php://output');
$dumper->setColors(false);
$cloner = new VarCloner();
$cloner->addCast | ringFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\VirtualProperty;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class CliDumperTest extends TestCase
{
us | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php",
"language": "php",
"file_size": 16244,
"cut_index": 921,
"middle_length": 229
} |
ception\FlattenException;
use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ExceptionCaster;
use Symfony\Component\VarDumper\Caster\FrameStub;
use Symfony\Component\VarDumper\Caster\TraceStub;
use Symfony\Component\Va... | private function getTestErrorException($msg): \ErrorException
{
return new \ErrorException(''.$msg);
}
private function getTestSilencedErrorContext(): SilencedErrorContext
{
return new SilencedErrorContext(\E_ERROR, __FILE_ | umperTestTrait;
private function getTestException($msg, &$ref = null)
{
return new \Exception(''.$msg);
}
private function getTestError($msg): \Error
{
return new \Error(''.$msg);
}
| {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/ExceptionCasterTest.php",
"language": "php",
"file_size": 13069,
"cut_index": 921,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\Requires... | $gmp = gmp_init('01101');
$gmpDump = <<<EODUMP
array:1 [
"\\x00~\\x00value" => %s
]
EODUMP;
$this->assertDumpEquals(\sprintf($gmpDump, $gmpString), GmpCaster::castGmp($gmpString, [], new | rait;
class GmpCasterTest extends TestCase
{
use VarDumperTestTrait;
#[RequiresPhpExtension('gmp')]
public function testCastGmp()
{
$gmpString = gmp_init('1234');
$gmpOctal = gmp_init(0o10);
| {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/GmpCasterTest.php",
"language": "php",
"file_size": 1421,
"cut_index": 524,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\TestCase;
use Symfony\Component\VarDumper\Test\VarDumperTe... | var->addServer('127.0.0.2', 11212);
$expected = <<<EOTXT
Memcached {
servers: array:2 [
0 => array:3 [
"host" => "127.0.0.1"
"port" => 11211
"type" => | aultOptions()
{
if (!class_exists(\Memcached::class)) {
$this->markTestSkipped('Memcached not available');
}
$var = new \Memcached();
$var->addServer('127.0.0.1', 11211);
$ | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/MemcachedCasterTest.php",
"language": "php",
"file_size": 2639,
"cut_index": 563,
"middle_length": 229
} |
s\ReflectionIntersectionTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionNamedTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionUnionTypeFixture;
use Symfony\Component\VarDumper\Tests\Fixtures\ReflectionUnionTypeWithIntersectionFixture;
/**
* @author Nicolas Grekas <p@tchwork.... | nts: array:%d [
0 => ReflectionClassConstant {
+name: "IS_IMPLICIT_ABSTRACT"
+class: "ReflectionClass"
modifiers: "public"
value: 16
| );
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionClass {
+name: "ReflectionClass"
%Aimplements: array:%d [
%A]
consta | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php",
"language": "php",
"file_size": 20792,
"cut_index": 1331,
"middle_length": 229
} |
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\VarDumper\Test;
use PHPUnit\Framework\Attributes\After;
use Symfony\Component\VarDumper\Cloner\VarCloner... | s->varDumperConfig['casters'] = $casters;
$this->varDumperConfig['flags'] = $flags;
}
/**
* @after
*/
#[After]
protected function tearDownVarDumper(): void
{
$this->varDumperConfig['casters'] = [];
$th | onfig = [
'casters' => [],
'flags' => null,
];
/**
* @param array<string, callable> $casters
*/
protected function setUpVarDumper(array $casters, ?int $flags = null): void
{
$thi | {
"filepath": "src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php",
"language": "php",
"file_size": 2747,
"cut_index": 563,
"middle_length": 229
} |
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\VarDumper\Cloner;
/**
* DumperInterface used by Data objects.
*
* @author N... | has been cut by
*/
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut): void;
/**
* Dumps while entering an hash.
*
* @param int $type A Cursor::HASH_* const for the type of hash
* | ll $value): void;
/**
* Dumps a string.
*
* @param string $str The string being dumped
* @param bool $bin Whether $str is UTF-8 or binary encoded
* @param int $cut The number of characters $str | {
"filepath": "src/Symfony/Component/VarDumper/Cloner/DumperInterface.php",
"language": "php",
"file_size": 1808,
"cut_index": 537,
"middle_length": 229
} |
styles = [
// See http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
'default' => '0;38;5;208',
'num' => '1;38;5;38',
'const' => '1;38;5;208',
'virtual' => '3',
'str' => '1;38;5;113',
'note' => '38;5;38',
'ref' => '38;5;247',
'public' => '39',
... | ed static string $unicodeCharsRx = "/[\u{00A0}\u{00AD}\u{034F}\u{061C}\u{115F}\u{1160}\u{17B4}\u{17B5}\u{180E}\u{2000}-\u{200F}\u{202F}\u{205F}\u{2060}-\u{2064}\u{206A}-\u{206F}\u{3000}\u{2800}\u{3164}\u{FEFF}\u{FFA0}\u{1D159}\u{1D173}-\u{1D17A}]/u";
| rsRx = '/[\x00-\x1F\x7F]+/';
protected static array $controlCharsMap = [
"\t" => '\t',
"\n" => '\n',
"\v" => '\v',
"\f" => '\f',
"\r" => '\r',
"\033" => '\e',
];
protect | {
"filepath": "src/Symfony/Component/VarDumper/Dumper/CliDumper.php",
"language": "php",
"file_size": 23773,
"cut_index": 1331,
"middle_length": 229
} |
s 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\VarDumper\Dumper\ContextProvider;
/**
* Tries to provide context on CLI.
*
... | PHP_SAPI) {
return null;
}
return [
'command_line' => $commandLine = implode(' ', $_SERVER['argv'] ?? []),
'identifier' => hash('xxh128', $commandLine.'@'.$_SERVER['REQUEST_TIME_FLOAT']),
];
| f ('cli' !== \ | {
"filepath": "src/Symfony/Component/VarDumper/Dumper/ContextProvider/CliContextProvider.php",
"language": "php",
"file_size": 810,
"cut_index": 536,
"middle_length": 14
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Command\Descriptor;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Command\Desc... | MULATOR');
putenv('TERMINAL_EMULATOR');
}
public static function tearDownAfterClass(): void
{
date_default_timezone_set(self::$timezone);
putenv('TERMINAL_EMULATOR'.(self::$prevTerminalEmulator ? '='.self::$prevTerminal | rminalEmulator;
public static function setUpBeforeClass(): void
{
self::$timezone = date_default_timezone_get();
date_default_timezone_set('UTC');
self::$prevTerminalEmulator = getenv('TERMINAL_E | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php",
"language": "php",
"file_size": 6224,
"cut_index": 716,
"middle_length": 229
} |
/*
* 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\VarDumper\Tests\Cloner;
use PHPUnit\Framework\TestCase;
use... | $stub = unserialize(serialize($stub));
self::assertNull($stub->myProp);
}
public function testUninitializedStubPropertiesAreLeftUninitialized()
{
$stub = new MyStub();
$stub = unserialize(serialize($stub));
$ |
$stub = unserialize(serialize($stub));
self::assertNull($stub->value);
}
public function testUnserializeNullInTypedProperty()
{
$stub = new MyStub();
$stub->myProp = null;
| {
"filepath": "src/Symfony/Component/VarDumper/Tests/Cloner/StubTest.php",
"language": "php",
"file_size": 1181,
"cut_index": 518,
"middle_length": 229
} |
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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\Tes... | public function testCastPdo()
{
$pdo = new \PDO('sqlite::memory:');
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, ['PDOStatement', [$pdo]]);
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$cast = Pd | er\Stub;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class PdoCasterTest extends TestCase
{
use VarDumperTestTrait;
#[RequiresPhpExtension('pdo_sqlite')]
| {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/PdoCasterTest.php",
"language": "php",
"file_size": 2183,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Dumper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\PhpProcess;
use Symfony\Component\Process\Process;
use Symfony\Compon... | $wrappedDumper = $this->createMock(DataDumperInterface::class);
$dumper = new ServerDumper(self::VAR_DUMPER_SERVER, $wrappedDumper);
$cloner = new VarCloner();
$data = $cloner->cloneVar('foo');
$wrappedDumper->expects($ | nt\VarDumper\Dumper\ServerDumper;
class ServerDumperTest extends TestCase
{
private const VAR_DUMPER_SERVER = 'tcp://127.0.0.1:9913';
public function testDumpForwardsToWrappedDumperWhenServerIsUnavailable()
{
| {
"filepath": "src/Symfony/Component/VarDumper/Tests/Dumper/ServerDumperTest.php",
"language": "php",
"file_size": 3070,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Dumper;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Cloner\DumperInterface;
/**
* Abstract mechanism for dumping a Data object.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
abstract class AbstractDumper imple... | null */
protected $outputStream;
protected string $decimalPoint = '.';
protected string $indentPad = ' ';
private string $charset = '';
/**
* @param callable|resource|string|null $output A line dumper callable, an opened stream | AILING_COMMA = 8;
/** @var callable|resource|string|null */
public static $defaultOutput = 'php://output';
protected string $line = '';
/** @var callable|null */
protected $lineDumper;
/** @var resource| | {
"filepath": "src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php",
"language": "php",
"file_size": 7166,
"cut_index": 716,
"middle_length": 229
} |
/*
* 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\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\Re... | ES ("baz")');
$stmt = $db->prepare('SELECT id, bar FROM foo');
$result = $stmt->execute();
$this->assertDumpMatchesFormat(
<<<'EODUMP'
SQLite3Result {
columnNames: array:2 [
| se VarDumperTestTrait;
public function testSqlite3Result()
{
$db = new \SQLite3(':memory:');
$db->exec('CREATE TABLE foo (id INTEGER PRIMARY KEY, bar TEXT)');
$db->exec('INSERT INTO foo (bar) VALU | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/SqliteCasterTest.php",
"language": "php",
"file_size": 1154,
"cut_index": 518,
"middle_length": 229
} |
Caster;
use Symfony\Component\VarDumper\Caster\DateCaster;
use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
use Symfony\Component\VarDumper\Tests\Fixtures\DateTimeChild;
/**
* @author Dany Maillard <danymaillard93b@gmail.com>
*/
class DateCasterTest extends TestCa... | s)
{
$date = new \DateTime($time, new \DateTimeZone($timezone));
$xDump = <<<EODUMP
DateTime @$xTimestamp {
date: $xDate
}
EODUMP;
$this->assertDumpEquals($xDump, $date);
} | otected function tearDown(): void
{
date_default_timezone_set($this->previousTimezone);
}
#[DataProvider('provideDateTimes')]
public function testDumpDateTime($time, $timezone, $xDate, $xTimestamp, $xInfo | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php",
"language": "php",
"file_size": 17201,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\VarDumper\Tests\Caster;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use RdKafka\Conf;
use RdKafka\KafkaConsumer;
use RdKafka\Producer;
use RdKafka\TopicConf;
use Symfony\Comp... | R')) {
$this->broker = getenv('KAFKA_BROKER');
$this->hasBroker = true;
}
}
public function testDumpConf()
{
$conf = new Conf();
$conf->setErrorCb(static function ($kafka, $err, $reason) {});
| OPIC = 'test-topic';
private const GROUP_ID = 'test-group-id';
private bool $hasBroker = false;
private string $broker;
protected function setUp(): void
{
if (!$this->hasBroker && getenv('KAFKA_BROKE | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/RdKafkaCasterTest.php",
"language": "php",
"file_size": 6516,
"cut_index": 716,
"middle_length": 229
} |
las, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all',
'num' => 'font-weight:bold; color:#1299DA',
'const' => 'font-weight:bold',
'virtual' => 'font-style:italic',
'str' => 'font-weight:bold; color:#629755;'... | ];
protected ?string $dumpHeader = null;
protected string $dumpPrefix = '<pre class=sf-dump id=%s data-indent-pad="%s">';
protected string $dumpSuffix = '</pre><script>Sfdump(%s)</script>';
protected string $dumpId;
protected bool $co | lor:#262626',
'meta' => 'color:#B729D9',
'key' => 'color:#789339',
'index' => 'color:#1299DA',
'ellipsis' => 'color:#CC7832',
'ns' => 'user-select:none;',
],
| {
"filepath": "src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php",
"language": "php",
"file_size": 43240,
"cut_index": 2151,
"middle_length": 229
} |
ework\TestCase;
use Symfony\Component\VarDumper\Caster\FFICaster;
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
/**
* @author Kirill Nesmeyanov <nesk@xakep.ru>
*/
#[RequiresPhpExtension('ffi')]
class FFICasterTest extends TestCase
{
use VarDumperTestTrait;
/**
* @see FFICaster::MAX_STRING_LE... | nymousStruct()
{
$this->assertDumpEquals(<<<'PHP'
FFI\CData<struct <anonymous>> size 4 align 4 {
uint32_t x: 0
}
PHP,
\FFI::cdef()->new('struct { uint32_t x; }')
);
}
| ble')) {
return;
}
if (!filter_var(\ini_get('ffi.enable'), \FILTER_VALIDATE_BOOL)) {
$this->markTestSkipped('FFI not enabled for CLI SAPI');
}
}
public function testCastAno | {
"filepath": "src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php",
"language": "php",
"file_size": 14971,
"cut_index": 921,
"middle_length": 229
} |
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
{
private array $data;
private int $position = 0;
private int|string $key = 0;
private int $maxDepth = 20;
private int $maxItemsPerDepth = -1;
private int $useRefHa... |
$item = $item->value;
}
if (!$item instanceof Stub) {
return \gettype($item);
}
if (Stub::TYPE_STRING === $item->type) {
return 'string';
}
if (Stub::TYPE_ARRAY === $item- | $this->data = $data;
}
public function getType(): ?string
{
$item = $this->data[$this->position][$this->key];
if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) { | {
"filepath": "src/Symfony/Component/VarDumper/Cloner/Data.php",
"language": "php",
"file_size": 13658,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Store;
use AsyncAws\DynamoDb\DynamoDbClient;
use Doctrine\DBAL\Connection;
use Relay\Relay;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Lock\Bridge\DynamoDb\Store\DynamoDbStore;
use Symfony\Component\Lock\Exception\Invali... | ::requireBridgeClass(DynamoDbStore::class, 'symfony/amazon-dynamo-db-lock');
return new DynamoDbStore($connection);
case $connection instanceof \Redis:
case $connection instanceof Relay:
case $connectio | ctory
{
public static function createStore(#[\SensitiveParameter] object|string $connection): PersistingStoreInterface
{
switch (true) {
case $connection instanceof DynamoDbClient:
self | {
"filepath": "src/Symfony/Component/Lock/Store/StoreFactory.php",
"language": "php",
"file_size": 5871,
"cut_index": 716,
"middle_length": 229
} |
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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Group;
#[Group('integration')]
class PredisStoreWithExceptionsTest exte... | >connect();
} catch (\Exception $e) {
self::markTestSkipped($e->getMessage());
}
}
protected function getRedisConnection(): \Predis\Client
{
$redis = new \Predis\Client(array_combine(['host', 'port'], explod | ) + [1 => null]));
try {
$redis- | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/PredisStoreWithExceptionsTest.php",
"language": "php",
"file_size": 995,
"cut_index": 582,
"middle_length": 52
} |
/*
* 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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Group;
... | edis->connect();
} catch (\Exception $e) {
self::markTestSkipped($e->getMessage());
}
}
protected function getRedisConnection(): \Predis\Client
{
$redis = new \Predis\Client(
array_combine(['host | eClass(): void
{
$redis = new \Predis\Client(
array_combine(['host', 'port'], explode(':', getenv('REDIS_HOST')) + [1 => null]),
['exceptions' => false],
);
try {
$r | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/PredisStoreWithoutExceptionsTest.php",
"language": "php",
"file_size": 1176,
"cut_index": 518,
"middle_length": 229
} |
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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Group... |
try {
(new \Redis())->connect(...explode(':', getenv('REDIS_HOST')));
} catch (\Exception $e) {
self::markTestSkipped($e->getMessage());
}
}
protected function getRedisConnection(): \RedisArray
| est extends AbstractRedisStoreTestCase
{
public static function setUpBeforeClass(): void
{
if (!class_exists(\RedisArray::class)) {
self::markTestSkipped('The RedisArray class is required.');
} | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/RedisArrayStoreTest.php",
"language": "php",
"file_size": 1095,
"cut_index": 515,
"middle_length": 229
} |
?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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Gro... | }
if (!getenv('REDIS_CLUSTER_HOSTS')) {
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}
}
protected function getRedisConnection(): \RedisCluster
{
return new \RedisCluster(null | oreTest extends AbstractRedisStoreTestCase
{
public static function setUpBeforeClass(): void
{
if (!class_exists(\RedisCluster::class)) {
self::markTestSkipped('The RedisCluster class is required.');
| {
"filepath": "src/Symfony/Component/Lock/Tests/Store/RedisClusterStoreTest.php",
"language": "php",
"file_size": 1057,
"cut_index": 513,
"middle_length": 229
} |
he 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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Fra... | public function testCreateStore()
{
if (!class_exists(RedisProxy::class)) {
$this->markTestSkipped();
}
$store = StoreFactory::createStore($this->createStub(RedisProxy::class));
$this->assertInstanceOf(Re | ass RedisProxyStoreFactoryTest extends TestCase
{
| {
"filepath": "src/Symfony/Component/Lock/Tests/Store/RedisProxyStoreFactoryTest.php",
"language": "php",
"file_size": 889,
"cut_index": 547,
"middle_length": 52
} |
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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Group;
use PHP... | try {
(new \Redis())->connect(...explode(':', getenv('REDIS_HOST')));
} catch (\Exception $e) {
self::markTestSkipped($e->getMessage());
}
}
protected function getRedisConnection(): \Redis
{
$r | russe.com>
*/
#[RequiresPhpExtension('redis')]
#[Group('integration')]
class RedisStoreTest extends AbstractRedisStoreTestCase
{
use SharedLockStoreTestTrait;
public static function setUpBeforeClass(): void
{
| {
"filepath": "src/Symfony/Component/Lock/Tests/Store/RedisStoreTest.php",
"language": "php",
"file_size": 1296,
"cut_index": 524,
"middle_length": 229
} |
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 Store;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Req... | Cluster->flushdb($hostAndPort);
}
}
public static function setUpBeforeClass(): void
{
if (!class_exists(RelayCluster::class)) {
self::markTestSkipped('The Relay\Cluster class is required.');
}
if (f | usterStoreTest extends AbstractRedisStoreTestCase
{
protected function setUp(): void
{
$relayCluster = $this->getRedisConnection();
foreach ($relayCluster->_masters() as $hostAndPort) {
$relay | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/RelayClusterStoreTest.php",
"language": "php",
"file_size": 1306,
"cut_index": 524,
"middle_length": 229
} |
<?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 Store;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\At... | lay(...explode(':', getenv('REDIS_HOST')));
} catch (\Relay\Exception $e) {
self::markTestSkipped($e->getMessage());
}
}
protected function getRedisConnection(): Relay
{
return new Relay(...explode(':', gete | hpExtension('relay')]
#[Group('integration')]
class RelayStoreTest extends AbstractRedisStoreTestCase
{
use SharedLockStoreTestTrait;
public static function setUpBeforeClass(): void
{
try {
new Re | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/RelayStoreTest.php",
"language": "php",
"file_size": 1025,
"cut_index": 512,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Componen... | sistingStoreInterface
{
return new SemaphoreStore();
}
public function testResourceRemoval()
{
$initialCount = $this->getOpenedSemaphores();
$store = new SemaphoreStore();
$key = new Key(__METHOD__);
| Derussé <jeremy@derusse.com>
*/
#[RequiresPhpExtension('sysvsem')]
class SemaphoreStoreTest extends AbstractStoreTestCase
{
use BlockingStoreTestTrait;
use UnserializableTestTrait;
protected function getStore(): Per | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php",
"language": "php",
"file_size": 3570,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Tests\Store;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\Test\AbstractStoreTestCase;
/**
* @author Jérémy Derussé <jerem... | $this->assertTrue($store->exists($key1));
$this->assertFalse($store->exists($key2));
$this->assertFalse($store->exists($key3));
// assert we can store multiple keys in read mode
$store->saveRead($key2);
$this- | lic function testSharedLockReadFirst()
{
$store = $this->getStore();
$key1 = new Key(__METHOD__);
$key2 = new Key(__METHOD__);
$key3 = new Key(__METHOD__);
$store->saveRead($key1);
| {
"filepath": "src/Symfony/Component/Lock/Tests/Store/SharedLockStoreTestTrait.php",
"language": "php",
"file_size": 5179,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Lock\Tests\Store;
use AsyncAws\DynamoDb\DynamoDbClient;
use Doctrine\DBAL\Connection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\... | \Store\InMemoryStore;
use Symfony\Component\Lock\Store\MemcachedStore;
use Symfony\Component\Lock\Store\NullStore;
use Symfony\Component\Lock\Store\PdoStore;
use Symfony\Component\Lock\Store\PostgreSqlStore;
use Symfony\Component\Lock\Store\RedisStore;
use | t\Lock\Bridge\DynamoDb\Store\DynamoDbStore;
use Symfony\Component\Lock\Store\DoctrineDbalPostgreSqlStore;
use Symfony\Component\Lock\Store\DoctrineDbalStore;
use Symfony\Component\Lock\Store\FlockStore;
use Symfony\Component\Lock | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php",
"language": "php",
"file_size": 5084,
"cut_index": 614,
"middle_length": 229
} |
<?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\Lock\Tests\Store;
use Symfony\Component\Lock\Exceptio... | alizableKey()
{
$store = $this->getStore();
$key = new Key(__METHOD__);
$store->save($key);
$this->assertTrue($store->exists($key));
$this->expectException(UnserializableKeyException::class);
serialize | Derussé <jeremy@derusse.com>
*/
trait UnserializableTestTrait
{
/**
* @see AbstractStoreTestCase::getStore()
*/
abstract protected function getStore(): PersistingStoreInterface;
public function testUnseri | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/UnserializableTestTrait.php",
"language": "php",
"file_size": 1016,
"cut_index": 512,
"middle_length": 229
} |
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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\RequiresPhpExt... |
$this->assertInstanceOf(ZookeeperStore::class, $store);
}
public function testCreateZooKeeperStoreAsDsn()
{
$store = StoreFactory::createStore('zookeeper://localhost:2181');
$this->assertInstanceOf(ZookeeperStore::cl | m>
*/
#[RequiresPhpExtension('zookeeper')]
class ZookeeperStoreFactoryTest extends TestCase
{
public function testCreateZooKeeperStore()
{
$store = StoreFactory::createStore($this->createStub(\Zookeeper::class)); | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/ZookeeperStoreFactoryTest.php",
"language": "php",
"file_size": 1261,
"cut_index": 524,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.