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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExtens... | c function getStore(): ZookeeperStore
{
$zookeeper_server = getenv('ZOOKEEPER_HOST').':2181';
$zookeeper = new \Zookeeper($zookeeper_server);
return StoreFactory::createStore($zookeeper);
}
#[DataProvider('provideVali |
* @author Ganesh Chandrasekaran <gchandrasekaran@wayfair.com>
*/
#[RequiresPhpExtension('zookeeper')]
#[Group('integration')]
class ZookeeperStoreTest extends AbstractStoreTestCase
{
use UnserializableTestTrait;
publi | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/ZookeeperStoreTest.php",
"language": "php",
"file_size": 3571,
"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 MongoDB;
use MongoDB\Driver\Manager;
/*
* Stubs for the mongodb/mongodb library version ~1.16
*/
if (!class_exists(Client::class)) {
abstract class Client
... | e(): string;
}
}
if (!class_exists(Collection::class)) {
abstract class Collection
{
abstract public function getManager(): Manager;
abstract public function getCollectionName(): string;
abstract public function getDa | er;
abstract public function getDatabaseNam | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/stubs/mongodb.php",
"language": "php",
"file_size": 944,
"cut_index": 606,
"middle_length": 52
} |
s\DynamoDb\Exception\ResourceNotFoundException;
use AsyncAws\DynamoDb\Input\CreateTableInput;
use AsyncAws\DynamoDb\Input\DeleteItemInput;
use AsyncAws\DynamoDb\Input\DescribeTableInput;
use AsyncAws\DynamoDb\Input\GetItemInput;
use AsyncAws\DynamoDb\Input\PutItemInput;
use AsyncAws\DynamoDb\ValueObject\AttributeDefini... | Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\Store\ExpiringStoreTrait;
class DynamoDbStore implements PersistingStoreInterface
{
use ExpiringStoreTrait;
private const DEFAULT_OPTIONS = [
| Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\InvalidTtlException;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\ | {
"filepath": "src/Symfony/Component/Lock/Bridge/DynamoDb/Store/DynamoDbStore.php",
"language": "php",
"file_size": 11452,
"cut_index": 921,
"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\Bridge\DynamoDb\Tests\Functional\Store;
use PHPU... | 'DynamoDB server not found.');
}
$store = new DynamoDbStore(getenv('LOCK_DYNAMODB_DSN'));
$store->createTable();
}
protected function getStore(): PersistingStoreInterface
{
return new DynamoDbStore(getenv('LOCK | reTestCase;
#[Group('integration')]
class DynamoDbStoreTest extends AbstractStoreTestCase
{
public static function setUpBeforeClass(): void
{
if (!getenv('LOCK_DYNAMODB_DSN')) {
self::markTestSkipped( | {
"filepath": "src/Symfony/Component/Lock/Bridge/DynamoDb/Tests/Functional/Store/DynamoDbStoreTest.php",
"language": "php",
"file_size": 1023,
"cut_index": 512,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Bridge\DynamoDb\Tests\Store;
use AsyncAws\DynamoDb\DynamoDbClient;
use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\Lock\Bridge\DynamoDb\Store\DynamoDbStore;... | lt/lock_keys', [
'extra_key',
]);
}
public function testExtraParamsInQuery()
{
$this->expectException(\InvalidArgumentException::class);
new DynamoDbStore('dynamodb://default/lock_keys?extra_param=some_value | pClient()
{
$this->httpClient = new MockHttpClient([]);
}
public function testExtraOptions()
{
$this->expectException(\InvalidArgumentException::class);
new DynamoDbStore('dynamodb://defau | {
"filepath": "src/Symfony/Component/Lock/Bridge/DynamoDb/Tests/Store/DynamoDbStoreTest.php",
"language": "php",
"file_size": 6710,
"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\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Compon... | $this->assertTrue($store->exists($key));
$store->delete($key);
$this->assertFalse($store->exists($key));
}
public function testSaveWithDifferentResources()
{
$store = $this->getStore();
$key1 = new Key( | ersistingStoreInterface;
public function testSave()
{
$store = $this->getStore();
$key = new Key(static::class.__METHOD__);
$this->assertFalse($store->exists($key));
$store->save($key);
| {
"filepath": "src/Symfony/Component/Lock/Test/AbstractStoreTestCase.php",
"language": "php",
"file_size": 3613,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Yaml;
use Symfony\Component\Yaml\Tag\TaggedValue;
/**
* Dumper dumps PHP variables to YAML strings.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*/
class Dumper
{
/**
* @param int $indentation The amount of spaces to use for ... | e you switch to inline YAML
* @param int $indent The level of indentation (used internally)
* @param int-mask-of<Yaml::DUMP_*> $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string
*/
pub | entation must be greater than zero.');
}
}
/**
* Dumps a PHP value to YAML.
*
* @param mixed $input The PHP value
* @param int $inline The level wher | {
"filepath": "src/Symfony/Component/Yaml/Dumper.php",
"language": "php",
"file_size": 8413,
"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\Yaml;
/**
* Escaper encapsulates escaping rules for single and double-quoted
* YAML strings.
*
* @author Matthew Lewinski <matthew@lewinski.org>
*
* ... | the characters avoids the use of strtr,
// which performs more slowly.
private const ESCAPEES = [
'\\', '\\\\', '\\"', '"',
"\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07",
"\x08", "\x09", "\x0a", "\ | xe2\x80\xa8|\xe2\x80\xa9";
// Mapping arrays for escaping a double quoted string. The backslash is
// first to ensure proper escaping because str_replace operates iteratively
// on the input arrays. This ordering of | {
"filepath": "src/Symfony/Component/Yaml/Escaper.php",
"language": "php",
"file_size": 3432,
"cut_index": 614,
"middle_length": 229
} |
ng to a PHP value.
*
* @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior
* @param array $references Mapping of variable names to values
*
* @throws ParseException
*/
public static function parse(string $value, int $flags = 0, array &$... | te, $value, $flags, $i, $references);
++$i;
break;
case '{':
$result = self::parseMapping($state, $value, $flags, $i, $references);
++$i;
break;
default | return '';
}
$i = 0;
$isQuoted = null;
$tag = self::parseTag($value, $i, $flags);
switch ($value[$i]) {
case '[':
$result = self::parseSequence($sta | {
"filepath": "src/Symfony/Component/Yaml/Inline.php",
"language": "php",
"file_size": 42914,
"cut_index": 2151,
"middle_length": 229
} |
ting depth must be greater than 0.');
}
if ($maxAliasesForCollections < 0) {
throw new \InvalidArgumentException('The maximum number of collection aliases must be greater than or equal to 0.');
}
$this->getState()->maxNestingLevel = $maxNestingLevel;
$this->getState... | is not valid
*/
public function parseFile(string $filename, int $flags = 0): mixed
{
if (!is_file($filename)) {
throw new ParseException(\sprintf('File "%s" does not exist.', $filename));
}
if (!is_readable | AML file to be parsed
* @param int-mask-of<Yaml::PARSE_*> $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior
*
* @throws ParseException If the file could not be read or the YAML | {
"filepath": "src/Symfony/Component/Yaml/Parser.php",
"language": "php",
"file_size": 54299,
"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\Yaml;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Tag\TaggedValue;
... | ->collectionAliasCount = 0;
$this->aliasesEnabled = true;
}
public function enterNestingLevel(int $line, ?string $snippet, ?string $filename): void
{
if (++$this->currentNestingLevel > $this->maxNestingLevel) {
--$t | tions = Parser::DEFAULT_MAX_ALIASES_FOR_COLLECTIONS;
public int $collectionAliasCount = 0;
public bool $aliasesEnabled = true;
public function reset(): void
{
$this->currentNestingLevel = 0;
$this | {
"filepath": "src/Symfony/Component/Yaml/ParserState.php",
"language": "php",
"file_size": 2164,
"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\Yaml;
use Symfony\Component\Yaml\Exception\ParseException;
/**
* Unescaper encapsulates unescaping rules for single and double-quoted
* YAML strings.
*... | ction unescapeSingleQuotedString(string $value): string
{
return str_replace('\'\'', '\'', $value);
}
/**
* Unescapes a double quoted string.
*
* @param string $value A double quoted string
*/
public function un | public const REGEX_ESCAPED_CHARACTER = '\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)';
/**
* Unescapes a single quoted string.
*
* @param string $value A single quoted string
*/
public fun | {
"filepath": "src/Symfony/Component/Yaml/Unescaper.php",
"language": "php",
"file_size": 3125,
"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\Yaml;
use Symfony\Component\Yaml\Exception\ParseException;
/**
* Yaml offers convenience methods to load and dump YAML.
*
* @author Fabien Potencier <f... | ARSE_CONSTANT = 256;
public const PARSE_CUSTOM_TAGS = 512;
public const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024;
public const DUMP_NULL_AS_TILDE = 2048;
public const DUMP_NUMERIC_KEY_AS_STRING = 4096;
public const DUMP_NULL_AS_EMPTY = 8192; | SE_OBJECT_FOR_MAP = 8;
public const DUMP_EXCEPTION_ON_INVALID_TYPE = 16;
public const PARSE_DATETIME = 32;
public const DUMP_OBJECT_AS_MAP = 64;
public const DUMP_MULTI_LINE_LITERAL_BLOCK = 128;
public const P | {
"filepath": "src/Symfony/Component/Yaml/Yaml.php",
"language": "php",
"file_size": 4211,
"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\Yaml\Exception;
/**
* Exception class thrown when an error occurs during parsing.
*
* @author Fabien ... | rivate string $rawMessage,
private int $parsedLine = -1,
private ?string $snippet = null,
private ?string $parsedFile = null,
?\Throwable $previous = null,
) {
$this->updateRepr();
parent::__construct($t | e where the error occurred
* @param string|null $snippet The snippet of code near the problem
* @param string|null $parsedFile The file name where the error occurred
*/
public function __construct(
p | {
"filepath": "src/Symfony/Component/Yaml/Exception/ParseException.php",
"language": "php",
"file_size": 2969,
"cut_index": 563,
"middle_length": 229
} |
Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputArgument... | neau <lyrixx@lyrixx.info>
* @author Robin Chalas <robin.chalas@gmail.com>
*/
#[AsCommand(name: 'lint:yaml', description: 'Lint a YAML file and outputs encountered errors')]
class LintCommand extends Command
{
private Parser $parser;
private ?stri | \SymfonyStyle;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Yaml;
/**
* Validates YAML files syntax and outputs encountered errors.
*
* @author Grégoire Pi | {
"filepath": "src/Symfony/Component/Yaml/Command/LintCommand.php",
"language": "php",
"file_size": 10354,
"cut_index": 921,
"middle_length": 229
} |
- foo
- a: A
foobar:
foo: bar
bar:
- 1
- foo
foobar:
foo: bar
bar:
- 1
... | th.'/'.$file.'.yml');
// split YAMLs documents
foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) {
if (!$yaml) {
continue;
}
$test = $this->parser-> | ted));
}
public function testSpecifications()
{
$files = $this->parser->parse(file_get_contents($this->path.'/index.yml'));
foreach ($files as $file) {
$yamls = file_get_contents($this->pa | {
"filepath": "src/Symfony/Component/Yaml/Tests/DumperTest.php",
"language": "php",
"file_size": 44018,
"cut_index": 2151,
"middle_length": 229
} |
mponent\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT],
['!php/const PHP_INT_MAX', \PHP_INT_MAX],
['[!php/const PHP_INT_MAX]', [\PHP_INT_MAX]],
['{ foo: !php/const PHP_INT_MAX }', ['foo' => \PHP_INT_MAX]],
['{ !php/const PHP_INT_MAX: foo }', [\PHP_INT_MAX => 'foo']],
... | t WRONG_CONSTANT', Yaml::PARSE_CONSTANT);
}
public function testParsePhpEnumThrowsExceptionWhenUndefined()
{
$this->expectException(ParseException::class);
$this->expectExceptionMessage('The enum "SomeEnum" is not defined');
| stParsePhpConstantThrowsExceptionWhenUndefined()
{
$this->expectException(ParseException::class);
$this->expectExceptionMessage('The constant "WRONG_CONSTANT" is not defined');
Inline::parse('!php/cons | {
"filepath": "src/Symfony/Component/Yaml/Tests/InlineTest.php",
"language": "php",
"file_size": 47450,
"cut_index": 2151,
"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\Yaml\Tests;
use PHPUnit\Framework\TestCase;
use Symfo... | estGetMessageWithUnicodeInFilename()
{
$exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
$message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
$this->assertEquals($message, $exception- | 'foo: bar', '/var/www/app/config.yml');
$message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
$this->assertEquals($message, $exception->getMessage());
}
public function t | {
"filepath": "src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php",
"language": "php",
"file_size": 1027,
"cut_index": 512,
"middle_length": 229
} |
'barbara']);
$this->assertSameData($expected, $data);
}
public function testTaggedValueTopLevelList()
{
$yml = <<<'YAML'
!users
- barbara
YAML;
$data = $this->parser->parse($yml, Yaml::PARSE_CUSTOM_TAGS);
$expected = new TaggedValue('users... | $this->parser->parse($yml, Yaml::PARSE_CUSTOM_TAGS);
}
#[DataProvider('getDataFormSpecifications')]
public function testSpecifications($expected, $yaml, $comment)
{
$this->assertEquals($expected, var_export($this->parser->parse( | line
YAML;
// @todo Fix the parser, eliminate this exception.
$this->expectException(ParseException::class);
$this->expectExceptionMessage('Unable to parse at line 2 (near "!text |").');
| {
"filepath": "src/Symfony/Component/Yaml/Tests/ParserTest.php",
"language": "php",
"file_size": 94671,
"cut_index": 3790,
"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\Tests;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Symfony\Component\Lock\Key;
use ... | ly(2))
->method('save')
->with($this->callback(static function ($key) use (&$keys) {
$keys[] = $key;
return true;
}));
$factory = new LockFactory($store);
$factory->setLo | blic function testCreateLock()
{
$store = $this->createMock(PersistingStoreInterface::class);
$store->method('exists')->willReturn(false);
$keys = [];
$store
->expects($this->exact | {
"filepath": "src/Symfony/Component/Lock/Tests/LockFactoryTest.php",
"language": "php",
"file_size": 2166,
"cut_index": 563,
"middle_length": 229
} |
\Component\Lock\SharedLockStoreInterface;
use Symfony\Component\Lock\Store\ExpiringStoreTrait;
use Symfony\Component\Lock\Store\InMemoryStore;
/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class LockTest extends TestCase
{
public function testAcquireNoBlocking()
{
$key = new Key(__METHOD__);
... | key = new Key(__METHOD__);
$store = $this->createMock(PersistingStoreInterface::class);
$lock = new Lock($key, $store);
$store
->expects($this->once())
->method('save');
$store
->method(' | $store
->method('exists')
->willReturn(true, false);
$this->assertTrue($lock->acquire(false));
}
public function testAcquireNoBlockingWithPersistingStoreInterface()
{
$ | {
"filepath": "src/Symfony/Component/Lock/Tests/LockTest.php",
"language": "php",
"file_size": 17568,
"cut_index": 1331,
"middle_length": 229
} |
LException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServe... |
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
/**
* DbalStore is a PersistingStoreInterface implementation using a Doctrine DBAL connection.
*
* Lock | straint;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tools\DsnParser;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\InvalidTtlException; | {
"filepath": "src/Symfony/Component/Lock/Store/DoctrineDbalStore.php",
"language": "php",
"file_size": 12722,
"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\Lock\Store;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\InvalidTtlException;
use Symfony\Component\... | ic function isSupported(): bool
{
return \extension_loaded('memcached');
}
/**
* @param int $initialTtl the expiration delay of locks in seconds
*/
public function __construct(
private \Memcached $memcached,
| using Memcached as store engine.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class MemcachedStore implements PersistingStoreInterface
{
use ExpiringStoreTrait;
private bool $useExtendedReturn;
public stat | {
"filepath": "src/Symfony/Component/Lock/Store/MemcachedStore.php",
"language": "php",
"file_size": 4819,
"cut_index": 614,
"middle_length": 229
} |
MongoDB\Driver\Command;
use MongoDB\Driver\Exception\BulkWriteException;
use MongoDB\Driver\Manager;
use MongoDB\Driver\Query;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern;
use MongoDB\Exception\DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException as MongoInvalidArgumentException... | omponent\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
/**
* MongoDbStore is a StoreInterface implementation using MongoDB as a storage
* engine. Support for MongoDB server >=2.2 due to use of TTL indexes.
*
* CAUTION: TTL Indexes are | k\Exception\LockAcquiringException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\LockExpiredException;
use Symfony\Component\Lock\Exception\LockStorageException;
use Symfony\C | {
"filepath": "src/Symfony/Component/Lock/Store/MongoDbStore.php",
"language": "php",
"file_size": 14606,
"cut_index": 921,
"middle_length": 229
} |
ent\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\SharedLockStoreInterface;
/**
* PostgreSqlStore is a PersistingStoreInterface implementation using
* PostgreSql advisory locks.
*
* @author Jérémy De... | zy-connect to the database when the
* lock is actually used.
*
* List of available options:
* * db_username: The username when lazy-connect [default: '']
* * db_password: The password when lazy-connect [default: '']
* * db_ | $username = null;
private ?string $password = null;
private array $connectionOptions = [];
/**
* You can either pass an existing database connection as PDO instance or
* a DSN string that will be used to la | {
"filepath": "src/Symfony/Component/Lock/Store/PostgreSqlStore.php",
"language": "php",
"file_size": 9571,
"cut_index": 921,
"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\BlockingStoreInterface;
use Symfony\Component\Lock\Exception\Inva... |
public static function isSupported(): bool
{
return \extension_loaded('sysvsem');
}
/**
* @param string $projectId A scoping prefix folded into the System V key derivation to isolate one
* applic | maphore as store engine.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class SemaphoreStore implements BlockingStoreInterface
{
/**
* Returns whether or not the store is supported.
*
* @internal
*/ | {
"filepath": "src/Symfony/Component/Lock/Store/SemaphoreStore.php",
"language": "php",
"file_size": 2721,
"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\Lock\Tests\Strategy;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use ... | ;
yield [2, 1, 3, false];
yield [2, 0, 3, false];
yield [1, 2, 3, false];
yield [1, 1, 3, false];
yield [1, 0, 3, false];
yield [0, 3, 3, false];
yield [0, 2, 3, false];
yield [0, 1, 3, false] | y;
protected function setUp(): void
{
$this->strategy = new UnanimousStrategy();
}
public static function provideMetResults()
{
// success, failure, total, isMet
yield [3, 0, 3, true] | {
"filepath": "src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php",
"language": "php",
"file_size": 2300,
"cut_index": 563,
"middle_length": 229
} |
ion\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\SharedLockStoreInterface;
use Symfony\Component\Lock\Store\CombinedStore;
use Symfony\Component\Lock\Store\RedisStore;
use Symfony\Component\Lock\Strategy\StrategyInterface;
use S... | ersistingStoreInterface
{
$redis = new \Predis\Client(
array_combine(['host', 'port'], explode(':', getenv('REDIS_HOST')) + [1 => 6379]),
['exceptions' => false],
);
try {
$redis->connect();
| ombinedStoreTest extends AbstractStoreTestCase
{
use ExpiringStoreTestTrait;
use SharedLockStoreTestTrait;
protected function getClockDelay(): int
{
return 250000;
}
public function getStore(): P | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php",
"language": "php",
"file_size": 13004,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Tests\Store;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\DBAL\Tools\DsnParser;
use PHPU... | ponent\Lock\Test\AbstractStoreTestCase;
/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
#[RequiresPhpExtension('pdo_pgsql')]
#[Group('integration')]
class DoctrineDbalPostgreSqlStoreTest extends AbstractStoreTestCase
{
use BlockingStoreTestTrai | ion;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\Store\DoctrineDbalPostgreSqlStore;
use Symfony\Com | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/DoctrineDbalPostgreSqlStoreTest.php",
"language": "php",
"file_size": 6076,
"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\Tests\Store;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\L... | Interface
{
return new FlockStore();
}
public function testConstructWhenRepositoryCannotBeCreated()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The FlockStore directory | <jeremy@derusse.com>
*/
class FlockStoreTest extends AbstractStoreTestCase
{
use BlockingStoreTestTrait;
use SharedLockStoreTestTrait;
use UnserializableTestTrait;
protected function getStore(): PersistingStore | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php",
"language": "php",
"file_size": 3037,
"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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpEx... | stCase
{
use ExpiringStoreTestTrait;
public static function setUpBeforeClass(): void
{
if (version_compare(phpversion('memcached'), '3.1.6', '<')) {
self::markTestSkipped('Extension memcached > 3.1.5 required.');
}
| edStore;
use Symfony\Component\Lock\Test\AbstractStoreTestCase;
/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
#[RequiresPhpExtension('memcached')]
#[Group('integration')]
class MemcachedStoreTest extends AbstractStoreTe | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php",
"language": "php",
"file_size": 2096,
"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\Lock\Tests\Store;
use PHPUnit\Framework\TestCase;
use Symfony\C... | = new Key('foo');
$this->assertFalse($store->exists($key));
}
public function testSaveDoesNothing()
{
$store = new NullStore();
$key = new Key('foo');
$store->save($key);
$this->assertFalse($store->e | ;
$key | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/NullStoreTest.php",
"language": "php",
"file_size": 814,
"cut_index": 522,
"middle_length": 14
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Compone... | ic function getPostgresHost(): string
{
if (!$host = getenv('POSTGRES_HOST')) {
$this->markTestSkipped('Missing POSTGRES_HOST env variable');
}
return $host;
}
public function getStore(): PersistingStoreInt | y Derussé <jeremy@derusse.com>
*/
#[RequiresPhpExtension('pdo_pgsql')]
#[Group('integration')]
class PostgreSqlStoreTest extends AbstractStoreTestCase
{
use BlockingStoreTestTrait;
use SharedLockStoreTestTrait;
publ | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/PostgreSqlStoreTest.php",
"language": "php",
"file_size": 5388,
"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\Store;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Compone... | use ExpiringStoreTrait;
public function __construct(
private \Zookeeper $zookeeper,
) {
}
public static function createConnection(#[\SensitiveParameter] string $dsn): \Zookeeper
{
if (!str_starts_with($dsn, 'zookeepe | *
* ZookeeperStore is a PersistingStoreInterface implementation using Zookeeper as store engine.
*
* @author Ganesh Chandrasekaran <gchandrasekaran@wayfair.com>
*/
class ZookeeperStore implements PersistingStoreInterface
{
| {
"filepath": "src/Symfony/Component/Lock/Store/ZookeeperStore.php",
"language": "php",
"file_size": 4729,
"cut_index": 614,
"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\Serializer;
use PHPUnit\Framework\TestCase;
use Symfon... | ormalizer->denormalize($normalizer->normalize($key), Key::class);
$this->assertSame($key->getState('foo'), $copy->getState('foo'));
$this->assertEqualsWithDelta($key->getRemainingLifetime(), $copy->getRemainingLifetime(), 0.001);
}
| public function testNormalizeAndDenormalize()
{
$key = new Key(__METHOD__);
$key->reduceLifetime(1);
$key->setState('foo', 'bar');
$normalizer = new LockKeyNormalizer();
$copy = $n | {
"filepath": "src/Symfony/Component/Lock/Tests/Serializer/LockKeyNormalizerTest.php",
"language": "php",
"file_size": 1307,
"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\Lock\Store;
use Symfony\Component\Lock\BlockingStoreInterface;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Ex... | <lyrixx@lyrixx.info>
* @author Romain Neutron <imprec@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
class FlockStore implements BlockingStoreInterface, SharedLockStoreInterface
{
private readonly string $lockPath;
/**
* @param st | ore is a PersistingStoreInterface implementation using the FileSystem flock.
*
* Original implementation in \Symfony\Component\Filesystem\LockHandler.
*
* @author Jérémy Derussé <jeremy@derusse.com>
* @author Grégoire Pineau | {
"filepath": "src/Symfony/Component/Lock/Store/FlockStore.php",
"language": "php",
"file_size": 4735,
"cut_index": 614,
"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\Store;
use Symfony\Component\Lock\BlockingSharedLockS... | ts(Key $key): bool
{
return false;
}
public function putOffExpiration(Key $key, float $ttl): void
{
}
public function saveRead(Key $key): void
{
}
public function waitAndSaveRead(Key $key): void
{
}
}
| ey $key): void
{
}
public function exis | {
"filepath": "src/Symfony/Component/Lock/Store/NullStore.php",
"language": "php",
"file_size": 825,
"cut_index": 517,
"middle_length": 52
} |
mponent\Lock\Exception\InvalidTtlException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\LockStorageException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\SharedLockStoreInterface;
/**
* RedisStore is a PersistingStoreInterface implementation using ... | ruct(
private \Redis|Relay|RelayCluster|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis,
private float $initialTtl = 300.0,
) {
if ($initialTtl <= 0) {
throw new InvalidTtlException(\sprintf('"%s()" expects | ringStoreTrait;
private const NO_SCRIPT_ERROR_MESSAGE_PREFIX = 'NOSCRIPT';
private bool $supportTime;
/**
* @param float $initialTtl The expiration delay of locks in seconds
*/
public function __const | {
"filepath": "src/Symfony/Component/Lock/Store/RedisStore.php",
"language": "php",
"file_size": 12830,
"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\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresFunction;
use PHPUnit\Framework\Attributes\RequiresPhpEx... | terface;
/**
* Tests blocking locks thanks to pcntl.
*
* This test is time sensible: the $clockDelay could be adjust.
*
* It also fails when run with the global ./phpunit test suite.
*/
#[Group('transient')]
#[Req | ractStoreTestCase;
/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
trait BlockingStoreTestTrait
{
/**
* @see AbstractStoreTestCase::getStore()
*/
abstract protected function getStore(): PersistingStoreIn | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php",
"language": "php",
"file_size": 3237,
"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\Lock\Tests\Store;
use Symfony\Component\Lock\Exception\LockExpiredException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInte... | **
* @see AbstractStoreTestCase::getStore()
*/
abstract protected function getStore();
/**
* Tests the store automatically delete the key when it expire.
*
* This test is time-sensitive: the $clockDelay could be adjusted.
| as a delay to test expiration. Should be
* small enough not to slow the test suite too much, and high enough not to
* fail because of race conditions.
*/
abstract protected function getClockDelay(): int;
/ | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php",
"language": "php",
"file_size": 3692,
"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\Lock\Tests\Store;
use MongoDB\Collection;
use MongoDB\Driver\Manager;
use PHPU... | {
$collection = $this->createMock(Collection::class);
$collection->expects($this->once())
->method('getManager')
->willReturn(new Manager());
$collection->expects($this->once())
->method('getCol | __.'/stubs/mongodb.php';
/**
* @author Alexandre Daubois <alex.daubois@gmail.com>
*/
#[RequiresPhpExtension('mongodb')]
class MongoDbStoreFactoryTest extends TestCase
{
public function testCreateMongoDbCollectionStore()
| {
"filepath": "src/Symfony/Component/Lock/Tests/Store/MongoDbStoreFactoryTest.php",
"language": "php",
"file_size": 1541,
"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\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Lock\Excepti... |
$this->assertEqualsWithDelta($key->getRemainingLifetime(), $copy->getRemainingLifetime(), 0.001);
}
public function testLegacyPayloadCanBeUnserialized()
{
$serialized = base64_decode('TzoyNjoiU3ltZm9ueVxDb21wb25lbnRcTG9ja1xLZX | {
$key = new Key(__METHOD__);
$key->reduceLifetime(1);
$key->setState('foo', 'bar');
$copy = unserialize(serialize($key));
$this->assertSame($key->getState('foo'), $copy->getState('foo')); | {
"filepath": "src/Symfony/Component/Lock/Tests/KeyTest.php",
"language": "php",
"file_size": 1713,
"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\Lock\Tests\Strategy;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use ... | ;
yield [2, 1, 3, true];
yield [2, 0, 3, true];
yield [1, 2, 3, false];
yield [1, 1, 3, false];
yield [1, 0, 3, false];
yield [0, 3, 3, false];
yield [0, 2, 3, false];
yield [0, 1, 3, false];
| y;
protected function setUp(): void
{
$this->strategy = new ConsensusStrategy();
}
public static function provideMetResults()
{
// success, failure, total, isMet
yield [3, 0, 3, true] | {
"filepath": "src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php",
"language": "php",
"file_size": 2295,
"cut_index": 563,
"middle_length": 229
} |
ny\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
/**
* PdoStore is a PersistingStoreInterface implementation using a PDO connection.
*
* Lock metadata are stored in a table. You can use createTable() to initialize
* a correctl... | TableTrait;
use ExpiringStoreTrait;
private \PDO $conn;
private string $dsn;
private string $driver;
private ?string $username = null;
private ?string $password = null;
private array $connectionOptions = [];
/**
* You | ematurely; the TTLs should be set with enough
* extra time to account for any clock drift between nodes.
*
* @author Jérémy Derussé <jeremy@derusse.com>
*/
class PdoStore implements PersistingStoreInterface
{
use Database | {
"filepath": "src/Symfony/Component/Lock/Store/PdoStore.php",
"language": "php",
"file_size": 12958,
"cut_index": 921,
"middle_length": 229
} |
TableNotFoundException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
use Doctrine\DBAL\Schema\Schema;
use PHPUnit\Framework\At... | m>
*/
#[RequiresPhpExtension('pdo_sqlite')]
class DoctrineDbalStoreTest extends AbstractStoreTestCase
{
use ExpiringStoreTestTrait;
protected static string $dbFile;
public static function setUpBeforeClass(): void
{
self::$dbFile | Component\Lock\Key;
use Symfony\Component\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\Store\DoctrineDbalStore;
use Symfony\Component\Lock\Test\AbstractStoreTestCase;
/**
* @author Jérémy Derussé <jeremy@derusse.co | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/DoctrineDbalStoreTest.php",
"language": "php",
"file_size": 12023,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Tests\Store;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Symfony\Component\Lock\Exception\InvalidTtlException;
use Symfony\Component\Lock\Exception\Lo... |
public static function setUpBeforeClass(): void
{
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_lock');
$store = new PdoStore('sqlite:'.self::$dbFile);
$store->createTable();
}
public static function tear | toreTestCase;
/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
#[RequiresPhpExtension('pdo_sqlite')]
class PdoStoreTest extends AbstractStoreTestCase
{
use ExpiringStoreTestTrait;
protected static string $dbFile;
| {
"filepath": "src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php",
"language": "php",
"file_size": 5678,
"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 Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\... | lay(): int
{
return 250000;
}
abstract protected function getRedisConnection(): \Redis|Relay|RelayCluster|\RedisArray|\RedisCluster|\Predis\ClientInterface;
public function getStore(): PersistingStoreInterface
{
return | Lock\Test\AbstractStoreTestCase;
/**
* @author Jérémy Derussé <jeremy@derusse.com>
*/
abstract class AbstractRedisStoreTestCase extends AbstractStoreTestCase
{
use ExpiringStoreTestTrait;
protected function getClockDe | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTestCase.php",
"language": "php",
"file_size": 3657,
"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\Lock\Store;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\SharedLockStoreInterfa... | if (isset($this->locks[$hashKey])) {
// already acquired
if ($this->locks[$hashKey] === $token) {
return;
}
throw new LockConflictedException();
}
// check for promotion
| SharedLockStoreInterface
{
private array $locks = [];
private array $readLocks = [];
public function save(Key $key): void
{
$hashKey = (string) $key;
$token = $this->getUniqueToken($key);
| {
"filepath": "src/Symfony/Component/Lock/Store/InMemoryStore.php",
"language": "php",
"file_size": 3054,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Lock\Tests\Store;
use MongoDB\Client;
use MongoDB\Collection;
use MongoDB\Database;
use MongoDB\Driver\Command;
use MongoDB\Driver\Exception\ConnectionTimeoutException;
use MongoDB\Driver\Manager;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\F... | m>
*/
#[RequiresPhpExtension('mongodb')]
#[Group('integration')]
class MongoDbStoreTest extends AbstractStoreTestCase
{
use ExpiringStoreTestTrait;
public static function setUpBeforeClass(): void
{
$manager = self::getMongoManager();
| ponent\Lock\PersistingStoreInterface;
use Symfony\Component\Lock\Store\MongoDbStore;
use Symfony\Component\Lock\Test\AbstractStoreTestCase;
require_once __DIR__.'/stubs/mongodb.php';
/**
* @author Joe Bennett <joe@assimtech.co | {
"filepath": "src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php",
"language": "php",
"file_size": 8051,
"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\Yaml\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Exception\ParseException;
use Sym... | dArgumentException::class);
$this->expectExceptionMessage('The indentation must be greater than zero');
Yaml::dump(['lorem' => 'ipsum', 'dolor' => 'sit'], 2, 0);
}
public function testNegativeIndentationThrowsException()
{
| t'];
$yml = Yaml::dump($data);
$parsed = Yaml::parse($yml);
$this->assertEquals($data, $parsed);
}
public function testZeroIndentationThrowsException()
{
$this->expectException(\Invali | {
"filepath": "src/Symfony/Component/Yaml/Tests/YamlTest.php",
"language": "php",
"file_size": 2195,
"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\PropertyInfo\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Sy... | rBuilder();
$tag = 'property_info.constructor_extractor';
$definition = $container->register('property_info.constructor_extractor')->setArguments([null, null]);
$container->register('n2')->addTag($tag, ['priority' => 100]);
| onent\PropertyInfo\DependencyInjection\PropertyInfoConstructorPass;
class PropertyInfoConstructorPassTest extends TestCase
{
public function testServicesAreOrderedAccordingToPriority()
{
$container = new Containe | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/DependencyInjection/PropertyInfoConstructorPassTest.php",
"language": "php",
"file_size": 1904,
"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\PropertyInfo\Tests\DependencyInjection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Frame... | $tag)
{
$container = new ContainerBuilder();
$definition = $container->register('property_info')->setArguments([null, null, null, null, null]);
$container->register('n2')->addTag($tag, ['priority' => 100]);
$container- | nce;
use Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass;
class PropertyInfoPassTest extends TestCase
{
#[DataProvider('provideTags')]
public function testServicesAreOrderedAccordingToPriority($index, | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/DependencyInjection/PropertyInfoPassTest.php",
"language": "php",
"file_size": 2708,
"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\PropertyInfo\Tests\Extractor;
use PHPUnit\Framework\TestCase;
use... | void
{
$this->extractor = new ConstructorExtractor([new DummyExtractor()]);
}
public function testInstanceOf()
{
$this->assertInstanceOf(PropertyTypeExtractorInterface::class, $this->extractor);
}
public function | tor;
use Symfony\Component\TypeInfo\Type;
/**
* @author Dmitrii Poddubnyi <dpoddubny@gmail.com>
*/
class ConstructorExtractorTest extends TestCase
{
private ConstructorExtractor $extractor;
protected function setUp(): | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php",
"language": "php",
"file_size": 1305,
"cut_index": 524,
"middle_length": 229
} |
ck;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyCollection;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyGeneric;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\ChildOfParentUsingTrait;
use Symfony\Component\PropertyInfo\Tests\Fi... | onent\PropertyInfo\Tests\Fixtures\Extractor\ClassUsingTraitWithSelfDocBlock;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\ParentUsingTraitWithSelfDocBlock;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\ParentWithPromotedPropert | res\Extractor\ChildWithoutConstructorOverride;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\ChildWithSelfDocBlock;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\ClassUsingNestedTrait;
use Symfony\Comp | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php",
"language": "php",
"file_size": 27174,
"cut_index": 1331,
"middle_length": 229
} |
ropertyInfo\Tests\Fixtures\DefaultValue;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DockBlockFallback;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyCollection;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyGeneric;
use Symfony\Component\... | ummyWithStaticGetterInDifferentNs;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\DummyWithTemplateAndParentInDifferentNs;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\PromotedPropertiesWithDocBlock;
use Symfony\Component\Proper | nionType;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyWithTemplateAndParent;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\DummyInDifferentNs;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Extractor\D | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php",
"language": "php",
"file_size": 24905,
"cut_index": 1331,
"middle_length": 229
} |
opertyInfo\Tests\Fixtures\Php81Dummy;
use Symfony\Component\PropertyInfo\Tests\Fixtures\Php82Dummy;
use Symfony\Component\PropertyInfo\Tests\Fixtures\SnakeCaseDummy;
use Symfony\Component\PropertyInfo\Tests\Fixtures\UnderscoreDummy;
use Symfony\Component\PropertyInfo\Tests\Fixtures\VirtualProperties;
use Symfony\Compon... | [
'bal',
'parent',
'collection',
'collectionAsObject',
'nestedCollection',
'mixedCollection',
'B',
'Guid',
| ase
{
private ReflectionExtractor $extractor;
protected function setUp(): void
{
$this->extractor = new ReflectionExtractor();
}
public function testGetProperties()
{
$this->assertSame(
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php",
"language": "php",
"file_size": 39225,
"cut_index": 2151,
"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\PropertyInfo\Tests\Extractor;
use PHPUnit\Framework\TestCase;
use Symfony\Comp... | @gmail.com>
*/
class SerializerExtractorTest extends TestCase
{
private SerializerExtractor $extractor;
protected function setUp(): void
{
$classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());
$this->extract | onent\PropertyInfo\Tests\Fixtures\IgnorePropertyDummy;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
/**
* @author Kévin Dunglas <dunglas | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php",
"language": "php",
"file_size": 1873,
"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\PropertyInfo\DependencyInjection;
use Symfony\Component\Dependenc... | ass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('property_info.constructor_extractor')) {
return;
}
| se Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Adds extractors to the property_info.constructor_extractor service.
*
* @author Dmitrii Poddubnyi <dpoddubny@gmail.com>
*/
final class PropertyInfoConstructorP | {
"filepath": "src/Symfony/Component/PropertyInfo/DependencyInjection/PropertyInfoConstructorPass.php",
"language": "php",
"file_size": 1297,
"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\PropertyInfo\DependencyInjection;
use Symfony\Component\DependencyInjection\Ar... | gedServiceTrait;
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('property_info')) {
return;
}
$definition = $container->getDefinition('property_info');
$lis | mponent\DependencyInjection\ContainerBuilder;
/**
* Adds extractors to the property_info service.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class PropertyInfoPass implements CompilerPassInterface
{
use PriorityTag | {
"filepath": "src/Symfony/Component/PropertyInfo/DependencyInjection/PropertyInfoPass.php",
"language": "php",
"file_size": 1993,
"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\PropertyInfo\Extractor;
use Symfony\Component\PropertyInfo\... | blic function __construct(
private readonly iterable $extractors = [],
) {
}
public function getType(string $class, string $property, array $context = []): ?Type
{
foreach ($this->extractors as $extractor) {
if | or Dmitrii Poddubnyi <dpoddubny@gmail.com>
*/
final class ConstructorExtractor implements PropertyTypeExtractorInterface
{
/**
* @param iterable<int, ConstructorArgumentTypeExtractorInterface> $extractors
*/
pu | {
"filepath": "src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php",
"language": "php",
"file_size": 1164,
"cut_index": 518,
"middle_length": 229
} |
tion\DocBlockFactory;
use phpDocumentor\Reflection\DocBlockFactoryInterface;
use phpDocumentor\Reflection\Types\Context;
use phpDocumentor\Reflection\Types\ContextFactory;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDocBlockExtractorInterface;
use... | *
* @final
*/
class PhpDocExtractor implements PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface, PropertyDocBlockExtractorInterface
{
public const PROPERTY = 0;
public const ACCESSOR | omponent\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\ObjectType;
use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory;
/**
* Extracts data using a PHPDoc parser.
*
* @author Kévin Dunglas <dunglas@gmail.com>
| {
"filepath": "src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php",
"language": "php",
"file_size": 16912,
"cut_index": 921,
"middle_length": 229
} |
er\Parser\PhpDocParser;
use PHPStan\PhpDocParser\Parser\TokenIterator;
use PHPStan\PhpDocParser\Parser\TypeParser;
use PHPStan\PhpDocParser\ParserConfig;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Typ... | ExtractorInterface, PropertyTypeExtractorInterface, ConstructorArgumentTypeExtractorInterface
{
private const PROPERTY = 0;
private const ACCESSOR = 1;
private const MUTATOR = 2;
private PhpDocParser $phpDocParser;
private Lexer $lexer | ;
use Symfony\Component\TypeInfo\TypeResolver\StringTypeResolver;
/**
* Extracts data using PHPStan parser.
*
* @author Baptiste Leduc <baptiste.leduc@gmail.com>
*/
final class PhpStanExtractor implements PropertyDescription | {
"filepath": "src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.php",
"language": "php",
"file_size": 17616,
"cut_index": 1331,
"middle_length": 229
} |
using the reflection API.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @final
*/
class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface, PropertyReadInfoExtractorInterface, PropertyWriteInf... | RIVATE = 1;
public const ALLOW_PROTECTED = 2;
public const ALLOW_PUBLIC = 4;
/** @var int Allow none of the magic methods */
public const DISALLOW_MAGIC_METHODS = 0;
/** @var int Allow magic __get methods */
public const ALLOW_MAGI | nternal
*/
public static array $defaultAccessorPrefixes = ['get', 'is', 'has', 'can'];
/**
* @internal
*/
public static array $defaultArrayMutatorPrefixes = ['add', 'remove'];
public const ALLOW_P | {
"filepath": "src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php",
"language": "php",
"file_size": 34005,
"cut_index": 2151,
"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\PropertyInfo\Extractor;
use Symfony\Component\PropertyInfo\PropertyListExtract... | ) {
}
public function getProperties(string $class, array $context = []): ?array
{
if (!\array_key_exists('serializer_groups', $context) || (null !== $context['serializer_groups'] && !\is_array($context['serializer_groups']))) {
| Dunglas <dunglas@gmail.com>
*
* @final
*/
class SerializerExtractor implements PropertyListExtractorInterface
{
public function __construct(
private readonly ClassMetadataFactoryInterface $classMetadataFactory,
| {
"filepath": "src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php",
"language": "php",
"file_size": 1763,
"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\Ldap;
/**
* @author Charles Sarrazin <charles@sarraz.in>
* @author Karl Shea <karl@karlshea.com>
*/
c... | setAttribute($key, $attribute);
}
}
/**
* Returns the entry's DN.
*/
public function getDn(): string
{
return $this->dn;
}
/**
* Returns whether an attribute exists.
*
* @param string $name | * @param array<string, array> $attributes
*/
public function __construct(
private string $dn,
array $attributes = [],
) {
foreach ($attributes as $key => $attribute) {
$this-> | {
"filepath": "src/Symfony/Component/Ldap/Entry.php",
"language": "php",
"file_size": 2923,
"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\Ldap;
use Symfony\Component\Ldap\Adapter\AdapterInterface;
use Symfony\Component\Ldap\Adapter\EntryManag... | sitiveParameter] ?string $password = null): void
{
$this->adapter->getConnection()->bind($dn, $password);
}
public function saslBind(?string $dn = null, #[\SensitiveParameter] ?string $password = null, ?string $mech = null, ?string $re | r Charles Sarrazin <charles@sarraz.in>
*/
final class Ldap implements LdapInterface
{
public function __construct(
private AdapterInterface $adapter,
) {
}
public function bind(?string $dn = null, #[\Sen | {
"filepath": "src/Symfony/Component/Ldap/Ldap.php",
"language": "php",
"file_size": 2472,
"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\Ldap;
use Symfony\Component\Ldap\Adapter\EntryManagerInterface;
use Symfony\Co... | tring $dn = null, #[\SensitiveParameter] ?string $password = null): void;
/**
* Returns a connection bound to the ldap using SASL.
*
* @throws ConnectionException if dn / password could not be bound
*/
public function saslBind( | st ESCAPE_FILTER = 0x01;
public const ESCAPE_DN = 0x02;
/**
* Returns a connection bound to the ldap.
*
* @throws ConnectionException if dn / password could not be bound
*/
public function bind(?s | {
"filepath": "src/Symfony/Component/Ldap/LdapInterface.php",
"language": "php",
"file_size": 1736,
"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\Ldap\Adapter;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Compo... | configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'host' => 'localhost',
'version' => 3,
'connection_string' => null,
'encryption' => 'none',
'options' => [ | public function __construct(array $config = [])
{
$resolver = new OptionsResolver();
$this->configureOptions($resolver);
$this->config = $resolver->resolve($config);
}
protected function | {
"filepath": "src/Symfony/Component/Ldap/Adapter/AbstractConnection.php",
"language": "php",
"file_size": 1723,
"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\Ldap\Adapter;
use Symfony\Component\OptionsResolver\Options;
use ... | ;
$resolver->setDefaults([
'filter' => '*',
'maxItems' => 0,
'timeout' => 0,
'deref' => static::DEREF_NEVER,
'attrsOnly' => 0,
'scope' => static::SCOPE_SUB,
'pageSi | s;
public function __construct(
protected ConnectionInterface $connection,
protected string $dn,
protected string $query,
array $options = [],
) {
$resolver = new OptionsResolver() | {
"filepath": "src/Symfony/Component/Ldap/Adapter/AbstractQuery.php",
"language": "php",
"file_size": 1464,
"cut_index": 524,
"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\Ldap\Adapter;
/**
* @author Charles Sarrazin <charles@sarraz.in>
*/
interface AdapterI... | []): QueryInterface;
/**
* Fetches the entry manager instance.
*/
public function getEntryManager(): EntryManagerInterface;
/**
* Escape a string for use in an LDAP filter or DN.
*/
public function escape(string $subj | ateQuery(string $dn, string $query, array $options = | {
"filepath": "src/Symfony/Component/Ldap/Adapter/AdapterInterface.php",
"language": "php",
"file_size": 908,
"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\Ldap\Adapter;
use Symfony\Component\Ldap\Exception\AlreadyExistsException;
use Symfony\Component\Ldap\Ex... | n When the connection can't be created because of an LDAP_ALREADY_EXISTS error
* @throws ConnectionTimeoutException When the connection can't be created because of an LDAP_TIMEOUT error
* @throws InvalidCredentialsException When the connect | /**
* Checks whether the connection was already bound or not.
*/
public function isBound(): bool;
/**
* Binds the connection against a user's DN and password.
*
* @throws AlreadyExistsExceptio | {
"filepath": "src/Symfony/Component/Ldap/Adapter/ConnectionInterface.php",
"language": "php",
"file_size": 2092,
"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\Ldap\Adapter;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Exc... | ws LdapException
*/
public function add(Entry $entry): static;
/**
* Updates an entry from the Ldap server.
*
* @return $this
*
* @throws NotBoundException
* @throws LdapException
*/
public function upda | @author Kevin Schuurmans <kevin.schuurmans@freshheads.com>
*/
interface EntryManagerInterface
{
/**
* Adds a new entry in the Ldap server.
*
* @return $this
*
* @throws NotBoundException
* @thro | {
"filepath": "src/Symfony/Component/Ldap/Adapter/EntryManagerInterface.php",
"language": "php",
"file_size": 1734,
"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\Ldap\Adapter;
use Symfony\Component\Ldap\Exception\Ld... | SCOPE_ONE = 'one';
public const SCOPE_SUB = 'sub';
/**
* Executes a query and returns the list of Ldap entries.
*
* @throws NotBoundException
* @throws LdapException
*/
public function execute(): CollectionInterface;
| e QueryInterface
{
public const DEREF_NEVER = 0x00;
public const DEREF_SEARCHING = 0x01;
public const DEREF_FINDING = 0x02;
public const DEREF_ALWAYS = 0x03;
public const SCOPE_BASE = 'base';
public const | {
"filepath": "src/Symfony/Component/Ldap/Adapter/QueryInterface.php",
"language": "php",
"file_size": 999,
"cut_index": 512,
"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\Ldap\Adapter\ExtLdap;
use Symfony\Component\Ldap\Adapter\AdapterInterface;
use Symfony\Component\Ldap\Ad... | private array $config = [],
) {
if (!\extension_loaded('ldap')) {
throw new LdapException('The LDAP PHP extension is not enabled.');
}
}
public function getConnection(): ConnectionInterface
{
return |
* @author Charles Sarrazin <charles@sarraz.in>
*/
class Adapter implements AdapterInterface
{
private ConnectionInterface $connection;
private EntryManagerInterface $entryManager;
public function __construct(
| {
"filepath": "src/Symfony/Component/Ldap/Adapter/ExtLdap/Adapter.php",
"language": "php",
"file_size": 2187,
"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\Ldap\Adapter\ExtLdap;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Exception\LdapEx... | }
public function count(): int
{
$con = $this->connection->getResource();
$searches = $this->search->getResources();
$count = 0;
foreach ($searches as $search) {
$searchCount = ldap_count_entries($con, $ | __construct(
private Connection $connection,
private Query $search,
) {
}
public function toArray(): array
{
return $this->entries ??= iterator_to_array($this->getIterator(), false);
| {
"filepath": "src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php",
"language": "php",
"file_size": 3489,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Ldap\Adapter\ExtLdap;
use LDAP\Connection as LDAPConnection;
use Symfony\Component\Ldap\Adapter\AbstractConnection;
use Symfony\Component\Ldap\Exception\AlreadyExistsException;
use Symfony\Component\Ldap\Exception\ConnectionException;
use Symfony\Component\... |
private const LDAP_INVALID_CREDENTIALS = 0x31;
private const LDAP_TIMEOUT = 0x55;
private const LDAP_ALREADY_EXISTS = 0x44;
private const PRECONNECT_OPTIONS = [
ConnectionOptions::DEBUG_LEVEL,
ConnectionOptions::X_TLS_CACER | ption\NotBoundException;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @author Charles Sarrazin <charles@sarraz.in>
*/
class Connection extends AbstractConnection
{ | {
"filepath": "src/Symfony/Component/Ldap/Adapter/ExtLdap/Connection.php",
"language": "php",
"file_size": 7997,
"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\Ldap\Adapter\ExtLdap;
use Symfony\Component\Ldap\Exception\LdapException;
/**
* A class representing t... | L_VERSION = 0x11;
public const SERVER_CONTROLS = 0x12;
public const CLIENT_CONTROLS = 0x13;
public const API_FEATURE_INFO = 0x15;
public const HOST_NAME = 0x30;
public const ERROR_NUMBER = 0x31;
public const ERROR_STRING = 0x32;
| {
public const API_INFO = 0x00;
public const DEREF = 0x02;
public const SIZELIMIT = 0x03;
public const TIMELIMIT = 0x04;
public const REFERRALS = 0x08;
public const RESTART = 0x09;
public const PROTOCO | {
"filepath": "src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php",
"language": "php",
"file_size": 2903,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Ldap\Adapter\ExtLdap;
use LDAP\Connection as LDAPConnection;
use Symfony\Component\Ldap\Adapter\EntryManagerInterface;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Ldap\Exception\LdapException;
use Symfony\Component\Ldap\Exception\NotBoundExcepti... | $con = $this->getConnectionResource();
if (!@ldap_add($con, $entry->getDn(), $entry->getAttributes())) {
throw new LdapException(\sprintf('Could not add entry "%s": ', $entry->getDn()).ldap_error($con), ldap_errno($con));
}
| yManager implements EntryManagerInterface
{
public function __construct(
private Connection $connection,
) {
}
/**
* @return $this
*/
public function add(Entry $entry): static
{
| {
"filepath": "src/Symfony/Component/Ldap/Adapter/ExtLdap/EntryManager.php",
"language": "php",
"file_size": 6044,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Ldap\Adapter\ExtLdap;
use LDAP\Result;
use Symfony\Component\Ldap\Adapter\AbstractQuery;
use Symfony\Component\Ldap\Adapter\CollectionInterface;
use Symfony\Component\Ldap\Exception\LdapException;
use Symfony\Component\Ldap\Exception\NotBoundException;
/**... | ;
}
public function __unserialize(array $data): void
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
$con = $this->connection->getResource();
if (!iss | OL_PAGEDRESULTS;
/** @var Result[] */
private array $results;
private array $serverctrls = [];
public function __serialize(): array
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__) | {
"filepath": "src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php",
"language": "php",
"file_size": 7132,
"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\Ldap\Adapter\ExtLdap;
use Symfony\Component\Ldap\Exception\UpdateOperationExce... | consistency errors during construction
*/
public function __construct(
private int $operationType,
private string $attribute,
private ?array $values,
) {
if (!\in_array($operationType, self::VALID_OPERATION_TYPE | DAP_MODIFY_BATCH_REPLACE,
];
/**
* @param int $operationType An LDAP_MODIFY_BATCH_* constant
* @param string $attribute The attribute to batch modify on
*
* @throws UpdateOperationException on | {
"filepath": "src/Symfony/Component/Ldap/Adapter/ExtLdap/UpdateOperation.php",
"language": "php",
"file_size": 1736,
"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\Ldap\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Com... | >assertTrue($entry->hasAttribute('givenname', false));
$this->assertNull($entry->getAttribute('givenname'));
$this->assertSame($givenName, $entry->getAttribute('givenname', false)[0]);
$firstName = 'Fabien';
$entry->setAt | ier';
$entry = new Entry('cn=fabpot,dc=symfony,dc=com', [
'mail' => [$mail],
'givenName' => [$givenName],
]);
$this->assertFalse($entry->hasAttribute('givenname'));
$this- | {
"filepath": "src/Symfony/Component/Ldap/Tests/EntryTest.php",
"language": "php",
"file_size": 1247,
"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\Ldap\Tests;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Ldap\Adapter\AdapterInterface;
use... | ('bind')
->with('foo', 'bar')
;
$adapter = $this->createMock(AdapterInterface::class);
$adapter
->expects($this->once())
->method('getConnection')
->willReturn($connection)
;
| \Ldap;
class LdapTest extends TestCase
{
public function testLdapBind()
{
$connection = $this->createMock(ConnectionInterface::class);
$connection
->expects($this->once())
->method | {
"filepath": "src/Symfony/Component/Ldap/Tests/LdapTest.php",
"language": "php",
"file_size": 3609,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Yaml\Tests\Command;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Co... | = $this->createFile('foo: bar');
$ret = $tester->execute(['filename' => $filename], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
$this->a | thor Robin Chalas <robin.chalas@gmail.com>
*/
class LintCommandTest extends TestCase
{
private array $files;
public function testLintCorrectFile()
{
$tester = $this->createCommandTester();
$filename | {
"filepath": "src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php",
"language": "php",
"file_size": 7230,
"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\PropertyInfo;
use phpDocumentor\Reflection\DocBlock;
/**
* Extract a property's doc block.
*
* A property's doc block m... | able doc block for a property. It finds the doc block
* by the following priority:
* - constructor promoted argument,
* - the class property,
* - a mutator method for that property.
*
* If no doc block is found, it will ret | actorInterface
{
/**
* Gets the first avail | {
"filepath": "src/Symfony/Component/PropertyInfo/PropertyDocBlockExtractorInterface.php",
"language": "php",
"file_size": 987,
"cut_index": 582,
"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\PropertyInfo;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\TypeInfo\Type;
/**
* Adds a PSR-6 cache layer on top of an extractor.
*
* @au... | n isReadable(string $class, string $property, array $context = []): ?bool
{
return $this->extract('isReadable', [$class, $property, $context]);
}
public function isWritable(string $class, string $property, array $context = []): ?bool
| $arrayCache = [];
public function __construct(
private readonly PropertyInfoExtractorInterface $propertyInfoExtractor,
private readonly CacheItemPoolInterface $cacheItemPool,
) {
}
public functio | {
"filepath": "src/Symfony/Component/PropertyInfo/PropertyInfoCacheExtractor.php",
"language": "php",
"file_size": 4003,
"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\PropertyInfo;
/**
* The property read info tells how a property can be read.
... | g $name,
private readonly string $visibility,
private readonly bool $static,
private readonly bool $byRef,
) {
}
/**
* Get type of access.
*/
public function getType(): string
{
return $this->t | LITY_PUBLIC = 'public';
public const VISIBILITY_PROTECTED = 'protected';
public const VISIBILITY_PRIVATE = 'private';
public function __construct(
private readonly string $type,
private readonly strin | {
"filepath": "src/Symfony/Component/PropertyInfo/PropertyReadInfo.php",
"language": "php",
"file_size": 1562,
"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\PropertyInfo\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyInfo\PropertyAccessExt... | or;
use Symfony\Component\PropertyInfo\Tests\Fixtures\NullExtractor;
use Symfony\Component\TypeInfo\Type;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class AbstractPropertyInfoExtractorTest extends TestCase
{
protected PropertyInfoExtractorIn | InfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtract | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php",
"language": "php",
"file_size": 2821,
"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\PropertyInfo\Tests;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symf... | parent::testGetShortDescription();
parent::testGetShortDescription();
}
public function testGetLongDescription()
{
parent::testGetLongDescription();
parent::testGetLongDescription();
}
public function t | protected function setUp(): void
{
parent::setUp();
$this->propertyInfo = new PropertyInfoCacheExtractor($this->propertyInfo, new ArrayAdapter());
}
public function testGetShortDescription()
{
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php",
"language": "php",
"file_size": 1608,
"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\PropertyInfo\Tests\Fixtures;
/**
* @author Dmitrii P... | ion __construct(\DateTimeZone $timezone, $date, $dateObject, \DateTimeImmutable $dateTime, $mixed)
{
$this->timezone = $timezone->getName();
$this->date = \DateTimeImmutable::createFromFormat('U', $date);
$this->dateTime = $date | e $dateTime;
/**
* @param \DateTimeZone $timezone
* @param int $date Timestamp
* @param \DateTimeInterface $dateObject
* @param mixed $mixed
*/
public funct | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/ConstructorDummy.php",
"language": "php",
"file_size": 1027,
"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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\Serializer\Attribute\Groups;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class Dummy extends P... | */
public $parent;
/**
* @var \DateTimeImmutable[]
*/
#[Groups(['a', 'b'])]
public $collection;
/**
* @var DummyCollection<int, string>
*/
public $collectionAsObject;
/**
* @var string[][]
* | * #@+
* A short description ignoring template.
*
*
* A long description...
*
* ...over several lines.
*
* @var \DateTimeImmutable
*/
public $bal;
/**
* @var ParentDummy
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php",
"language": "php",
"file_size": 4396,
"cut_index": 614,
"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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\Property... | getMethodInExternalTraitPrimitiveType()
{
return 'value';
}
/**
* @return Dummy
*/
public function getMethodInExternalTraitObjectSameNamespace()
{
return new Dummy();
}
/**
* @return DummyUsedIn | */
private $propertyInExternalTraitObjectSameNamespace;
/**
* @var DummyUsedInTrait
*/
private $propertyInExternalTraitObjectDifferentNamespace;
/**
* @return string
*/
public function | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyTraitExternal.php",
"language": "php",
"file_size": 1141,
"cut_index": 518,
"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\PropertyInfo\Tests\Fixtures;
/**
* @author Baptiste Leduc <baptiste.leduc@gmail.com>
*/
class DummyUnionType
{
privat... | * @var array<string|int, array<string>>
*/
public $d;
/**
* @var (Dummy<array<string>, (int | (\Traversable<DefaultValue>)[])> | ParentDummy | null)
*/
public $e;
/**
* @var self::TYPE_*|null
*/
public $f;
| ay<string|int>
*/
public $c;
/**
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/DummyUnionType.php",
"language": "php",
"file_size": 961,
"cut_index": 582,
"middle_length": 52
} |
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\PropertyInfo\Tests\Fixtures;
use Symfony\Component\PropertyInfo\Tests\Fixtures... | @var \SplFileInfo[]|resource
*/
public $files;
/**
* @var static
*/
public $propertyTypeStatic;
/**
* @var parent
*/
public $parentAnnotationNoParent;
/**
* @var RootDummyItem[]
*/
public $r | /**
* @var float
*/
public $foo2;
/**
* @var callable
*/
public $foo3;
/**
* @var void
*/
public $foo4;
/**
* @var mixed
*/
public $foo5;
/**
* | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/ParentDummy.php",
"language": "php",
"file_size": 1978,
"cut_index": 537,
"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\PropertyInfo\Tests\Fixtures;
/**
* @author Teoh Han Hui <teohhanhui@gmail.com>
*/
class Php71Dummy
{
public function __construct(string $stri... | ic function removeBaz(string $baz)
{
}
}
class Php71DummyExtended extends Php71Dummy
{
}
class Php71DummyExtended2 extends Php71Dummy
{
public function __construct(int $intWithAccessor)
{
}
public function getIntWithAccessor()
| c function addBaz(string $baz)
{
}
publ | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/Php71Dummy.php",
"language": "php",
"file_size": 926,
"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\PropertyInfo\Tests\Fixtures;
/**
* @author Emil Masiako... | public $nonEmptyList;
/** @var interface-string */
public $interfaceString;
/** @var scalar */
public $scalar;
/** @var array-key */
public $arrayKey;
/** @var number */
public $number;
/** @var numeric */
pub | c $nonPositiveInt;
/** @var non-negative-int */
public $nonNegativeInt;
/** @var non-zero-int */
public $nonZeroInt;
/** @var non-empty-array */
public $nonEmptyArray;
/** @var non-empty-list */
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/PhpStanPseudoTypesDummy.php",
"language": "php",
"file_size": 1060,
"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\PropertyInfo\Tests\Fixtures;
/**
* @author Emil Masiakowski <emil.masiakowski@gmail.com>
*/
class Pseu... | nEmptyLowercaseString;
/** @var non-empty-string */
public $nonEmptyString;
/** @var numeric-string */
public $numericString;
/** @var trait-string */
public $traitString;
/** @var positive-int */
public $positiveInt;
| ass> */
public $classStringGeneric;
/** @var html-escaped-string */
public $htmlEscapedString;
/** @var lowercase-string */
public $lowercaseString;
/** @var non-empty-lowercase-string */
public $no | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/PseudoTypesDummy.php",
"language": "php",
"file_size": 2063,
"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\PropertyInfo\Tests\Fixtures;
class VoidNeverReturnTypeDummy... | should be ignored
throw new \Exception('Never returns');
}
public function setValue(): void
{
// This looks like a setter but has no parameters, should be ignored as accessor
}
public function setNeverValue(): never
| blic function getVoidProperty(): void
{
// This looks like a getter but returns void, should be ignored
}
public function getNeverProperty(): never
{
// This looks like a getter but returns never, | {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/VoidNeverReturnTypeDummy.php",
"language": "php",
"file_size": 1171,
"cut_index": 518,
"middle_length": 229
} |
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\PropertyInfo\Tests\Fixtures\Extractor;
class PromotedPropertiesWithDoc... | public string $baz,
/** @var int $qux An overridden qux property */
public string $qux = '',
/**
* A corge property.
*
* A detailed explanation of corge.
*/
public string $corge = | bar,
/** @var string $baz A baz property */
| {
"filepath": "src/Symfony/Component/PropertyInfo/Tests/Fixtures/Extractor/PromotedPropertiesWithDocBlock.php",
"language": "php",
"file_size": 857,
"cut_index": 529,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Yaml\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Yaml;
class YamlTestSuiteTest extends TestCase
{
private const SKIP = [
/... | '5WE3',
'6BFJ',
'6CA3',
'6CK3',
'6JWB',
'6LVF',
'6M2F',
'6VJK',
'6WLZ',
'6XDY',
'6ZKB',
'735Y',
'74H7',
'7FWL',
'7T8X',
'7W2P',
| '2XXW',
'33X3',
'35KP',
'36F6',
'4ABK',
'4FJ6',
'4JVG',
'4RWC',
'565N',
'57H4',
'5LLU',
'5TRB',
'5TYM',
'5U3A',
| {
"filepath": "src/Symfony/Component/Yaml/Tests/YamlTestSuiteTest.php",
"language": "php",
"file_size": 7173,
"cut_index": 716,
"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\PropertyInfo;
/**
* Guesses the property's human rea... | n getShortDescription(string $class, string $property, array $context = []): ?string;
/**
* Gets the long description of the property.
*/
public function getLongDescription(string $class, string $property, array $context = []): ?string;
| public functio | {
"filepath": "src/Symfony/Component/PropertyInfo/PropertyDescriptionExtractorInterface.php",
"language": "php",
"file_size": 785,
"cut_index": 512,
"middle_length": 14
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.