prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
on _pack($value): string { return $this->initializeLazyObject()->_pack(...\func_get_args()); } public function _prefix($value): string { return $this->initializeLazyObject()->_prefix(...\func_get_args()); } public function _serialize($value): string { return $this->...
zeLazyObject()->_unserialize(...\func_get_args()); } public function acl($key_or_address, $operation, ...$args): mixed { return $this->initializeLazyObject()->acl(...\func_get_args()); } public function addAllowPatterns(...$pa
s()); } public function _unpack($value): mixed { return $this->initializeLazyObject()->_unpack(...\func_get_args()); } public function _unserialize($value): mixed { return $this->initiali
{ "filepath": "src/Symfony/Component/Cache/Traits/RelayClusterProxy.php", "language": "php", "file_size": 44183, "cut_index": 2151, "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\Cache\Traits\Relay; if (version_compare(phpversion('relay')...
c function digest($key): \Relay\Relay|false|string|null { return $this->initializeLazyObject()->digest(...\func_get_args()); } public function msetex($kvals, $ttl = null): \Relay\Relay|false|int { re
digest(...\func_get_args()); } public function delex($key, $options = null): \Relay\Relay|false|int { return $this->initializeLazyObject()->delex(...\func_get_args()); } publi
{ "filepath": "src/Symfony/Component/Cache/Traits/Relay/Relay20Trait.php", "language": "php", "file_size": 1162, "cut_index": 518, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Cache\Adapter; use Symfony\Component\Cache\Marshaller\MarshallerInterface; use Symfony\Component\Cache\Marshaller\TagAwareMarshaller; use Symfony\Component\Cache\PruneableInterface; use Symfony\Component\Cache\Traits\FilesystemTrait; /** * Stores tag id <...
/** * Folder used for tag symlinks. */ private const TAG_FOLDER = 'tags'; public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null) {
emTagAwareAdapter extends AbstractTagAwareAdapter implements PruneableInterface { use FilesystemTrait { prune as private doPrune; doClear as private doClearCache; doSave as private doSaveCache; }
{ "filepath": "src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php", "language": "php", "file_size": 8987, "cut_index": 716, "middle_length": 229 }
ymfony\Component\Cache\Marshaller\MarshallerInterface; use Symfony\Component\Cache\PruneableInterface; class PdoAdapter extends AbstractAdapter implements PruneableInterface { private const MAX_KEY_LENGTH = 255; private MarshallerInterface $marshaller; private \PDO $conn; private string $dsn; priv...
e; /** * You can either pass an existing database connection as PDO instance or * a DSN string that will be used to lazy-connect to the database when the * cache is actually used. * * List of available options: * * db_ta
string $lifetimeCol = 'item_lifetime'; private string $timeCol = 'item_time'; private ?string $username = null; private ?string $password = null; private array $connectionOptions = []; private string $namespac
{ "filepath": "src/Symfony/Component/Cache/Adapter/PdoAdapter.php", "language": "php", "file_size": 17252, "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 Symfony\Component\Cache\Adapter; use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache...
t $miss; public function __construct(CacheInterface $pool, string $namespace = '', int $defaultLifetime = 0) { parent::__construct($namespace, $defaultLifetime); $this->pool = $pool; $this->miss = new \stdClass(); }
<p@tchwork.com> */ class Psr16Adapter extends AbstractAdapter implements PruneableInterface, ResettableInterface { use ProxyTrait; /** * @internal */ protected const NS_SEPARATOR = '_'; private objec
{ "filepath": "src/Symfony/Component/Cache/Adapter/Psr16Adapter.php", "language": "php", "file_size": 1763, "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\Cache\Adapter; use Symfony\Contracts\Cache\TagAwareCac...
isabled?->__invoke()) { return $this->pool->invalidateTags($tags); } $event = $this->start(__FUNCTION__); try { return $event->result = $this->pool->invalidateTags($tags); } finally { $eve
public function __construct(TagAwareAdapterInterface $pool, ?\Closure $disabled = null) { parent::__construct($pool, $disabled); } public function invalidateTags(array $tags): bool { if ($this->d
{ "filepath": "src/Symfony/Component/Cache/Adapter/TraceableTagAwareAdapter.php", "language": "php", "file_size": 1043, "cut_index": 513, "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\Cache\Traits; use Symfony\Component\Cache\Exception\CacheException; use Symfony\Component\Cache\Marshall...
le, 'r')) { continue; } if (($expiresAt = (int) fgets($h)) && $time >= $expiresAt) { fclose($h); $pruned = (@unlink($file) || !file_exists($file)) && $pruned; } else {
private MarshallerInterface $marshaller; public function prune(): bool { $time = time(); $pruned = true; foreach ($this->scanHashDir($this->directory) as $file) { if (!$h = @fopen($fi
{ "filepath": "src/Symfony/Component/Cache/Traits/FilesystemTrait.php", "language": "php", "file_size": 2968, "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\Cache\Traits; if (version_compare(phpversion('redis'), '6.2...
t()->expirememberat(...\func_get_args()); } public function getdel($key): mixed { return $this->initializeLazyObject()->getdel(...\func_get_args()); } public function getWithMeta($key): \RedisCluster|ar
return $this->initializeLazyObject()->expiremember(...\func_get_args()); } public function expirememberat($key, $field, $timestamp): \Redis|false|int { return $this->initializeLazyObjec
{ "filepath": "src/Symfony/Component/Cache/Traits/RedisCluster62ProxyTrait.php", "language": "php", "file_size": 1214, "cut_index": 518, "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\Cache\Traits; /** * @internal */ trait RedisProxyTrait { ...
zyObjectInitialized(bool $partial = false): bool { return isset($this->realInstance); } public function initializeLazyObject(): object { return $this->realInstance ??= ($this->initializer)(); } public function rese
nstance ??= (new \ReflectionClass(static::class))->newInstanceWithoutConstructor(); $instance->realInstance = null; $instance->initializer = $initializer; return $instance; } public function isLa
{ "filepath": "src/Symfony/Component/Cache/Traits/RedisProxyTrait.php", "language": "php", "file_size": 1141, "cut_index": 518, "middle_length": 229 }
public function _prefix($value): string { return $this->initializeLazyObject()->_prefix(...\func_get_args()); } public function _serialize($value): mixed { return $this->initializeLazyObject()->_serialize(...\func_get_args()); } public function _uncompress($value): string ...
return $this->initializeLazyObject()->acl(...\func_get_args()); } public function addAllowPatterns(...$pattern): int { return $this->initializeLazyObject()->addAllowPatterns(...\func_get_args()); } public function addIgno
k(...\func_get_args()); } public function _unserialize($value): mixed { return $this->initializeLazyObject()->_unserialize(...\func_get_args()); } public function acl($cmd, ...$args): mixed {
{ "filepath": "src/Symfony/Component/Cache/Traits/RelayProxy.php", "language": "php", "file_size": 56562, "cut_index": 2151, "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\Cache\Adapter; use Psr\Cache\CacheItemInterface; use Symfony\Component\Cache\CacheItem; use Symfony\Cont...
ion ($key) { $item = new CacheItem(); $item->isTaggable = true; $item->key = $key; $item->isHit = false; return $item; }, null, CacheItem::
acheInterface, NamespacedPoolInterface, TagAwareAdapterInterface { private static \Closure $createCacheItem; public function __construct() { self::$createCacheItem ??= \Closure::bind( static funct
{ "filepath": "src/Symfony/Component/Cache/Adapter/NullAdapter.php", "language": "php", "file_size": 2657, "cut_index": 563, "middle_length": 229 }
wareTrait; use Symfony\Component\Cache\CacheItem; use Symfony\Component\Cache\Exception\BadMethodCallException; use Symfony\Component\Cache\PruneableInterface; use Symfony\Component\Cache\ResettableInterface; use Symfony\Component\Cache\Traits\ContractsTrait; use Symfony\Contracts\Cache\NamespacedPoolInterface; use Sym...
by deleting tags, thereby ensuring that their versions change even when the * storage is out of space. When versions of non-existing tags are requested for item commits, this adapter assigns a * new random version to them. * * @author Nicolas Grekas <p
r each tags. When saving an item, it is stored together with its tags and * their corresponding versions. When retrieving an item, those tag versions are compared to the current version of * each tags. Invalidation is achieved
{ "filepath": "src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php", "language": "php", "file_size": 12282, "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\Cache\Traits; if (version_compare(phpversion('redis'), '6.2.0', '...
mberat(...\func_get_args()); } public function getWithMeta($key): \Redis|array|false { return $this->initializeLazyObject()->getWithMeta(...\func_get_args()); } public function serverName(): false|strin
$this->initializeLazyObject()->expiremember(...\func_get_args()); } public function expirememberat($key, $field, $timestamp): \Redis|false|int { return $this->initializeLazyObject()->expireme
{ "filepath": "src/Symfony/Component/Cache/Traits/Redis62ProxyTrait.php", "language": "php", "file_size": 1365, "cut_index": 524, "middle_length": 229 }
'dbindex' => 0, 'failover' => 'none', 'ssl' => null, // see https://php.net/context.ssl ]; private \Redis|Relay|RelayCluster|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis; private MarshallerInterface $marshaller; private function init(\Redis|Relay|RelayCluster|\RedisA...
0])); } if ($redis instanceof \Predis\ClientInterface && $redis->getOptions()->exceptions) { $options = clone $redis->getOptions(); \Closure::bind(function () { $this->options['exceptions'] = false; }, $options, $op
me); if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { throw new InvalidArgumentException(\sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[
{ "filepath": "src/Symfony/Component/Cache/Traits/RedisTrait.php", "language": "php", "file_size": 35974, "cut_index": 2151, "middle_length": 229 }
ny\Component\Cache\PruneableInterface; use Symfony\Component\Cache\Traits\CachedValueInterface; use Symfony\Component\Cache\Traits\FilesystemCommonTrait; use Symfony\Component\VarExporter\VarExporter; /** * @author Piotr Stankowski <git@trakos.pl> * @author Nicolas Grekas <p@tchwork.com> * @author Rob Frawley 2nd <...
am bool $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire. * Doing so is encouraged because it fits perfectly OPcache's memory model. * * @throws InvalidArgumentExcept
vate doCommonDelete; } private \Closure $includeHandler; private array $values = []; private array $files = []; private static int $startTime; private static array $valuesCache = []; /** * @par
{ "filepath": "src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php", "language": "php", "file_size": 10635, "cut_index": 921, "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\Cache\Traits; use Psr\Log\LoggerInterface; use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\CacheItem; use Symfony\Compone...
array $computing = []; /** * Wraps the callback passed to ->get() in a callable. * * @return callable the previous callback wrapper */ public function setCallbackWrapper(?callable $callbackWrapper): callable { if (
\Cache\ItemInterface; /** * @author Nicolas Grekas <p@tchwork.com> * * @internal */ trait ContractsTrait { use CacheTrait { doGet as private contractsGet; } private \Closure $callbackWrapper; private
{ "filepath": "src/Symfony/Component/Cache/Traits/ContractsTrait.php", "language": "php", "file_size": 4123, "cut_index": 614, "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\Cache\Traits\Relay; if (version_compare(phpversion('relay'), '0.21.0', '>=')) { /** ...
t_args()); } public function hotkeys($subcmd, $args = null): \Relay\Relay|array|bool { return $this->initializeLazyObject()->hotkeys(...\func_get_args()); } } } else { /** * @internal */ tr
turn $this->initializeLazyObject()->gcra(...\func_ge
{ "filepath": "src/Symfony/Component/Cache/Traits/Relay/Relay21Trait.php", "language": "php", "file_size": 886, "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\Cache\Traits; /** * This file acts as a wrapper to the \Re...
onstruct( private array $host, private \RedisCluster $redis, ) { } public function __call(string $method, array $args) { return $this->redis->{$method}($this->host, ...$args); } public function scan(&$iIter
cording to https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#directed-node-commands * * @author Jack Thomas <jack.thomas@solidalpha.com> * * @internal */ class RedisClusterNodeProxy { public function __c
{ "filepath": "src/Symfony/Component/Cache/Traits/RedisClusterNodeProxy.php", "language": "php", "file_size": 1238, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use Psr\Cache\CacheItemInterface; use Psr\C...
not.', 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.', 'testPrune' => 'ProxyAdapter just proxies', 'testClearWithInvalidPrefix' => 'Inner ArrayAdapter does not validate the prefix.', ]; publi
ony\Component\Cache\CacheItem; #[Group('time-sensitive')] class ProxyAdapterTest extends AdapterTestCase { protected $skippedTests = [ 'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php", "language": "php", "file_size": 2227, "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\Cache\Tests\Marshaller; use PHPUnit\Framework\Attributes\RequiresPhpExtension;...
=> [str_repeat('def', 100)]]; $failed = []; $defaultResult = $defaultMarshaller->marshall($values, $failed); $deflateResult = $deflateMarshaller->marshall($values, $failed); $deflateResult['abc'] = gzinflate($deflateResul
ateMarshallerTest extends TestCase { public function testMarshall() { $defaultMarshaller = new DefaultMarshaller(); $deflateMarshaller = new DeflateMarshaller($defaultMarshaller); $values = ['abc'
{ "filepath": "src/Symfony/Component/Cache/Tests/Marshaller/DeflateMarshallerTest.php", "language": "php", "file_size": 1677, "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\Cache\Tests\Marshaller; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\Tes...
w DefaultMarshaller(); $sodiumMarshaller = new SodiumMarshaller([$this->decryptionKey], $defaultMarshaller); $values = ['a' => '123']; $failed = []; $defaultResult = $defaultMarshaller->marshall($values, $failed);
TestCase { private string $decryptionKey; protected function setUp(): void { $this->decryptionKey = sodium_crypto_box_keypair(); } public function testMarshall() { $defaultMarshaller = ne
{ "filepath": "src/Symfony/Component/Cache/Tests/Marshaller/SodiumMarshallerTest.php", "language": "php", "file_size": 2174, "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\Cache\Tests\Messenger; use PHPUnit\Framework\TestCase; use Psr\Log\AbstractLogger; use Psr\Log\LoggerInterface; use Symfony\Component\Cache\Adapter\Adapter...
ent\Filesystem\Filesystem; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\MessageBus; use Symfony\Component\Messenger\MessageBusInterface; class EarlyExpirationDispatcherTest extends TestCase { public static function tearDow
Cache\Messenger\EarlyExpirationMessage; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ReverseContainer; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Compon
{ "filepath": "src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php", "language": "php", "file_size": 4589, "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\Cache\Tests\Messenger; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\C...
se Symfony\Contracts\Cache\CallbackInterface; class EarlyExpirationHandlerTest extends TestCase { public static function tearDownAfterClass(): void { (new Filesystem())->remove(sys_get_temp_dir().'/symfony-cache'); } #[Group('time
ionMessage; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ReverseContainer; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\Filesystem\Filesystem; u
{ "filepath": "src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationHandlerTest.php", "language": "php", "file_size": 2154, "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\Cache\Tests\Messenger; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\CacheItem; use Symfony...
$computationService = new class { public function __invoke(CacheItem $item) { return 123; } }; $container = new Container(); $container->set('computation_service', $computationS
encyInjection\ServiceLocator; class EarlyExpirationMessageTest extends TestCase { public function testCreate() { $pool = new ArrayAdapter(); $item = $pool->getItem('foo'); $item->set(234);
{ "filepath": "src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationMessageTest.php", "language": "php", "file_size": 3978, "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\Cache\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\File...
sConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; class CacheCollectorPassTest extends TestCase { public function testProcess
nent\Cache\Adapter\TraceableTagAwareAdapter; use Symfony\Component\Cache\DataCollector\CacheDataCollector; use Symfony\Component\Cache\DependencyInjection\CacheCollectorPass; use Symfony\Component\DependencyInjection\Compiler\Pas
{ "filepath": "src/Symfony/Component/Cache/Tests/DependencyInjection/CacheCollectorPassTest.php", "language": "php", "file_size": 4447, "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\Cache\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\DependencyI...
ClearerPassTest extends TestCase { public function testPoolRefsAreWeak() { $container = new ContainerBuilder(); $container->setParameter('kernel.container_class', 'app'); $container->setParameter('kernel.project_dir', 'foo')
ent\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer; class CachePool
{ "filepath": "src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolClearerPassTest.php", "language": "php", "file_size": 2682, "cut_index": 563, "middle_length": 229 }
apter\ApcuAdapter; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\ChainAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\Cache\Adapter\ParameterNormalizer; use Symfony\Component\Cache\Adapter\Redi...
fony\Component\HttpKernel\CacheClearer\Psr6CacheClearer; class CachePoolPassTest extends TestCase { private CachePoolPass $cachePoolPass; protected function setUp(): void { $this->cachePoolPass = new CachePoolPass(); } public
fony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Sym
{ "filepath": "src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php", "language": "php", "file_size": 16031, "cut_index": 921, "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\Cache\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand; use Symfony\Component\Ca...
encyInjection\Reference; class CachePoolPrunerPassTest extends TestCase { public function testCompilerPassReplacesCommandArgument() { $container = new ContainerBuilder(); $container->register('console.command.cache_pool_prune')->ad
on\CachePoolPrunerPass; use Symfony\Component\Cache\PruneableInterface; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Depend
{ "filepath": "src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPrunerPassTest.php", "language": "php", "file_size": 4498, "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\Cache\Messenger; use Psr\Log\LoggerInterface; use Symfony\Component\Cache\Adapter\AdapterInterface; use ...
private ReverseContainer $reverseContainer, ?callable $callbackWrapper = null, ) { $this->callbackWrapper = null === $callbackWrapper ? null : $callbackWrapper(...); } public function __invoke(callable $callback, CacheIte
dStamp; /** * Sends the computation of cached values to a message bus. */ class EarlyExpirationDispatcher { private ?\Closure $callbackWrapper; public function __construct( private MessageBusInterface $bus,
{ "filepath": "src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php", "language": "php", "file_size": 2294, "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\Cache\Messenger; use Symfony\Component\Cache\CacheItem; use Symfony\Component\DependencyInjection\Revers...
->getItem(); $metadata = $item->getMetadata(); $expiry = $metadata[CacheItem::METADATA_EXPIRY] ?? 0; $ctime = $metadata[CacheItem::METADATA_CTIME] ?? 0; if ($expiry && $ctime) { // skip duplicate or expired mess
array $processedNonces = []; public function __construct( private ReverseContainer $reverseContainer, ) { } public function __invoke(EarlyExpirationMessage $message): void { $item = $message
{ "filepath": "src/Symfony/Component/Cache/Messenger/EarlyExpirationHandler.php", "language": "php", "file_size": 2464, "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\Cache\Messenger; use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Cache...
return null; } $pool = $reverseContainer->getId($pool); if ($callback instanceof \Closure && !($r = new \ReflectionFunction($callback))->isAnonymous()) { $callback = [$r->getClosureThis() ?? $r->getClosureCalle
create(ReverseContainer $reverseContainer, callable $callback, CacheItem $item, AdapterInterface $pool): ?self { try { $item = clone $item; $item->set(null); } catch (\Exception) {
{ "filepath": "src/Symfony/Component/Cache/Messenger/EarlyExpirationMessage.php", "language": "php", "file_size": 2819, "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\Cache\DependencyInjection; use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface; use Symfony\Com...
ailed statistics. * * @author Tobias Nyholm <tobias.nyholm@gmail.com> */ class CacheCollectorPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('data_collec
nent\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; /** * Inject a data collector to all the cache services to be able to get det
{ "filepath": "src/Symfony/Component/Cache/DependencyInjection/CacheCollectorPass.php", "language": "php", "file_size": 2926, "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\Cache\DependencyInjection; use Symfony\Component\Dependency...
($container->findTaggedServiceIds('cache.pool.clearer') as $id => $attr) { $clearer = $container->getDefinition($id); $pools = []; foreach ($clearer->getArgument(0) as $name => $ref) { if ($container->ha
work.com> */ class CachePoolClearerPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { $container->getParameterBag()->remove('cache.prefix.seed'); foreach
{ "filepath": "src/Symfony/Component/Cache/DependencyInjection/CachePoolClearerPass.php", "language": "php", "file_size": 1181, "cut_index": 518, "middle_length": 229 }
Component\Cache\Adapter\ChainAdapter; use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\Cache\Adapter\ParameterNormalizer; use Symfony\Component\Cache\Adapter\TagAwareAdapter; use Symfony\Component\Cache\Messenger\EarlyExpirationDispatcher; use Symfony\Component\Cache\PruneableInterface; use Symfon...
ass CachePoolPass implements CompilerPassInterface { public function process(ContainerBuilder $container): void { if ($container->hasParameter('cache.prefix.seed')) { $seed = $container->getParameterBag()->resolveValue($containe
ny\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; /** * @author Nicolas Grekas <p@tchwork.com> */ cl
{ "filepath": "src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php", "language": "php", "file_size": 12905, "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\Cache\DependencyInjection; use Symfony\Component\Cache\PruneableI...
$container): void { if (!$container->hasDefinition('console.command.cache_pool_prune')) { return; } $services = []; foreach ($container->findTaggedServiceIds('cache.pool') as $id => $tags) { if
on\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; /** * @author Rob Frawley 2nd <rmf@src.run> */ class CachePoolPrunerPass implements CompilerPassInterface { public function process(ContainerBuilder
{ "filepath": "src/Symfony/Component/Cache/DependencyInjection/CachePoolPrunerPass.php", "language": "php", "file_size": 1409, "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\TypeInfo; use Symfony\Component\TypeInfo\Type\CompositeTypeInterface; use Symfony\Component\TypeInfo\Type\WrappingTypeInterface; /** * @author Mathias Ar...
ation): bool { if ($this instanceof WrappingTypeInterface && $this->wrappedTypeIsSatisfiedBy($specification)) { return true; } if ($this instanceof CompositeTypeInterface && $this->composedTypesAreSatisfiedBy($speci
e is satisfied by the $specification callable. * * @param-immediately-invoked-callable $specification * * @param callable(self): bool $specification */ public function isSatisfiedBy(callable $specific
{ "filepath": "src/Symfony/Component/TypeInfo/Type.php", "language": "php", "file_size": 3199, "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\Cache\Tests\Fixtures; use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheIte...
time); } public function getItem($key): CacheItemInterface { return $this->cache->getItem($key); } public function getItems(array $keys = []): iterable { return $this->cache->getItems($keys); } public func
nglas@gmail.com> */ class ExternalAdapter implements CacheItemPoolInterface { private ArrayAdapter $cache; public function __construct(int $defaultLifetime = 0) { $this->cache = new ArrayAdapter($defaultLife
{ "filepath": "src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php", "language": "php", "file_size": 1734, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Cache\Tests\Traits; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; use Relay\Cluster as RelayCluster; use Relay\Relay; use Symfony\Component\Cache\Traits\RedisProxyTrait; use...
roxy.php"); $proxy = substr($proxy, 0, 2 + strpos($proxy, '[];')); $expected = substr($proxy, 0, 2 + strpos($proxy, '}')); $methods = []; foreach ((new \ReflectionClass(\sprintf('Symfony\Component\Cache\Traits\\%sProxy', $c
#[RequiresPhpExtension('redis')] #[TestWith([\Redis::class])] #[TestWith([\RedisCluster::class])] public function testRedisProxy($class) { $proxy = file_get_contents(\dirname(__DIR__, 2)."/Traits/{$class}P
{ "filepath": "src/Symfony/Component/Cache/Tests/Traits/RedisProxiesTest.php", "language": "php", "file_size": 6919, "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\Cache\Tests\Marshaller; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Marshaller\Defau...
#[RequiresPhpExtension('igbinary')] public function testIgbinarySerialize() { if (version_compare('3.1.6', phpversion('igbinary'), '>')) { $this->markTestSkipped('igbinary needs to be v3.1.6 or higher.'); }
3, 'b' => static function () {}, ]; $expected = ['a' => serialize(123)]; $this->assertSame($expected, $marshaller->marshall($values, $failed)); $this->assertSame(['b'], $failed); }
{ "filepath": "src/Symfony/Component/Cache/Tests/Marshaller/DefaultMarshallerTest.php", "language": "php", "file_size": 4641, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use Predis\Connection\StreamConnection; use Symfony\Component\Cache\Adapter\RedisAdapter; #[G...
OST'); $redis = RedisAdapter::createConnection('redis://'.$redisHost.'/1', ['class' => \Predis\Client::class, 'timeout' => 3]); $this->assertInstanceOf(\Predis\Client::class, $redis); $connection = $redis->getConnection();
$redis = new \Predis\Client(array_combine(['host', 'port'], explode(':', getenv('REDIS_HOST')) + [1 => 6379]), ['prefix' => 'prefix_']); } public function testCreateConnection() { $redisHost = getenv('REDIS_H
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisAdapterTest.php", "language": "php", "file_size": 4045, "cut_index": 614, "middle_length": 229 }
ony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use Symfony\Component\Cache\Adapter\RedisAdapter; #[Group('integration')] class Predi...
env var is not defined.'); } self::$redis = RedisAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).'][role]=master', ['replication' => 'predis', 'class' => \Predis\Client::class, 'prefix' => 'prefix_']); } }
self::markTestSkipped('REDIS_REPLICATION_HOSTS
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisRedisReplicationAdapterTest.php", "language": "php", "file_size": 914, "cut_index": 606, "middle_length": 52 }
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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Gr...
createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { $this->assertInstanceOf(\Predis\Client::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CL
rTest { use TagAwareTestTrait; protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } public function
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php", "language": "php", "file_size": 1061, "cut_index": 515, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use Psr\Cache\CacheItemPoolInterface; use S...
tic function setUpBeforeClass(): void { parent::setUpBeforeClass(); self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST')); } public function createCachePool($defaultLifetime = 0, ?string $testMethod
oup('integration')] class ProxyAdapterAndRedisAdapterTest extends AbstractRedisAdapterTestCase { protected $skippedTests = [ 'testPrune' => 'RedisAdapter does not implement PruneableInterface.', ]; public sta
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterAndRedisAdapterTest.php", "language": "php", "file_size": 2448, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use ...
impleCache cannot clear by prefix', 'testClearPrefixWithUnderscore' => 'SimpleCache cannot clear by prefix', ]; public function createCachePool(int $defaultLifetime = 0): CacheItemPoolInterface { return new Psr16Adapter(new Psr
Symfony\Component\Cache\Psr16Cache; #[Group('time-sensitive')] class Psr16AdapterTest extends AdapterTestCase { protected $skippedTests = [ 'testPrune' => 'Psr16adapter just proxies', 'testClearPrefix' => 'S
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/Psr16AdapterTest.php", "language": "php", "file_size": 1443, "cut_index": 524, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; use Symf...
reateCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) { self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PRE
public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]); } public function c
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php", "language": "php", "file_size": 5615, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Gro...
if (!class_exists(\RedisCluster::class)) { self::markTestSkipped('The RedisCluster class is required.'); } if (!$hosts = getenv('REDIS_CLUSTER_HOSTS')) { self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not de
gumentException; use Symfony\Component\Cache\Traits\RedisClusterProxy; #[Group('integration')] class RedisClusterAdapterTest extends AbstractRedisAdapterTestCase { public static function setUpBeforeClass(): void {
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php", "language": "php", "file_size": 2372, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group...
chePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) { self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
use TagAwareTestTrait; protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } public function createCa
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php", "language": "php", "file_size": 1226, "cut_index": 518, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group...
parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { $this
yClusterProxy; #[RequiresPhpExtension('relay')] #[Group('integration')] class RedisTagAwareRelayClusterAdapterTest extends RelayClusterAdapterTest { use TagAwareTestTrait; protected function setUp(): void {
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareRelayClusterAdapterTest.php", "language": "php", "file_size": 1209, "cut_index": 518, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Frame...
BeforeClass(): void { try { new Relay(...explode(':', getenv('REDIS_HOST'))); } catch (\Relay\Exception $e) { self::markTestSkipped(getenv('REDIS_HOST').': '.$e->getMessage()); } self::$redis = Ab
ion\InvalidArgumentException; use Symfony\Component\Cache\Traits\RelayProxy; #[RequiresPhpExtension('relay')] #[Group('integration')] class RelayAdapterTest extends AbstractRedisAdapterTestCase { public static function setUp
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RelayAdapterTest.php", "language": "php", "file_size": 1974, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\MockObject\MockObject; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AdapterInterface; ...
public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new TagAwareAdapter(new FilesystemAdapter('', $defaultLifetime)); } public static function tearDownAfterClass(): void { (new Filesyste
bleInterface; use Symfony\Component\Cache\Tests\Fixtures\PrunableAdapter; use Symfony\Component\Filesystem\Filesystem; #[Group('time-sensitive')] class TagAwareAdapterTest extends AdapterTestCase { use TagAwareTestTrait;
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php", "language": "php", "file_size": 7601, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use ...
face $proxiedAdapter) { $cache = new TagAwareAdapter(new ProxyAdapter($proxiedAdapter)); $item = $cache->getItem('foo'); $item->tag(['tag1', 'tag2']); $item->set('bar'); $cache->save($item); $this->asse
ymfony\Component\Cache\Tests\Fixtures\ExternalAdapter; class TagAwareAndProxyAdapterIntegrationTest extends TestCase { #[DataProvider('dataProvider')] public function testIntegrationUsingProxiedAdapter(CacheItemPoolInter
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/TagAwareAndProxyAdapterIntegrationTest.php", "language": "php", "file_size": 2117, "cut_index": 563, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Gr...
->invalidateTags(['foo']); $calls = $pool->getCalls(); $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('invalidateTags', $call->name); $this->assertSame(0, $call->hits); $this->assertSame
nsitive')] class TraceableTagAwareAdapterTest extends TraceableAdapterTest { public function testInvalidateTags() { $pool = new TraceableTagAwareAdapter(new TagAwareAdapter(new FilesystemAdapter())); $pool
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/TraceableTagAwareAdapterTest.php", "language": "php", "file_size": 1116, "cut_index": 515, "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\Cache\Tests\Fixtures; use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter; /*...
ray { $failed = parent::doSave($values, $lifetime, $addTagData, $removeTagData); // Simulate tag save failure by returning tag IDs as failed foreach ($addTagData as $tagId => $ids) { $failed[] = $tagId; }
ray $addTagData = [], array $removeTagData = []): ar
{ "filepath": "src/Symfony/Component/Cache/Tests/Fixtures/FailingTagFilesystemAdapter.php", "language": "php", "file_size": 886, "cut_index": 547, "middle_length": 52 }
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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use Symfony\Component\Cache...
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.'); } self::$redis = RedisAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['class' => \Predis\Client::class, 'redis_cluster' => true, '
(!$hosts = getenv('REDIS_CLUSTER_HOSTS')) {
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisRedisClusterAdapterTest.php", "language": "php", "file_size": 887, "cut_index": 547, "middle_length": 52 }
?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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\...
Pool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { $this->assertInstanceOf(\Predis\Client::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $def
use TagAwareTestTrait; protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } public function createCache
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php", "language": "php", "file_size": 1047, "cut_index": 513, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Gro...
ion')] class RelayClusterAdapterTest extends AbstractRedisAdapterTestCase { public static function setUpBeforeClass(): void { if (!class_exists(RelayCluster::class)) { self::markTestSkipped('The Relay\Cluster class is required.'
tAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Exception\InvalidArgumentException; use Symfony\Component\Cache\Traits\RelayClusterProxy; #[RequiresPhpExtension('relay')] #[Group('integrat
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RelayClusterAdapterTest.php", "language": "php", "file_size": 2444, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\TraceableAdapter; #[Group('time-sensitive')] class TraceableAdapte...
m('k'); $calls = $pool->getCalls(); $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('getItem', $call->name); $this->assertSame(['k' => false], $call->result); $this->assertSame(0, $call->
acheItemPoolInterface { return new TraceableAdapter(new FilesystemAdapter('', $defaultLifetime)); } public function testGetItemMissTrace() { $pool = $this->createCachePool(); $pool->getIte
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/TraceableAdapterTest.php", "language": "php", "file_size": 5957, "cut_index": 716, "middle_length": 229 }
quiresPhpExtension; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Exception\InvalidArgumentException; use Symfony\Component\Cache\Traits\RedisTrait; #[RequiresPhpExtension('redis')] class RedisTraitTest extends TestCase { public static function setUpBeforeClass(): void { try { ...
" class is required.', $expectedClass)); } if (!getenv('REDIS_CLUSTER_HOSTS')) { self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.'); } $mock = new class { use RedisTrait; };
} #[DataProvider('provideCreateConnection')] public function testCreateConnection(string $dsn, string $expectedClass) { if (!class_exists($expectedClass)) { self::markTestSkipped(\sprintf('The "%s
{ "filepath": "src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php", "language": "php", "file_size": 11653, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Gr...
blic function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { $this->assertInstanceOf(\Predis\Client::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\
icationAdapterTest { use TagAwareTestTrait; protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } pu
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareReplicationAdapterTest.php", "language": "php", "file_size": 1074, "cut_index": 515, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; #[Group('integr...
y::class)) { self::markTestSkipped('The RedisArray class is required.'); } self::$redis = new \RedisArray([getenv('REDIS_HOST')], ['lazy_connect' => true]); self::$redis->setOption(\Redis::OPT_PREFIX, 'prefix_'); } }
sts(\RedisArra
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RedisArrayAdapterTest.php", "language": "php", "file_size": 807, "cut_index": 536, "middle_length": 14 }
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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use ...
the test suite'; } public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) { self::$redis-
usterAdapterTest extends RedisClusterAdapterTest { use TagAwareTestTrait; protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php", "language": "php", "file_size": 1290, "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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group...
$lastArrayKey = array_key_last($hosts); $hostTable = []; foreach ($hosts as $key => $host) { $hostInformation = array_combine(['host', 'port'], explode(':', $host)); if ($lastArrayKey === $key) {
); if (!$hosts = getenv('REDIS_REPLICATION_HOSTS')) { self::markTestSkipped('REDIS_REPLICATION_HOSTS env var is not defined.'); } $hosts = explode(' ', getenv('REDIS_REPLICATION_HOSTS'));
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/PredisReplicationAdapterTest.php", "language": "php", "file_size": 1226, "cut_index": 518, "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\TypeInfo\TypeResolver; use Symfony\Component\TypeInfo\Exception\InvalidArgumentException; use Symfony\Component\TypeInfo\Exception\UnsupportedException; us...
Context $typeContext = null): Type { if ($subject instanceof \ReflectionUnionType) { return Type::union(...array_map(fn (mixed $t): Type => $this->resolve($t, $typeContext), $subject->getTypes())); } if ($subject in
* @author Mathias Arlaud <mathias.arlaud@gmail.com> * @author Baptiste Leduc <baptiste.leduc@gmail.com> */ final class ReflectionTypeResolver implements TypeResolverInterface { public function resolve(mixed $subject, ?Type
{ "filepath": "src/Symfony/Component/TypeInfo/TypeResolver/ReflectionTypeResolver.php", "language": "php", "file_size": 3259, "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\TypeInfo\TypeResolver; use Symfony\Component\TypeInfo\Exception\UnsupportedExc...
blic function __construct( private readonly ReflectionTypeResolver $reflectionTypeResolver, private readonly TypeContextFactory $typeContextFactory, ) { } public function resolve(mixed $subject, ?TypeContext $typeContext = null
for a given function reflection. * * @author Mathias Arlaud <mathias.arlaud@gmail.com> * @author Baptiste Leduc <baptiste.leduc@gmail.com> */ final class ReflectionReturnTypeResolver implements TypeResolverInterface { pu
{ "filepath": "src/Symfony/Component/TypeInfo/TypeResolver/ReflectionReturnTypeResolver.php", "language": "php", "file_size": 1879, "cut_index": 537, "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\TypeInfo\Tests\TypeResolver; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\UnsupportedException; use Symfony\Component\TypeInfo\...
ReflectionTypeResolver; class ReflectionPropertyTypeResolverTest extends TestCase { private ReflectionPropertyTypeResolver $resolver; protected function setUp(): void { $this->resolver = new ReflectionPropertyTypeResolver(new Reflecti
leTrait; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory; use Symfony\Component\TypeInfo\TypeResolver\ReflectionPropertyTypeResolver; use Symfony\Component\TypeInfo\TypeResolver\
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/TypeResolver/ReflectionPropertyTypeResolverTest.php", "language": "php", "file_size": 3178, "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\TypeInfo\Tests\TypeResolver; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\UnsupportedException; use Symfony\Component\TypeInfo\...
flectionTypeResolver; class ReflectionReturnTypeResolverTest extends TestCase { private ReflectionReturnTypeResolver $resolver; protected function setUp(): void { $this->resolver = new ReflectionReturnTypeResolver(new ReflectionTypeRe
leTrait; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory; use Symfony\Component\TypeInfo\TypeResolver\ReflectionReturnTypeResolver; use Symfony\Component\TypeInfo\TypeResolver\Re
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/TypeResolver/ReflectionReturnTypeResolverTest.php", "language": "php", "file_size": 3870, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\TypeInfo\Tests\TypeResolver; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\InvalidArgumentException; use Symfony\Component\TypeInfo\Exception\UnsupportedException; use Symfony\Compone...
ypeInfo\TypeContext\TypeContext; use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory; use Symfony\Component\TypeInfo\TypeResolver\ReflectionTypeResolver; class ReflectionTypeResolverTest extends TestCase { private ReflectionTypeResolver $res
ts\Fixtures\DummyBackedEnumInterface; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyEnum; use Symfony\Component\TypeInfo\Tests\Fixtures\ReflectionExtractableDummy; use Symfony\Component\TypeInfo\Type; use Symfony\Component\T
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/TypeResolver/ReflectionTypeResolverTest.php", "language": "php", "file_size": 5808, "cut_index": 716, "middle_length": 229 }
eption\InvalidArgumentException; use Symfony\Component\TypeInfo\Exception\UnsupportedException; use Symfony\Component\TypeInfo\Tests\Fixtures\AbstractDummy; use Symfony\Component\TypeInfo\Tests\Fixtures\Dummy; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyBackedEnum; use Symfony\Component\TypeInfo\Tests\Fixtures\D...
e Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeContext\TypeContext; use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory; use Symfony\Component\TypeInfo\TypeResolver\StringTypeResolver; class StringTypeResolverTest extends
ummyWithConstants; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithTemplates; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithTemplateTypeAlias; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithTypeAliases; us
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/TypeResolver/StringTypeResolverTest.php", "language": "php", "file_size": 17343, "cut_index": 921, "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\TypeInfo\Tests\TypeResolver; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\UnsupportedException; use Symfony\Component\TypeInfo\...
), $resolver->resolve((new \ReflectionProperty(Dummy::class, 'id'))->getType())); $this->assertEquals(Type::int(), $resolver->resolve((new \ReflectionMethod(Dummy::class, 'setId'))->getParameters()[0])); $this->assertEquals(Type::int(), $re
ypeResolverTest extends TestCase { public function testResolve() { $resolver = TypeResolver::create(); $this->assertEquals(Type::bool(), $resolver->resolve('bool')); $this->assertEquals(Type::int(
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/TypeResolver/TypeResolverTest.php", "language": "php", "file_size": 4003, "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\TypeInfo\Tests\Fixtures; final class DummyWithConstant...
public const DUMMY_MIX_3 = self::DUMMY_FLOAT_A; public const DUMMY_MIX_4 = self::DUMMY_TRUE_A; public const DUMMY_MIX_5 = self::DUMMY_FALSE_A; public const DUMMY_MIX_6 = self::DUMMY_NULL_A; public const DUMMY_MIX_7 = self::DUMMY_ARRAY_A
; public const DUMMY_NULL_A = null; public const DUMMY_ARRAY_A = []; public const DUMMY_ENUM_A = DummyEnum::ONE; public const DUMMY_MIX_1 = self::DUMMY_STRING_A; public const DUMMY_MIX_2 = self::DUMMY_INT_A;
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithConstants.php", "language": "php", "file_size": 1053, "cut_index": 513, "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\TypeInfo\Tests\Fixtures; /** * @phpstan-type CustomInt ...
/ public mixed $promotedVar, /** * @var string */ public mixed $promotedVarAndParam, ) { } /** * @param Dummy $dummy * * @return Dummy */ public function getNextDummy(mixed $dum
*/ public mixed $aliasedInt; /** * @param bool $promoted * @param bool $promotedVarAndParam */ public function __construct( public mixed $promoted, /** * @var string *
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithPhpDoc.php", "language": "php", "file_size": 1117, "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\TypeInfo\Tests\Fixtures; /** * @phpstan-type CustomArray = array{0: CustomInt...
lmCustomInt from DummyWithPhpDoc as PsalmAliasedCustomInt */ final class DummyWithTypeAliases { /** * @var CustomString */ public mixed $localAlias; /** * @var CustomInt */ public mixed $externalAlias; /** *
stomInt * * @psalm-type PsalmCustomArray = array{0: PsalmCustomInt, 1: PsalmCustomString, 2: bool} * @psalm-type PsalmCustomString = string * * @psalm-import-type PsalmCustomInt from DummyWithPhpDoc * @psalm-import-type Psa
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithTypeAliases.php", "language": "php", "file_size": 1995, "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\TypeInfo\Tests\Fixtures; final class ReflectionExtractableDummy extends Abstra...
?DummyEnum $nullableEnum; public DummyBackedEnum $backedEnum; public ?DummyBackedEnum $nullableBackedEnum; public DummyBackedEnumInterface $backedEnumInterface; public int|string $union; public \Traversable&\Stringable $intersection;
terable; public Dummy $class; public ?Dummy $nullableClass; public self $self; public ?self $nullableSelf; public parent $parent; public ?parent $nullableParent; public DummyEnum $enum; public
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Fixtures/ReflectionExtractableDummy.php", "language": "php", "file_size": 1797, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\TypeInfo\Tests\Type; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\InvalidArgumentException; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\Type\ArrayShapeType; ...
ype' => Type::bool(), 'optional' => false]], extraKeyType: $extraKeyType, extraValueType: $extraValueType, ); } /** * @return iterable<array{0: string, 1: ?Type, 2: ?Type}> */ public static function ca
?Type $extraKeyType, ?Type $extraValueType) { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($expectedMessage); new ArrayShapeType( shape: [1 => ['t
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/ArrayShapeTypeTest.php", "language": "php", "file_size": 6319, "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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Sy...
ummyBackedEnum::class, Type::bool()); } public function testToString() { $this->assertSame(DummyBackedEnum::class, (string) new BackedEnumType(DummyBackedEnum::class, Type::int())); } public function testAccepts() {
Type\BackedEnumType; class BackedEnumTypeTest extends TestCase { public function testCannotCreateInvalidBackingBuiltinType() { $this->expectException(InvalidArgumentException::class); new BackedEnumType(D
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/BackedEnumTypeTest.php", "language": "php", "file_size": 1198, "cut_index": 518, "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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Type\BuiltinType; use Symfony\Component\TypeInfo\TypeIdentifier; class...
; $this->assertFalse((new BuiltinType(TypeIdentifier::INT))->isIdentifiedBy('array')); $this->assertTrue((new BuiltinType(TypeIdentifier::INT))->isIdentifiedBy('int')); $this->assertTrue((new BuiltinType(TypeIdentifier::INT))->isI
dentifiedBy() { $this->assertFalse((new BuiltinType(TypeIdentifier::INT))->isIdentifiedBy(TypeIdentifier::ARRAY)); $this->assertTrue((new BuiltinType(TypeIdentifier::INT))->isIdentifiedBy(TypeIdentifier::INT))
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/BuiltinTypeTest.php", "language": "php", "file_size": 3882, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\InvalidArgumentException; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\Type\CollectionType; use Symfony\Component\TypeInfo\Type\GenericType;...
int(), Type::bool()), isList: true); $this->addToAssertionCount(1); $this->expectException(InvalidArgumentException::class); new CollectionType(Type::generic(Type::builtin(TypeIdentifier::ARRAY), Type::string(), Type::bool()), isLi
idArgumentException::class); new CollectionType(Type::int()); } public function testCanOnlyConstructListWithIntKeyType() { new CollectionType(Type::generic(Type::builtin(TypeIdentifier::ARRAY), Type::
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/CollectionTypeTest.php", "language": "php", "file_size": 7431, "cut_index": 716, "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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\Ty...
ring) new EnumType(DummyEnum::class)); } public function testAccepts() { $type = new EnumType(DummyEnum::class); $this->assertFalse($type->accepts('string')); $this->assertTrue($type->accepts(DummyEnum::ONE)); } }
um::class, (st
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/EnumTypeTest.php", "language": "php", "file_size": 806, "cut_index": 536, "middle_length": 14 }
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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\InvalidArg...
$type = new GenericType(Type::builtin(TypeIdentifier::ARRAY), Type::bool()); $this->assertEquals('array<bool>', (string) $type); $type = new GenericType(Type::builtin(TypeIdentifier::ARRAY), Type::string(), Type::bool()); $
public function testCannotCreateInvalidBuiltinType() { $this->expectException(InvalidArgumentException::class); new GenericType(Type::int(), Type::string()); } public function testToString() {
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/GenericTypeTest.php", "language": "php", "file_size": 2041, "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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\InvalidArgumentException; use Symfony\Component\TypeInfo\Type...
tCreateWithUnionTypePart() { $this->expectException(InvalidArgumentException::class); new IntersectionType(Type::object(\DateTime::class), new UnionType(Type::int(), Type::string())); } public function testCannotCreateWithInter
ase { public function testCannotCreateWithOnlyOneType() { $this->expectException(InvalidArgumentException::class); new IntersectionType(Type::object(\DateTime::class)); } public function testCanno
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/IntersectionTypeTest.php", "language": "php", "file_size": 3849, "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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\Typ...
Type(Type::int()); $this->assertEquals([Type::int(), Type::null()], $type->getTypes()); $type = new NullableType(Type::union(Type::int(), Type::string())); $this->assertEquals([Type::int(), Type::null(), Type::string()], $type->get
testCannotCreateWithNullableType() { $this->expectException(InvalidArgumentException::class); new NullableType(Type::null()); } public function testNullPartIsAdded() { $type = new Nullable
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/NullableTypeTest.php", "language": "php", "file_size": 1673, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\Type\ObjectShapeType; use Symfony\Component\TypeInfo\TypeIdentifier; class ObjectShapeTypeTest extends TestCase { public function t...
bool(), 'optional' => false], 'bar' => ['type' => Type::string(), 'optional' => true], ]; $type = new ObjectShapeType($shape); ksort($shape); $this->assertSame($shape, $type->getShape()); } public func
tifier()); $this->assertSame(TypeIdentifier::OBJECT, (new ObjectShapeType([]))->getTypeIdentifier()); } public function testGetShapeIsSortedByKey() { $shape = [ 'foo' => ['type' => Type::
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/ObjectShapeTypeTest.php", "language": "php", "file_size": 5826, "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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\Typ...
pe(self::class))->isIdentifiedBy(TypeIdentifier::OBJECT)); $this->assertFalse((new ObjectType(self::class))->isIdentifiedBy('array')); $this->assertTrue((new ObjectType(self::class))->isIdentifiedBy('object')); $this->assertTrue((
string) new ObjectType(self::class)); } public function testIsIdentifiedBy() { $this->assertFalse((new ObjectType(self::class))->isIdentifiedBy(TypeIdentifier::ARRAY)); $this->assertTrue((new ObjectTy
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/ObjectTypeTest.php", "language": "php", "file_size": 1637, "cut_index": 537, "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\TypeInfo\Tests\Type; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\InvalidArgumentException; use Symfony\Component\TypeInfo\Type...
$this->expectException(InvalidArgumentException::class); new UnionType(Type::int(), new UnionType()); } public function testCannotCreateWithNullPart() { $this->expectException(InvalidArgumentException::class); new Un
blic function testCannotCreateWithOnlyOneType() { $this->expectException(InvalidArgumentException::class); new UnionType(Type::int()); } public function testCannotCreateWithUnionTypePart() {
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/Type/UnionTypeTest.php", "language": "php", "file_size": 3313, "cut_index": 614, "middle_length": 229 }
ption\LogicException; use Symfony\Component\TypeInfo\Tests\Fixtures\AbstractDummy; use Symfony\Component\TypeInfo\Tests\Fixtures\AnotherNamespace\DummyInDifferentNs; use Symfony\Component\TypeInfo\Tests\Fixtures\AnotherNamespace\DummyWithTemplateAndParentInDifferentNs; use Symfony\Component\TypeInfo\Tests\Fixtures\Dumm...
res\DummyWithRecursiveTypeAliases; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithTemplateAndParent; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithTemplates; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithTemplateTypeAlias; use Sym
\Fixtures\DummyWithInvalidTypeAliasImport; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithPhpstanTemplates; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithPsalmTemplates; use Symfony\Component\TypeInfo\Tests\Fixtu
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/TypeContext/TypeContextFactoryTest.php", "language": "php", "file_size": 14744, "cut_index": 921, "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\TypeInfo\Tests\TypeContext; use PHPUnit\Framework\TestCase; use Symfony\Component\TypeInfo\Exception\LogicException; use Symfony\Component\TypeInfo\Tests\F...
text\TypeContextFactory; class TypeContextTest extends TestCase { public function testNormalize() { $typeContext = (new TypeContextFactory())->createFromClassName(DummyWithUses::class); $this->assertSame(DummyWithUses::class, $typ
sts\Fixtures\DummyExtendingStdClass; use Symfony\Component\TypeInfo\Tests\Fixtures\DummyWithUses; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeContext\TypeContext; use Symfony\Component\TypeInfo\TypeCon
{ "filepath": "src/Symfony/Component/TypeInfo/Tests/TypeContext/TypeContextTest.php", "language": "php", "file_size": 3158, "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\TypeInfo\TypeContext; use Symfony\Component\TypeInfo\Exception\LogicException; use Symfony\Component\TypeInfo\Type; /** * Type resolving context. * * H...
$uses * @param array<string, Type> $templates * @param array<string, Type> $typeAliases */ public function __construct( public readonly string $calledClassName, public readonly string $declaringClassName, pub
.com> * @author Baptiste Leduc <baptiste.leduc@gmail.com> */ final class TypeContext { /** * @var array<string, bool> */ private static array $classExistCache = []; /** * @param array<string, string>
{ "filepath": "src/Symfony/Component/TypeInfo/TypeContext/TypeContext.php", "language": "php", "file_size": 3315, "cut_index": 614, "middle_length": 229 }
pDocParser\Ast\PhpDoc\TypeAliasImportTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\TypeAliasTagValueNode; use PHPStan\PhpDocParser\Lexer\Lexer; use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parse...
. * * @author Mathias Arlaud <mathias.arlaud@gmail.com> * @author Baptiste Leduc <baptiste.leduc@gmail.com> * @author Pierre-Yves Landuré <landure@gmail.com> */ final class TypeContextFactory { /** * @var array<class-string, \ReflectionClass>
ypeInfo\Exception\UnsupportedException; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\Type\ObjectType; use Symfony\Component\TypeInfo\TypeResolver\StringTypeResolver; /** * Creates a type resolving context
{ "filepath": "src/Symfony/Component/TypeInfo/TypeContext/TypeContextFactory.php", "language": "php", "file_size": 14464, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\EventDispatcher; use Psr\EventDispatcher\StoppableEventInterface; use Symfony\Component\EventDispatcher\Debug\WrappedListener; /** * The EventDispatcherInterface is the central point of Symfony's event listener system. * * Listeners are registered on th...
thor Nicolas Grekas <p@tchwork.com> */ class EventDispatcher implements EventDispatcherInterface { private array $listeners = []; private array $sorted = []; private array $optimized; public function __construct() { if (__CLAS
<roman@code-factory.org> * @author Bernhard Schussek <bschussek@gmail.com> * @author Fabien Potencier <fabien@symfony.com> * @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordan Alliot <jordan.alliot@gmail.com> * @au
{ "filepath": "src/Symfony/Component/EventDispatcher/EventDispatcher.php", "language": "php", "file_size": 8858, "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\EventDispatcher; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatc...
* @param int $priority The higher this value, the earlier an event * listener will be triggered in the chain (defaults to 0) */ public function addListener(string $eventName, callable $listener, int $priority = 0): v
manager. * * @author Bernhard Schussek <bschussek@gmail.com> */ interface EventDispatcherInterface extends ContractsEventDispatcherInterface { /** * Adds an event listener that listens on the specified events. *
{ "filepath": "src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php", "language": "php", "file_size": 2198, "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\EventDispatcher; /** * An EventSubscriber knows itself what events it is inte...
EventSubscriberInterface { /** * Returns an array of event names this subscriber wants to listen to. * * The array keys are event names and the value can be: * * * The method name to call (priority defaults to 0) * * An
vents. * * @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Jonathan Wage <jonwage@gmail.com> * @author Roman Borschel <roman@code-factory.org> * @author Bernhard Schussek <bschussek@gmail.com> */ interface
{ "filepath": "src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php", "language": "php", "file_size": 1771, "cut_index": 537, "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\EventDispatcher; use Symfony\Contracts\EventDispatcher\Event; /** * Event encapsulation class. * * Encapsulates events thus decoupling the observer fro...
m array $arguments Arguments to store in the event */ public function __construct( protected mixed $subject = null, protected array $arguments = [], ) { } /** * Getter for subject property. */ public func
ds Event implements \ArrayAccess, \IteratorAggregate { /** * Encapsulate an event with $subject and $arguments. * * @param mixed $subject The subject of the event, usually an object or a callable * @para
{ "filepath": "src/Symfony/Component/EventDispatcher/GenericEvent.php", "language": "php", "file_size": 3457, "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\EventDispatcher; /** * A read-only proxy for an event dispatcher. * * @auth...
me, callable|array $listener, int $priority = 0): never { throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); } public function addSubscriber(EventSubscriberInterface $subscriber): never {
ispatcher, ) { } public function dispatch(object $event, ?string $eventName = null): object { return $this->dispatcher->dispatch($event, $eventName); } public function addListener(string $eventNa
{ "filepath": "src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php", "language": "php", "file_size": 1980, "cut_index": 537, "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\EventDispatcher\Attribute; /** * Service tag to autocon...
is listener if several are declared for the same event * @param string|null $dispatcher The service id of the event dispatcher to listen to */ public function __construct( public ?string $event = null, public ?string $method =
ner { /** * @param string|null $event The event name to listen to * @param string|null $method The method to run when the listened event is triggered * @param int $priority The priority of th
{ "filepath": "src/Symfony/Component/EventDispatcher/Attribute/AsEventListener.php", "language": "php", "file_size": 1100, "cut_index": 515, "middle_length": 229 }
dispatcher = $this->createEventDispatcher(); $this->listener = new TestEventListener(); } protected function createEventDispatcher() { return new EventDispatcher(); } public function testInitialState() { $this->assertEquals([], $this->dispatcher->getListeners()); ...
$this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); $this->assertTrue($this->dispatcher->hasListeners(self::postFoo)); $this->assertCount(1, $this->dispatcher->getListeners(self::preFoo)); $this->assertCount(1,
{ $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']); $this->dispatcher->addListener('post.foo', $this->listener->postFoo(...)); $this->assertTrue($this->dispatcher->hasListeners());
{ "filepath": "src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php", "language": "php", "file_size": 18509, "cut_index": 1331, "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\TypeInfo\TypeResolver; use PHPStan\PhpDocParser\Parser\PhpDocParser; use Psr\Container\ContainerInterface; use Symfony\Component\TypeInfo\Exception\Unsuppo...
verInterface { /** * @param ContainerInterface $resolvers Locator of type resolvers, keyed by supported subject type */ public function __construct( private readonly ContainerInterface $resolvers, ) { } public functio
for a given subject by delegating resolving to nested type resolvers. * * @author Mathias Arlaud <mathias.arlaud@gmail.com> * @author Baptiste Leduc <baptiste.leduc@gmail.com> */ final class TypeResolver implements TypeResol
{ "filepath": "src/Symfony/Component/TypeInfo/TypeResolver/TypeResolver.php", "language": "php", "file_size": 4355, "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\TypeInfo\Type; use Symfony\Component\TypeInfo\Exception\InvalidArgumentException; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeI...
ape */ public function __construct( array $shape, private readonly ?Type $extraKeyType = null, private readonly ?Type $extraValueType = null, ) { $keyTypes = []; $valueTypes = []; foreach ($shap
> */ final class ArrayShapeType extends CollectionType { /** * @var array<array{type: Type, optional: bool}> */ private readonly array $shape; /** * @param array<array{type: Type, optional: bool}> $sh
{ "filepath": "src/Symfony/Component/TypeInfo/Type/ArrayShapeType.php", "language": "php", "file_size": 4388, "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\TypeInfo\Type; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeIdentifier; /** ...
ifier { return $this->typeIdentifier; } public function isIdentifiedBy(TypeIdentifier|string ...$identifiers): bool { foreach ($identifiers as $identifier) { if ($identifier === $this->typeIdentifier || $identif
* @param T $typeIdentifier */ public function __construct( private readonly TypeIdentifier $typeIdentifier, ) { } /** * @return T */ public function getTypeIdentifier(): TypeIdent
{ "filepath": "src/Symfony/Component/TypeInfo/Type/BuiltinType.php", "language": "php", "file_size": 2297, "cut_index": 563, "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\TypeInfo\Type; use Symfony\Component\TypeInfo\Type; /*...
> */ public function getTypes(): array; /** * @param-immediately-invoked-callable $specification * * @param callable(Type): bool $specification */ public function composedTypesAreSatisfiedBy(callable $specification): b
@return list<T
{ "filepath": "src/Symfony/Component/TypeInfo/Type/CompositeTypeInterface.php", "language": "php", "file_size": 791, "cut_index": 514, "middle_length": 14 }
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\Cache\Tests\Adapter; use PHPUnit\Framework\Attributes\Group; use ...
} public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface { if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) { self::$redis->setOption(\Redis::OP
st extends RedisAdapterTest { use TagAwareTestTrait; protected function setUp(): void { parent::setUp(); $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
{ "filepath": "src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php", "language": "php", "file_size": 1262, "cut_index": 524, "middle_length": 229 }