prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
/*
* 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\Config\Resource;
use Symfony\Component\Config\ResourceCheck... | bool
{
return !$this->skippedResourceTypes || isset($this->skippedResourceTypes[$metadata::class]);
}
public function isFresh(ResourceInterface $resource, int $timestamp): bool
{
return true;
}
public function __se | urceTypes
*/
public function __construct(array $skippedResourceTypes = [])
{
$this->skippedResourceTypes = array_flip($skippedResourceTypes);
}
public function supports(ResourceInterface $metadata): | {
"filepath": "src/Symfony/Component/Config/Resource/SkippingResourceChecker.php",
"language": "php",
"file_size": 1129,
"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\Config\Loader;
use Symfony\Component\Config\Exception\Loade... | s->resolver = $resolver;
}
public function load(mixed $resource, ?string $type = null): mixed
{
if (false === $loader = $this->resolver->resolve($resource, $type)) {
throw new LoaderLoadException($resource, null, 0, null, $ | load a given resource (handled by the resolver)
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class DelegatingLoader extends Loader
{
public function __construct(LoaderResolverInterface $resolver)
{
$thi | {
"filepath": "src/Symfony/Component/Config/Loader/DelegatingLoader.php",
"language": "php",
"file_size": 1233,
"cut_index": 518,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Loader;
use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
use Symfony\Component\Config\Exception\LoaderLoadException;
use Symfony\Component\Conf... | c function __construct(
protected FileLocatorInterface $locator,
?string $env = null,
) {
parent::__construct($env);
}
/**
* Sets the current directory.
*/
public function setCurrentDir(string $dir): void
| uilt-in loaders that are file based.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class FileLoader extends Loader
{
protected static array $loading = [];
private ?string $currentDir = null;
publi | {
"filepath": "src/Symfony/Component/Config/Loader/FileLoader.php",
"language": "php",
"file_size": 6930,
"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\Config\Loader;
use Symfony\Component\Config\Exception\LoaderLoadException;
use... | nterface
{
if (null === $this->resolver) {
throw new LogicException('Cannot get a resolver if none was set.');
}
return $this->resolver;
}
public function setResolver(LoaderResolverInterface $resolver): voi | ader implements LoaderInterface
{
protected ?LoaderResolverInterface $resolver = null;
public function __construct(
protected ?string $env = null,
) {
}
public function getResolver(): LoaderResolverI | {
"filepath": "src/Symfony/Component/Config/Loader/Loader.php",
"language": "php",
"file_size": 1839,
"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\Config\Loader;
/**
* LoaderInterface is the interface... | public function supports(mixed $resource, ?string $type = null): bool;
/**
* Gets the loader resolver.
*/
public function getResolver(): LoaderResolverInterface;
/**
* Sets the loader resolver.
*/
public function setR | ething went wrong
*/
public function load(mixed $resource, ?string $type = null): mixed;
/**
* Returns whether this class supports the given resource.
*
* @param mixed $resource A resource
*/
| {
"filepath": "src/Symfony/Component/Config/Loader/LoaderInterface.php",
"language": "php",
"file_size": 1050,
"cut_index": 513,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Loader;
/**
* LoaderResolver selects a loader for a given resource.
*... | ders An array of loaders
*/
public function __construct(array $loaders = [])
{
foreach ($loaders as $loader) {
$this->addLoader($loader);
}
}
public function resolve(mixed $resource, ?string $type = null): | y.com>
*/
class LoaderResolver implements LoaderResolverInterface
{
/**
* @var LoaderInterface[] An array of LoaderInterface objects
*/
private array $loaders = [];
/**
* @param LoaderInterface[] $loa | {
"filepath": "src/Symfony/Component/Config/Loader/LoaderResolver.php",
"language": "php",
"file_size": 1564,
"cut_index": 537,
"middle_length": 229
} |
ception\InvalidTypeException;
use Symfony\Component\Config\Definition\Exception\UnsetKeyException;
/**
* Represents an Array node in the config tree.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class ArrayNode extends BaseNode implements PrototypeNodeInterface
{
protected array $xmlRemappings = [... | is->normalizeKeys = $normalizeKeys;
}
/**
* Namely, you mostly have foo_bar in YAML while you have foo-bar in XML.
* After running this method, all keys are normalized to foo_bar.
*
* If you have a mixed key like foo-bar_moo, i | Merging = true;
protected bool $ignoreExtraKeys = false;
protected bool $removeExtraKeys = true;
protected bool $normalizeKeys = true;
public function setNormalizeKeys(bool $normalizeKeys): void
{
$th | {
"filepath": "src/Symfony/Component/Config/Definition/ArrayNode.php",
"language": "php",
"file_size": 12491,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Definition;
use Symfony\Component\Config\Definition\Builder\ExprBuilder;
use Symfony\Component\Config\Loader\ParamConfigurator;
/**
* @author Alexandre Daubois <alex.daubois@gmail.com>
*/
final class ArrayShapeGenerator
{
public static functio... | () ? 'bool|null' : 'bool',
$node instanceof StringNode => 'string',
$node instanceof NumericNode => self::handleNumericNode($node),
$node instanceof EnumNode => $node->getPermissibleValues('|', false),
| int $nestingLevel = 1): string
{
if (!$node instanceof ArrayNode) {
$typeString = match (true) {
$node instanceof BooleanNode => $node->hasDefaultValue() && null === $node->getDefaultValue | {
"filepath": "src/Symfony/Component/Config/Definition/ArrayShapeGenerator.php",
"language": "php",
"file_size": 5328,
"cut_index": 716,
"middle_length": 229
} |
se Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
use Symfony\Component\Config\Definition\Exception\UnsetKeyException;
use Symfony\Componen... | ray $normalizedTypes = [];
protected array $finalValidationClosures = [];
protected bool $allowOverwrite = true;
protected bool $required = false;
protected array $deprecation = [];
protected array $equivalentValues = [];
protected | DEFAULT_PATH_SEPARATOR = '.';
private static array $placeholderUniquePrefixes = [];
private static array $placeholders = [];
protected string $name;
protected array $normalizationClosures = [];
protected ar | {
"filepath": "src/Symfony/Component/Config/Definition/BaseNode.php",
"language": "php",
"file_size": 16041,
"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\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidTy... | rent, $pathSeparator);
}
protected function validateType(mixed $value): void
{
if (!\is_bool($value)) {
if (null === $value && $this->nullable) {
return;
}
$ex = new InvalidTypeExcep | ction __construct(
?string $name,
?NodeInterface $parent = null,
string $pathSeparator = self::DEFAULT_PATH_SEPARATOR,
private bool $nullable = false,
) {
parent::__construct($name, $pa | {
"filepath": "src/Symfony/Component/Config/Definition/BooleanNode.php",
"language": "php",
"file_size": 1591,
"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\Config\Definition;
use Symfony\Component\Config\Definition\Builde... |
private ConfigurableInterface $subject,
private ?ContainerBuilder $container,
private string $alias,
) {
}
/**
* @return TreeBuilder<'array'>
*/
public function getConfigTreeBuilder(): TreeBuilder
{
| leLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
*
* @final
*/
class Configuration implements ConfigurationInterface
{
public function __construct( | {
"filepath": "src/Symfony/Component/Config/Definition/Configuration.php",
"language": "php",
"file_size": 1431,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* Node which only allows a finite set of values.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class EnumNode extends ScalarNode
{
p... | tain at least one element.');
}
if ($values && $enumFqcn) {
throw new \InvalidArgumentException('$values or $enumFqcn cannot be both set.');
}
if (null !== $enumFqcn) {
if (!enum_exists($enumFqcn)) | $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR, ?string $enumFqcn = null)
{
if (!$values && !$enumFqcn) {
throw new \InvalidArgumentException('$values must con | {
"filepath": "src/Symfony/Component/Config/Definition/EnumNode.php",
"language": "php",
"file_size": 5717,
"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\Config\Definition;
use Symfony\Component\Config\Definition\... | e)) {
$ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected "float", but got "%s".', $this->getPath(), get_debug_type($value)));
if ($hint = $this->getInfo()) {
$ex->addHint($hint);
|
{
protected function validateType(mixed $value): void
{
// Integers are also accepted, we just cast them
if (\is_int($value)) {
$value = (float) $value;
}
if (!\is_float($valu | {
"filepath": "src/Symfony/Component/Config/Definition/FloatNode.php",
"language": "php",
"file_size": 1189,
"cut_index": 518,
"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\Config\Definition;
use Symfony\Component\Config\Defini... | tPath(), get_debug_type($value)));
if ($hint = $this->getInfo()) {
$ex->addHint($hint);
}
$ex->setPath($this->getPath());
throw $ex;
}
}
protected function getValidPlaceholde | umericNode
{
protected function validateType(mixed $value): void
{
if (!\is_int($value)) {
$ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected "int", but got "%s".', $this->ge | {
"filepath": "src/Symfony/Component/Config/Definition/IntegerNode.php",
"language": "php",
"file_size": 1052,
"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\Config\Definition;
use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException;
use Sy... | the node.
*/
public function getName(): string;
/**
* Returns the path of the node.
*/
public function getPath(): string;
/**
* Returns true when the node is required.
*/
public function isRequired(): bool;
| * In most cases, it is better to inherit from BaseNode instead of implementing
* this interface yourself.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
interface NodeInterface
{
/**
* Returns the name of | {
"filepath": "src/Symfony/Component/Config/Definition/NodeInterface.php",
"language": "php",
"file_size": 2065,
"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\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**... | {
parent::__construct($name, $parent, $pathSeparator);
}
protected function finalizeValue(mixed $value): mixed
{
$value = parent::finalizeValue($value);
if ($this->isHandlingPlaceholder()) {
return $value;
| t(
?string $name,
?NodeInterface $parent = null,
protected int|float|null $min = null,
protected int|float|null $max = null,
string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR,
) | {
"filepath": "src/Symfony/Component/Config/Definition/NumericNode.php",
"language": "php",
"file_size": 2029,
"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\Config\Definition;
/**
* This class is the entry point for config normalization/merging/finalization.
... | rmalize($config);
$currentConfig = $configTree->merge($currentConfig, $config);
}
return $configTree->finalize($currentConfig);
}
/**
* Processes an array of configurations.
*
* @param array $configs An | configuration items to process
*/
public function process(NodeInterface $configTree, array $configs): array
{
$currentConfig = [];
foreach ($configs as $config) {
$config = $configTree->no | {
"filepath": "src/Symfony/Component/Config/Definition/Processor.php",
"language": "php",
"file_size": 2533,
"cut_index": 563,
"middle_length": 229
} |
Exception;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\Exception\UnsetKeyException;
/**
* Represents a prototyped Array node in the config tree.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class PrototypedArrayNode extends A... | = [];
private bool $defaultToNull = false;
/**
* Sets the minimum number of elements that a prototype based node must
* contain. By default this is zero, meaning no elements.
*/
public function setMinNumberOfElements(int $numbe | 0;
protected array $defaultValue = [];
protected ?array $defaultChildren = null;
/**
* @var NodeInterface[] An array of the prototypes of the simplified value children
*/
private array $valuePrototypes | {
"filepath": "src/Symfony/Component/Config/Definition/PrototypedArrayNode.php",
"language": "php",
"file_size": 12026,
"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\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidTy... | $ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected "scalar", but got "%s".', $this->getPath(), get_debug_type($value)));
if ($hint = $this->getInfo()) {
$ex->addHint($hint);
}
| * floats
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class ScalarNode extends VariableNode
{
protected function validateType(mixed $value): void
{
if (!\is_scalar($value) && null !== $value) {
| {
"filepath": "src/Symfony/Component/Config/Definition/ScalarNode.php",
"language": "php",
"file_size": 1603,
"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\Config\Definition;
use Symfony\Component\Config\Defini... | ->getPath(), get_debug_type($value)));
if ($hint = $this->getInfo()) {
$ex->addHint($hint);
}
$ex->setPath($this->getPath());
throw $ex;
}
}
protected function getValidPlaceh | alarNode
{
protected function validateType(mixed $value): void
{
if (!\is_string($value)) {
$ex = new InvalidTypeException(\sprintf('Invalid type for path "%s". Expected "string", but got "%s".', $this | {
"filepath": "src/Symfony/Component/Config/Definition/StringNode.php",
"language": "php",
"file_size": 1059,
"cut_index": 513,
"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\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* This node represents a value of variable type i... | ): void
{
$this->defaultValueSet = true;
$this->defaultValue = $value;
}
public function hasDefaultValue(): bool
{
return $this->defaultValueSet;
}
public function getDefaultValue(): mixed
{
$v | nds BaseNode implements PrototypeNodeInterface
{
protected bool $defaultValueSet = false;
protected mixed $defaultValue = null;
protected bool $allowEmptyValue = true;
public function setDefaultValue(mixed $value | {
"filepath": "src/Symfony/Component/Config/Definition/VariableNode.php",
"language": "php",
"file_size": 3352,
"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\Config;
/**
* Basic implementation of ConfigCacheFactoryIn... | on __construct(
private bool $debug,
) {
}
/**
* @param-immediately-invoked-callable $callback
*/
public function cache(string $file, callable $callback): ConfigCacheInterface
{
$cache = new ConfigCache($file, | ice-based).
*
* @author Matthias Pigulla <mp@webfactory.de>
*/
class ConfigCacheFactory implements ConfigCacheFactoryInterface
{
/**
* @param bool $debug The debug flag to pass to ConfigCache
*/
public functi | {
"filepath": "src/Symfony/Component/Config/ConfigCacheFactory.php",
"language": "php",
"file_size": 1126,
"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\Config;
use Symfony\Component\Config\Resource\ResourceInter... | * Writes the given content into the cache file. Metadata will be stored
* independently and can be used to check cache freshness at a later time.
*
* @param string $content The content to write into the cache
* @ | tion getPath(): string;
/**
* Checks if the cache is still fresh.
*
* This check should take the metadata passed to the write() method into consideration.
*/
public function isFresh(): bool;
/**
| {
"filepath": "src/Symfony/Component/Config/ConfigCacheInterface.php",
"language": "php",
"file_size": 1247,
"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\Config;
use Symfony\Component\Config\Exception\FileLocatorF... | string|string[] The full path to the file or an array of file paths
*
* @psalm-return ($first is true ? string : string[])
*
* @throws \InvalidArgumentException If $name is empty
* @throws FileLocatorFileNotFoundException I | string $name The file name to locate
* @param string|null $currentPath The current path
* @param bool $first Whether to return the first occurrence or an array of filenames
*
* @return | {
"filepath": "src/Symfony/Component/Config/FileLocatorInterface.php",
"language": "php",
"file_size": 1140,
"cut_index": 518,
"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\Config;
/**
* A ConfigCacheFactory implementation tha... | -invoked-callable $callable
*/
public function cache(string $file, callable $callable): ConfigCacheInterface
{
$cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers);
if (!$cache->isFresh()) {
$call | nterface
{
/**
* @param iterable<int, ResourceCheckerInterface> $resourceCheckers
*/
public function __construct(
private iterable $resourceCheckers = [],
) {
}
/**
* @param-immediately | {
"filepath": "src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php",
"language": "php",
"file_size": 1054,
"cut_index": 513,
"middle_length": 229
} |
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\Config\Exception;
/**
* Exception class for when a circular reference is de... | $previous = null)
{
$message = \sprintf('Circular reference detected in "%s" ("%s" > "%s").', $this->varToString($resources[0]), implode('" > "', $resources), $resources[0]);
\Exception::__construct($message, $code, $previous);
}
| nstruct(array $resources, int $code = 0, ?\Throwable | {
"filepath": "src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php",
"language": "php",
"file_size": 845,
"cut_index": 535,
"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\DomCrawler\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Sym... | sAbsolute()
{
$dom = new \DOMDocument();
$dom->loadHTML('<html><img alt="foo" src="https://example.com/foo" /></html>');
$image = new Image($dom->getElementsByTagName('img')->item(0));
$this->assertSame('https://example | dom = new \DOMDocument();
$dom->loadHTML('<html><div><div></html>');
new Image($dom->getElementsByTagName('div')->item(0), 'http://www.example.com/');
}
public function testBaseUriIsOptionalWhenImageUrlI | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/ImageTest.php",
"language": "php",
"file_size": 2090,
"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\DomCrawler\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DomCrawler\UriResolver;
class UriRe... | //localhost/bar/foo', 'http://localhost/foo'],
['
/foo', 'http://localhost/bar/foo/', 'http://localhost/foo'],
['/foo
', 'http://localhost/bar/foo', 'http://localhost/foo'],
['foo', 'http://local | pected, UriResolver::resolve($uri, $baseUri));
}
public static function provideResolverTests()
{
return [
['/foo', 'http://localhost/bar/foo/', 'http://localhost/foo'],
['/foo', 'http: | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/UriResolverTest.php",
"language": "php",
"file_size": 4595,
"cut_index": 614,
"middle_length": 229
} |
}
$node = $this->createNode('input', '', ['type' => 'text']);
try {
new ChoiceFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is an input with a type different from checkbox or radio');
} catch (\LogicException $e) {
$... | radio for radio buttons');
$node = $this->createNode('input', '', ['type' => 'checkbox', 'name' => 'name', 'value' => 'foo']);
$field = new ChoiceFormField($node);
$this->assertEquals('checkbox', $field->getType(), '->getType() re |
$node = $this->createNode('input', '', ['type' => 'radio', 'name' => 'name', 'value' => 'foo']);
$field = new ChoiceFormField($node);
$this->assertEquals('radio', $field->getType(), '->getType() returns | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Field/ChoiceFormFieldTest.php",
"language": "php",
"file_size": 21531,
"cut_index": 1331,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DomCrawler\Tests\Field;
use Symfony\Component\DomCrawler\Field\InputFormField;... | tarea', '');
try {
new InputFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not an input');
} catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() thr | 'value']);
$field = new InputFormField($node);
$this->assertEquals('value', $field->getValue(), '->initialize() sets the value of the field to the value attribute value');
$node = $this->createNode('tex | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Field/InputFormFieldTest.php",
"language": "php",
"file_size": 1831,
"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\DomCrawler\Tests\Test\Constraint;
use PHPUnit\Framework\ExpectationFailedExcep... | ', true));
self::assertTrue($constraint->evaluate(new Crawler('<ul><li>Bar</li><li>Foo'), '', true));
self::assertTrue($constraint->evaluate(new Crawler('<ul><li>Bar</li><li>Foo Bar Baz'), '', true));
self::assertFalse($constraint-> | ntainsTest extends TestCase
{
public function testConstraint()
{
$constraint = new CrawlerAnySelectorTextContains('ul li', 'Foo');
self::assertTrue($constraint->evaluate(new Crawler('<ul><li>Foo</li>'), ' | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Test/Constraint/CrawlerAnySelectorTextContainsTest.php",
"language": "php",
"file_size": 1913,
"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\DomCrawler\Tests\Test\Constraint;
use PHPUnit\Framework\Expectati... | i>'), '', true));
self::assertTrue($constraint->evaluate(new Crawler('<ul><li>Bar</li><li>Foo'), '', true));
self::assertFalse($constraint->evaluate(new Crawler('<ul><li>Bar</li><li>Foo Bar Baz'), '', true));
self::assertFalse($cons | ySelectorTextSameTest extends TestCase
{
public function testConstraint()
{
$constraint = new CrawlerAnySelectorTextSame('ul li', 'Foo');
self::assertTrue($constraint->evaluate(new Crawler('<ul><li>Foo</l | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Test/Constraint/CrawlerAnySelectorTextSameTest.php",
"language": "php",
"file_size": 1368,
"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\DomCrawler\Tests\Test\Constraint;
use PHPUnit\Framework\ExpectationFailedExcep... | ', true));
$this->assertFalse($constraint->evaluate(new Crawler('<html><head><title>Bar'), '', true));
$this->assertFalse($constraint->evaluate(new Crawler('<html><head></head><body>Bar'), '', true));
}
public function testDoesNotM | Test extends TestCase
{
public function testConstraint()
{
$constraint = new CrawlerSelectorTextContains('title', 'Foo');
$this->assertTrue($constraint->evaluate(new Crawler('<html><head><title>Foobar'), ' | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Test/Constraint/CrawlerSelectorTextContainsTest.php",
"language": "php",
"file_size": 1814,
"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\DomCrawler\Tests\Test\Constraint;
use PHPUnit\Framework\Exp... | ), '', true));
$this->assertFalse($constraint->evaluate(new Crawler('<html><head><title>Bar'), '', true));
$this->expectException(ExpectationFailedException::class);
$this->expectExceptionMessage('Failed asserting that the Crawler | torTextSameTest extends TestCase
{
public function testConstraint()
{
$constraint = new CrawlerSelectorTextSame('title', 'Foo');
$this->assertTrue($constraint->evaluate(new Crawler('<html><head><title>Foo' | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Test/Constraint/CrawlerSelectorTextSameTest.php",
"language": "php",
"file_size": 1142,
"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\DomCrawler\Test\Constraint;
use PHPUnit\Framework\Constraint\Cons... | elector, $this->attribute, $this->expectedText);
}
/**
* @param Crawler $crawler
*/
protected function matches($crawler): bool
{
$crawler = $crawler->filter($this->selector);
if (!\count($crawler)) {
r | private string $attribute,
private string $expectedText,
) {
}
public function toString(): string
{
return \sprintf('has a node matching selector "%s" with attribute "%s" of value "%s"', $this->s | {
"filepath": "src/Symfony/Component/DomCrawler/Test/Constraint/CrawlerSelectorAttributeValueSame.php",
"language": "php",
"file_size": 1295,
"cut_index": 524,
"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\DomCrawler\Test\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\DomCrawler\Crawler;
final c... | }
/**
* @param Crawler $crawler
*/
protected function matches($crawler): bool
{
return 0 < \count($crawler->filter($this->selector));
}
/**
* @param Crawler $crawler
*/
protected function failureDescr | printf('matches selector "%s"', $this->selector);
| {
"filepath": "src/Symfony/Component/DomCrawler/Test/Constraint/CrawlerSelectorExists.php",
"language": "php",
"file_size": 978,
"cut_index": 582,
"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\Config;
use Symfony\Component\Config\Resource\ResourceInterface;
use Symfony\Component\Config\Resource\S... | ory.de>
*/
class ConfigCache extends ResourceCheckerConfigCache
{
/**
* @param string $file The absolute cache path
* @param bool $debug Whether | ta resources that implement
* \Symfony\Component\Config\Resource\SelfCheckingResourceInterface will
* be used to check cache freshness.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Matthias Pigulla <mp@webfact | {
"filepath": "src/Symfony/Component/Config/ConfigCache.php",
"language": "php",
"file_size": 2119,
"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\Config;
/**
* Interface for a ConfigCache factory. T... | able $callable The callable to be executed when the cache needs to be filled (i. e. is not fresh). The cache will be passed as the only parameter to this callback
*/
public function cache(string $file, callable $callable): ConfigCacheInterface;
}
| e
{
/**
* Creates a cache instance and (re-)initializes it if necessary.
*
* @param-immediately-invoked-callable $callable
*
* @param string $file The absolute cache file path
* @param call | {
"filepath": "src/Symfony/Component/Config/ConfigCacheFactoryInterface.php",
"language": "php",
"file_size": 997,
"cut_index": 512,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config;
use Symfony\Component\Config\Resource\ResourceInter... | ResourceCheckerInterface
{
/**
* Queries the ResourceChecker whether it can validate a given
* resource or not.
*/
public function supports(ResourceInterface $metadata): bool;
/**
* Validates the resource.
*
* @p | . The ResourceCheckers
* can then inspect the resources and decide whether the cache can be considered
* fresh or not.
*
* @author Matthias Pigulla <mp@webfactory.de>
* @author Benjamin Klotz <bk@webfactory.de>
*/
interface | {
"filepath": "src/Symfony/Component/Config/ResourceCheckerInterface.php",
"language": "php",
"file_size": 1188,
"cut_index": 518,
"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\Config\Exception;
/**
* File locator exception if a f... | age = '',
int $code = 0,
?\Throwable $previous = null,
private array $paths = [],
) {
parent::__construct($message, $code, $previous);
}
public function getPaths(): array
{
return $this->paths;
} | string $mess | {
"filepath": "src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php",
"language": "php",
"file_size": 786,
"cut_index": 513,
"middle_length": 14
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DomCrawler\Tests\Field;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Component\DomCrawler\Field\FileFormField;
class FileFormFieldTest exten... | 'textarea', '');
try {
new FileFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not an input field');
} catch (\LogicException $e) {
$this->assertTrue(true, '->initial | >assertEquals(['name' => '', 'type' => '', 'tmp_name' => '', 'error' => \UPLOAD_ERR_NO_FILE, 'size' => 0], $field->getValue(), '->initialize() sets the value of the field to no file uploaded');
$node = $this->createNode( | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Field/FileFormFieldTest.php",
"language": "php",
"file_size": 4668,
"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\DomCrawler\Tests\Field;
use Symfony\Component\DomCrawler\Field\TextareaFormFie... | TextareaFormField($node);
$this->fail('->initialize() throws a \LogicException if the node is not a textarea');
} catch (\LogicException $e) {
$this->assertTrue(true, '->initialize() throws a \LogicException if the node is | ormField($node);
$this->assertEquals('foo bar', $field->getValue(), '->initialize() sets the value of the field to the textarea node value');
$node = $this->createNode('input', '');
try {
new | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Field/TextareaFormFieldTest.php",
"language": "php",
"file_size": 1759,
"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\DomCrawler\Tests\Test\Constraint;
use PHPUnit\Framework\Exp... | $constraint = new CrawlerSelectorExists('h1');
$this->assertFalse($constraint->evaluate(new Crawler('<html><head><title>'), '', true));
$this->expectException(ExpectationFailedException::class);
$this->expectExceptionMessage | rExistsTest extends TestCase
{
public function testConstraint()
{
$constraint = new CrawlerSelectorExists('title');
$this->assertTrue($constraint->evaluate(new Crawler('<html><head><title>'), '', true));
| {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Test/Constraint/CrawlerSelectorExistsTest.php",
"language": "php",
"file_size": 1141,
"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\DomCrawler\Test\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use S... | atches($other): bool
{
if (!$other instanceof Crawler) {
throw new \InvalidArgumentException(\sprintf('"%s" constraint expected an argument of type "%s", got "%s".', self::class, Crawler::class, get_debug_type($other)));
}
| ectedText,
) {
}
public function toString(): string
{
return \sprintf('has at least a node matching selector "%s" with content "%s"', $this->selector, $this->expectedText);
}
protected function m | {
"filepath": "src/Symfony/Component/DomCrawler/Test/Constraint/CrawlerAnySelectorTextSame.php",
"language": "php",
"file_size": 1650,
"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\DomCrawler\Test\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use S... | ng selector "%s" contains "%s"', $this->nodeText, $this->selector, $this->expectedText);
}
return \sprintf('the Crawler has a node matching selector "%s"', $this->selector);
}
/**
* @param Crawler $crawler
*/
protect | ruct(
private string $selector,
private string $expectedText,
) {
}
public function toString(): string
{
if ($this->hasNode) {
return \sprintf('the text "%s" of the node matchi | {
"filepath": "src/Symfony/Component/DomCrawler/Test/Constraint/CrawlerSelectorTextContains.php",
"language": "php",
"file_size": 1540,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config;
use Symfony\Component\Config\Resource\ResourceInterface;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
/**
* ResourceCheckerConfigCache uses instances of ResourceCheckerInterface
* to check w... | * @param string|null $metaFile The absolute path to the meta file, defaults to $file.meta if null
*/
public function __construct(
private string $file,
private iterable $resourceCheckers = [ | **
* @param string $file The absolute cache path
* @param iterable<mixed, ResourceCheckerInterface> $resourceCheckers The ResourceCheckers to use for the freshness check
| {
"filepath": "src/Symfony/Component/Config/ResourceCheckerConfigCache.php",
"language": "php",
"file_size": 6397,
"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\DomCrawler\Tests\Field;
use Symfony\Component\DomCrawler\Field\InputFormField;
class FormFieldTest exte... | pe' => 'text', 'name' => 'name', 'value' => 'value']);
$field = new InputFormField($node);
$this->assertEquals('value', $field->getValue(), '->getValue() returns the value of the field');
$field->setValue('foo');
$this->as | nputFormField($node);
$this->assertEquals('name', $field->getName(), '->getName() returns the name of the field');
}
public function testGetSetHasValue()
{
$node = $this->createNode('input', '', ['ty | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Field/FormFieldTest.php",
"language": "php",
"file_size": 2619,
"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\DomCrawler\Tests\Test\Constraint;
use PHPUnit\Framework\Expectati... | traint->evaluate(new Crawler('<html><body><form><input type="text" name="username" value="Fabien">'), '', true));
$this->assertFalse($constraint->evaluate(new Crawler('<html><body><form><input type="text" name="username">'), '', true));
$th | electorAttributeValueSameTest extends TestCase
{
public function testConstraint()
{
$constraint = new CrawlerSelectorAttributeValueSame('input[name="username"]', 'value', 'Fabien');
$this->assertTrue($cons | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/Test/Constraint/CrawlerSelectorAttributeValueSameTest.php",
"language": "php",
"file_size": 1417,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config;
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
/**
* FileLocator use... | turn string|string[]
*
* @psalm-return ($first is true ? string : string[])
*/
public function locate(string $name, ?string $currentPath = null, bool $first = true): string|array
{
if ('' === $name) {
throw new \I | * @param string|string[] $paths A path or an array of paths where to look for resources
*/
public function __construct(string|array $paths = [])
{
$this->paths = (array) $paths;
}
/**
* @re | {
"filepath": "src/Symfony/Component/Config/FileLocator.php",
"language": "php",
"file_size": 2763,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\DomCrawler\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DomCrawler\Link;
class LinkTest extends TestCase
{
public function testConstructorWithANonATag()
{
$this->expectException... | k($dom->getElementsByTagName('a')->item(0));
$this->assertSame('https://example.com/foo', $link->getUri());
}
public function testAbsoluteBaseUriIsMandatoryWhenLinkUrlIsRelative()
{
$this->expectException(\InvalidArgumentExcept | e.com/');
}
public function testBaseUriIsOptionalWhenLinkUrlIsAbsolute()
{
$dom = new \DOMDocument();
$dom->loadHTML('<html><a href="https://example.com/foo">foo</a></html>');
$link = new Lin | {
"filepath": "src/Symfony/Component/DomCrawler/Tests/LinkTest.php",
"language": "php",
"file_size": 6970,
"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\DomCrawler\Test\Constraint;
use PHPUnit\Framework\Constrain... | */
protected function matches($crawler): bool
{
return $this->count === \count($crawler->filter($this->selector));
}
/**
* @param Crawler $crawler
*/
protected function failureDescription($crawler): string
{
| vate readonly string $selector,
) {
}
public function toString(): string
{
return \sprintf('selector "%s" count is "%d"', $this->selector, $this->count);
}
/**
* @param Crawler $crawler
| {
"filepath": "src/Symfony/Component/DomCrawler/Test/Constraint/CrawlerSelectorCount.php",
"language": "php",
"file_size": 1196,
"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\DomCrawler\Test\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use S... | $this->selector, $this->expectedText);
}
return \sprintf('the Crawler has a node matching selector "%s"', $this->selector);
}
protected function matches($other): bool
{
if (!$other instanceof Crawler) {
th | g $selector,
private string $expectedText,
) {
}
public function toString(): string
{
if ($this->hasNode) {
return \sprintf('the text of any node matching selector "%s" contains "%s"', | {
"filepath": "src/Symfony/Component/DomCrawler/Test/Constraint/CrawlerAnySelectorTextContains.php",
"language": "php",
"file_size": 1957,
"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\Config\Definition\Builder;
use Symfony\Component\Conf... | entInterface $parent = null)
{
parent::__construct($name, $parent);
$this->nullEquivalent = '';
}
protected function instantiateNode(): StringNode
{
return new StringNode($this->name, $this->parent, $this->pathSepa | rent>
*
* @author Raffaele Carelle <raffaele.carelle@gmail.com>
*/
class StringNodeDefinition extends ScalarNodeDefinition
{
/**
* @param TParent $parent
*/
public function __construct(?string $name, ?NodePar | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/StringNodeDefinition.php",
"language": "php",
"file_size": 1013,
"cut_index": 512,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\DirectoryResource;
class DirectoryResourceTest extends TestCase
{
protected string $directory;
protected function setUp(): void
{
$this->direc... | eDirectory(string $directory): void
{
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory), \RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $path) {
if (preg_match('#[/\\\\]\ | ectory.'/tmp.xml');
}
protected function tearDown(): void
{
if (!is_dir($this->directory)) {
return;
}
$this->removeDirectory($this->directory);
}
protected function remov | {
"filepath": "src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php",
"language": "php",
"file_size": 6636,
"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\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\FileExisten... | if (file_exists($this->file)) {
@unlink($this->file);
}
}
public function testToString()
{
$this->assertSame('existence.'.$this->file, (string) $this->resource);
}
public function testGetResource()
| p(): void
{
$this->file = realpath(sys_get_temp_dir()).'/tmp.xml';
$this->time = time();
$this->resource = new FileExistenceResource($this->file);
}
protected function tearDown(): void
{
| {
"filepath": "src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php",
"language": "php",
"file_size": 2249,
"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\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\FileResourc... | if (file_exists($this->file)) {
@unlink($this->file);
}
}
public function testGetResource()
{
$this->assertSame(realpath($this->file), $this->resource->getResource(), '->getResource() returns the path to the resou | is->file = sys_get_temp_dir().'/tmp.xml';
$this->time = time();
touch($this->file, $this->time);
$this->resource = new FileResource($this->file);
}
protected function tearDown(): void
{
| {
"filepath": "src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php",
"language": "php",
"file_size": 2590,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Resource;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\GlobResource;
class GlobResourceTest extends TestCase
{
protected function tearDown(): void
{
$dir = \di... | resource = new GlobResource($dir, $pattern, true);
$paths = iterator_to_array($resource);
$file = $dir.'/Resource'.\DIRECTORY_SEPARATOR.'ConditionalClass.php';
$this->assertEquals([$file => new \SplFileInfo($file)], $paths);
| #[TestWith(['/Resource'])]
#[TestWith(['/**/Resource'])]
#[TestWith(['/**/Resource/'])]
public function testIterator(string $pattern)
{
$dir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures';
$ | {
"filepath": "src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php",
"language": "php",
"file_size": 8002,
"cut_index": 716,
"middle_length": 229
} |
flectionClassResource;
use Symfony\Component\Config\Tests\Fixtures\FakeVendor\Base;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
class ReflectionClassResourceTest extends TestCase
{
public function testToString()
{
$res = new ... | h(0));
$this->assertSame((string) $res, (string) $ser);
}
public function testIsFresh()
{
$res = new ReflectionClassResource(new \ReflectionClass(__CLASS__));
$mtime = filemtime(__FILE__);
$this->assertTrue($r | ze()
{
$res = new ReflectionClassResource(new \ReflectionClass(DummyInterface::class));
$ser = unserialize(serialize($res));
$this->assertTrue($res->isFresh(0));
$this->assertTrue($ser->isFres | {
"filepath": "src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php",
"language": "php",
"file_size": 10732,
"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\Config\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Exception\LoaderLoadEx... | }
public function testGetSetResolver()
{
$resolver = new LoaderResolver();
$loader = new DelegatingLoader($resolver);
$this->assertSame($resolver, $loader->getResolver(), '->getResolver() gets the resolver loader');
| est extends TestCase
{
public function testConstructor()
{
new DelegatingLoader($resolver = new LoaderResolver());
$this->assertTrue(true, '__construct() takes a loader resolver as its first argument');
| {
"filepath": "src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php",
"language": "php",
"file_size": 2730,
"cut_index": 563,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Loader;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Fil... | ['path/to/file1'],
['path/to/file1', 'path/to/file2'],
['path/to/file1', 'path/to/file2'],
['path/to/file1'],
['path/to/file1', 'path/to/file2']
);
$fileLoader = new | thFileLocatorDelegation()
{
$locatorMockForAdditionalLoader = $this->createStub(FileLocatorInterface::class);
$locatorMockForAdditionalLoader
->method('locate')
->willReturn(
| {
"filepath": "src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php",
"language": "php",
"file_size": 7924,
"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\Config\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Con... | }
public function testResolve()
{
$loader = $this->createStub(LoaderInterface::class);
$resolver = new LoaderResolver([$loader]);
$this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is | LoaderResolver([
$loader = $this->createStub(LoaderInterface::class),
]);
$this->assertEquals([$loader], $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument');
| {
"filepath": "src/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php",
"language": "php",
"file_size": 1657,
"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\Config\Tests\Loader;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Exception\LoaderLoadException;
use Symfony\Component\Config\Exception\Log... | $resolver);
$this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader');
}
public function testGetResolverWithoutSetResolver()
{
$this->expectException(LogicException::class);
$loa | oader\LoaderResolverInterface;
class LoaderTest extends TestCase
{
public function testGetSetResolver()
{
$resolver = new LoaderResolver([]);
$loader = new ProjectLoader1();
$loader->setResolver( | {
"filepath": "src/Symfony/Component/Config/Tests/Loader/LoaderTest.php",
"language": "php",
"file_size": 4041,
"cut_index": 614,
"middle_length": 229
} |
n\ArrayNode;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
use Symfony\Component\Config\Definition\ScalarNode;
class ArrayNodeTest extends TestCase
{
public function testNormalizeThrowsExceptionWhenFalseIsNot... | $node->normalize(['foo' => 'bar']);
}
public function testNormalizeWithProposals()
{
$node = new ArrayNode('root');
$node->addChild(new ArrayNode('alpha1'));
$node->addChild(new ArrayNode('alpha2'));
$node-> | hrownOnUnrecognizedChild()
{
$node = new ArrayNode('root');
$this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Unrecognized option "foo" under "root"');
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php",
"language": "php",
"file_size": 11299,
"cut_index": 921,
"middle_length": 229
} |
n\ArrayNode;
use Symfony\Component\Config\Definition\ArrayShapeGenerator;
use Symfony\Component\Config\Definition\BooleanNode;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\EnumNode;
use Symfony\Component\Config\Definition\FloatNode;
use Symfony\Component\C... | BackedTestEnum;
class ArrayShapeGeneratorTest extends TestCase
{
#[DataProvider('provideNodes')]
public function testPhpDocHandlesNodeTypes(NodeInterface $node, string $expected)
{
$arrayNode = new ArrayNode('root');
$arrayNode | Node;
use Symfony\Component\Config\Definition\StringNode;
use Symfony\Component\Config\Definition\VariableNode;
use Symfony\Component\Config\Tests\Fixtures\IntegerBackedTestEnum;
use Symfony\Component\Config\Tests\Fixtures\String | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/ArrayShapeGeneratorTest.php",
"language": "php",
"file_size": 9493,
"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\Config\Tests\Definition;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
... | ::class);
$parent->method('getPath')->willReturn($params[1]);
$constructorArgs[] = $parent;
if (isset($params[2])) {
$constructorArgs[] = $params[2];
}
}
$node = new class(. | nction testGetPathForChildNode(string $expected, array $params)
{
$constructorArgs = [];
$constructorArgs[] = $params[0];
if (isset($params[1])) {
$parent = $this->createStub(NodeInterface | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/BaseNodeTest.php",
"language": "php",
"file_size": 2211,
"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\Config\Tests\Definition;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
... | $node = new BooleanNode('test', null, '.', true);
$this->assertNull($node->normalize(null));
}
public function testNullValueOnNotNullable()
{
$node = new BooleanNode('test', null, '.', false);
$this->expectExcep | lidValues')]
public function testNormalize(bool $value)
{
$node = new BooleanNode('test');
$this->assertSame($value, $node->normalize($value));
}
public function testNullValueOnNullable()
{
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php",
"language": "php",
"file_size": 2510,
"cut_index": 563,
"middle_length": 229
} |
tion\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Tests\Fixtures\IntegerBackedTestEnum;
use Symfony\Component\Config\Tests\Fixtures\StringBackedTestEnum;
use Symfony\Component\Config\Tests\Fixtures\StringBackedTestEnum2;
use Symfony\Component\Config\Tests\Fixtures\TestEnum;
use Symfony\Componen... | \InvalidArgumentException::class);
$this->expectExceptionMessage('$values must contain at least one element.');
new EnumNode('foo', null, []);
}
public function testConstructionWithBothValuesAndEnumFqcn()
{
$this->expec | ;
$this->assertSame('foo', $node->finalize('foo'));
$this->assertSame(TestEnum::Bar, $node->finalize(TestEnum::Bar));
}
public function testConstructionWithNoValues()
{
$this->expectException( | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php",
"language": "php",
"file_size": 9651,
"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\Config\Tests\Definition;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Builder... | anBeUnset()
->children()
->node('level2', 'array')
->canBeUnset()
->children()
->node('somevalue', 'scal | KeyWithDeepHierarchy()
{
$tb = new TreeBuilder('config', 'array');
$tree = $tb
->getRootNode()
->children()
->node('level1', 'array')
->c | {
"filepath": "src/Symfony/Component/Config/Tests/Definition/FinalizationTest.php",
"language": "php",
"file_size": 2110,
"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\Config\Tests\Definition;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
... | #[DataProvider('getValidValues')]
public function testValidNonEmptyValues(int|float $value)
{
$node = new FloatNode('test');
$node->setAllowEmptyValue(false);
$this->assertSame($value, $node->finalize($value));
}
| Test extends TestCase
{
#[DataProvider('getValidValues')]
public function testNormalize(int|float $value)
{
$node = new FloatNode('test');
$this->assertSame($value, $node->normalize($value));
}
| {
"filepath": "src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php",
"language": "php",
"file_size": 2234,
"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\Config\Tests\Resource;
use Composer\Autoload\ClassLoader;
u... | $found = true;
break;
}
}
$this->assertTrue($found);
}
public function testSerializeUnserialize()
{
$res = new ComposerResource();
$ser = unserialize(serialize($res)); | ew ComposerResource();
$r = new \ReflectionClass(ClassLoader::class);
$found = false;
foreach ($res->getVendors() as $vendor) {
if ($vendor && str_starts_with($r->getFileName(), $vendor)) {
| {
"filepath": "src/Symfony/Component/Config/Tests/Resource/ComposerResourceTest.php",
"language": "php",
"file_size": 1145,
"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\Config\Definition\Builder;
use Symfony\Component\Config\Definition\BooleanNode... | function __construct(?string $name, ?NodeParentInterface $parent = null)
{
parent::__construct($name, $parent);
$this->nullEquivalent = true;
}
protected function instantiateNode(): BooleanNode
{
return new Boolea | ce|null
*
* @extends ScalarNodeDefinition<TParent>
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class BooleanNodeDefinition extends ScalarNodeDefinition
{
/**
* @param TParent $parent
*/
public | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php",
"language": "php",
"file_size": 1559,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Definition\Builder;
use Symfony\Component\Config\Definition\Exception\UnsetKeyException;
/**
* This class builds an if expression.
*
* @template T of NodeDefinition
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
* @author Christophe Co... | t = null;
/**
* @param T $node
*/
public function __construct(
protected NodeDefinition $node,
) {
}
/**
* Marks the expression as being always used.
*
* @return $this
*/
public function alway | ray';
public const TYPE_BOOL = 'bool';
public const TYPE_INT = 'int';
public const TYPE_BACKED_ENUM = 'backed-enum';
public string $allowedTypes;
public ?\Closure $ifPart = null;
public ?\Closure $thenPar | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php",
"language": "php",
"file_size": 6335,
"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\Config\Definition\Builder;
use Symfony\Component\Config\Definit... | r Jeanmonod David <david.jeanmonod@gmail.com>
*/
class FloatNodeDefinition extends NumericNodeDefinition
{
protected function instantiateNode(): FloatNode
{
return new FloatNode($this->name, $this->parent, $this->min, $this->max, $this->pa | >
*
* @autho | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php",
"language": "php",
"file_size": 814,
"cut_index": 522,
"middle_length": 14
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Definition\Builder;
/**
* This class provides a fluent interface for building a node.
*
* @template TParent of (NodeDefinition&ParentNodeDefinitionInterface)|null = null
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class NodeBuilde... | efinitionConfigurator
$this->nodeMapping = [
'array' => ArrayNodeDefinition::class,
'variable' => VariableNodeDefinition::class,
'scalar' => ScalarNodeDefinition::class,
'string' => StringNodeDefiniti | -string<NodeDefinition>>
*/
protected array $nodeMapping;
public function __construct()
{
// This list should be in sync with generics on method node() below and on TreeBuilder, ArrayNodeDefinition and D | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php",
"language": "php",
"file_size": 7266,
"cut_index": 716,
"middle_length": 229
} |
nition\Exception\InvalidDefinitionException;
use Symfony\Component\Config\Definition\NodeInterface;
/**
* This class provides a fluent interface for defining a node.
*
* @template-covariant TParent of NodeParentInterface|null = null
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
abstract class NodeDef... | ion = [];
/**
* @var MergeBuilder<$this>
*/
protected MergeBuilder $merge;
protected bool $allowEmptyValue = true;
protected mixed $nullEquivalent = null;
protected mixed $trueEquivalent = true;
protected mixed $falseEquiv | * @var ValidationBuilder<$this>
*/
protected ValidationBuilder $validation;
protected mixed $defaultValue;
protected bool $default = false;
protected bool $required = false;
protected array $deprecat | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php",
"language": "php",
"file_size": 9900,
"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\Config\Definition\Builder;
/**
* An interface that must be... | ode
* ->children()
* ->scalarNode('foo')->end()
* ->scalarNode('baz')->end()
* ->append($this->getBarNodeDefinition())
* ->end()
* ;
*
* @return $this
*/
| ns a builder to add children nodes.
*
* @return NodeBuilder<static>
*/
public function children(): NodeBuilder;
/**
* Appends a node definition.
*
* Usage:
*
* $node = $parentN | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php",
"language": "php",
"file_size": 1220,
"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\Config\Definition\Builder;
use Symfony\Component\Config\Definition\NodeInterfa... |
/**
* @param T $type
*/
public function __construct(string $name, string $type = 'array', ?NodeBuilder $builder = null)
{
$builder ??= new NodeBuilder();
$this->root = $builder->node($name, $type)->setParent($this);
| Schmitt <schmittjoh@gmail.com>
*/
class TreeBuilder implements NodeParentInterface
{
protected ?NodeInterface $tree = null;
/**
* @var NodeDefinition<$this>|null
*/
protected ?NodeDefinition $root = null;
| {
"filepath": "src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php",
"language": "php",
"file_size": 2003,
"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\Config\Definition\Builder;
use Symfony\Component\Config\Definition\NodeInterfa... | riableNode($this->name, $this->parent, $this->pathSeparator);
}
protected function createNode(): NodeInterface
{
$node = $this->instantiateNode();
if (isset($this->normalization)) {
$node->setNormalizationClosures( | extends NodeDefinition<TParent>
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class VariableNodeDefinition extends NodeDefinition
{
protected function instantiateNode(): VariableNode
{
return new Va | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php",
"language": "php",
"file_size": 1910,
"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\Config\Definition\Exception;
/**
* A very general exceptio... | turn $this->path;
}
/**
* Adds extra information that is suffixed to the original exception message.
*/
public function addHint(string $hint): void
{
if (!$this->containsHints) {
$this->message .= "\nHint: ".$ | ption
{
private ?string $path = null;
private bool $containsHints = false;
public function setPath(string $path): void
{
$this->path = $path;
}
public function getPath(): ?string
{
re | {
"filepath": "src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php",
"language": "php",
"file_size": 1127,
"cut_index": 518,
"middle_length": 229
} |
ponent\Config\Definition\BooleanNode;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\EnumNode;
use Symfony\Component\Config\Definition\FloatNode;
use Symfony\Component\Config\Definition\IntegerNode;
use Symfony\Component\Config\Definition\NodeInterface;
use Symfo... | return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace);
}
public function dumpNode(NodeInterface $node, ?string $namespace = null): string
{
$this->reference = '';
$this->writeNode($node, | *
* @author Wouter J <waldio.webdesign@gmail.com>
*/
class XmlReferenceDumper
{
private ?string $reference = null;
public function dump(ConfigurationInterface $configuration, ?string $namespace = null): string
{
| {
"filepath": "src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php",
"language": "php",
"file_size": 9752,
"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\Config\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\ConfigCache;
use Symfony\Componen... | (), 'config_');
}
protected function tearDown(): void
{
$files = [$this->cacheFile, $this->cacheFile.'.meta', $this->metaFile];
foreach ($files as $file) {
if (file_exists($file)) {
@unlink($file);
| Case
{
private string $cacheFile;
private string $metaFile;
protected function setUp(): void
{
$this->cacheFile = tempnam(sys_get_temp_dir(), 'config_');
$this->metaFile = tempnam(sys_get_temp_dir | {
"filepath": "src/Symfony/Component/Config/Tests/ConfigCacheTest.php",
"language": "php",
"file_size": 3284,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\ResourceCheckerConfigCache;
use Symfony\Component\Config\ResourceCheckerInterface;
use Symfony\Component\Config\Tests\Fixtures\Res... | ted function tearDown(): void
{
$files = [$this->cacheFile, $this->cacheFile.'.meta', $this->cacheFile.'.meta.json', $this->metaFile, $this->metaFile.'.json'];
foreach ($files as $file) {
if (file_exists($file)) {
| ile;
private string $metaFile;
protected function setUp(): void
{
$this->cacheFile = tempnam(sys_get_temp_dir(), 'config_');
$this->metaFile = tempnam(sys_get_temp_dir(), 'config_');
}
protec | {
"filepath": "src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php",
"language": "php",
"file_size": 6546,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Tests\Util;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Util\Exception\InvalidXmlException;
use Symfony\Component\Config\Util\XmlUtils;
class XmlUtilsTest extends TestCase
{
public ... | atch (\InvalidArgumentException $e) {
$this->assertStringContainsString('is not a file', $e->getMessage());
}
try {
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported | gumentException $e) {
$this->assertStringContainsString('is not a file', $e->getMessage());
}
try {
XmlUtils::loadFile($fixtures.'non_existing.xml');
$this->fail();
} c | {
"filepath": "src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php",
"language": "php",
"file_size": 8638,
"cut_index": 716,
"middle_length": 229
} |
s\Fixtures\Configuration;
use Symfony\Component\Config\Definition\NodeInterface;
class CustomNode implements NodeInterface
{
public function getName(): string
{
return 'custom_node';
}
public function getPath(): string
{
return 'custom';
}
public function isRequired(): bo... | d
{
return $value;
}
public function merge(mixed $leftSide, mixed $rightSide): mixed
{
return array_merge($leftSide, $rightSide);
}
public function finalize(mixed $value): mixed
{
return $value;
}
} | }
public function normalize(mixed $value): mixe | {
"filepath": "src/Symfony/Component/Config/Tests/Fixtures/Configuration/CustomNode.php",
"language": "php",
"file_size": 868,
"cut_index": 559,
"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\Config\Tests\Resource;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Config\Tests\Fix... | function testGetResource()
{
$res = new ClassExistenceResource('BarClass');
$this->assertSame('BarClass', $res->getResource());
}
public function testIsFreshWhenClassDoesNotExist()
{
$res = new ClassExistenceResour | alClass;
class ClassExistenceResourceTest extends TestCase
{
public function testToString()
{
$res = new ClassExistenceResource('BarClass');
$this->assertSame('BarClass', (string) $res);
}
public | {
"filepath": "src/Symfony/Component/Config/Tests/Resource/ClassExistenceResourceTest.php",
"language": "php",
"file_size": 3803,
"cut_index": 614,
"middle_length": 229
} |
on implements ParentNodeDefinitionInterface
{
protected bool $performDeepMerging = true;
protected bool $ignoreExtraKeys = false;
protected bool $removeExtraKeys = true;
/**
* @var NodeDefinition<$this>[]
*/
protected array $children = [];
/**
* @var NodeDefinition<$this>
*/
... | ormalizeKeys = true;
/**
* @var list<ExprBuilder::TYPE_*>|null
*/
protected ?array $allowedTypes = null;
/**
* @param TParent $parent
*/
public function __construct(?string $name, ?NodeParentInterface $parent = null)
| false;
protected bool $addDefaults = false;
protected int|string|array|false|null $addDefaultChildren = false;
/**
* @var NodeBuilder<static>
*/
protected NodeBuilder $nodeBuilder;
protected bool $n | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php",
"language": "php",
"file_size": 20319,
"cut_index": 1331,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Definition\Builder;
/**
* This class builds merge conditi... | lic function allowUnset(bool $allow = true): static
{
$this->allowFalse = $allow;
return $this;
}
/**
* Sets whether the node can be overwritten.
*
* @return $this
*/
public function denyOverwrite(bool | = true;
/**
* @param T $node
*/
public function __construct(
protected NodeDefinition $node,
) {
}
/**
* Sets whether the node can be unset.
*
* @return $this
*/
pub | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php",
"language": "php",
"file_size": 1264,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Definition\Builder;
use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException;... | * Ensures that the value is smaller than the given reference.
*
* @return $this
*
* @throws \InvalidArgumentException when the constraint is inconsistent
*/
public function max(int|float $max): static
{
if (isset($t |
*
* @author David Jeanmonod <david.jeanmonod@gmail.com>
*/
abstract class NumericNodeDefinition extends ScalarNodeDefinition
{
protected int|float|null $min = null;
protected int|float|null $max = null;
/**
| {
"filepath": "src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php",
"language": "php",
"file_size": 2023,
"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\Config\Definition\Builder;
use Symfony\Component\Config... | uthor Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class ScalarNodeDefinition extends VariableNodeDefinition
{
protected function instantiateNode(): ScalarNode
{
return new ScalarNode($this->name, $this->parent, $this->pathSeparator);
| rent>
*
* @a | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php",
"language": "php",
"file_size": 789,
"cut_index": 514,
"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\Config\Definition\Configurator;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use... | \Component\Config\Definition\Builder\StringNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition;
use Symfony\Component\Config\Definition\Loader\DefinitionFileLoa | eDefinition;
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
use Symfony | {
"filepath": "src/Symfony/Component/Config/Definition/Configurator/DefinitionConfigurator.php",
"language": "php",
"file_size": 2611,
"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\Config\Definition\Loader;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Configurator\DefinitionConfi... | e TreeBuilder $treeBuilder,
FileLocatorInterface $locator,
private ?ContainerBuilder $container = null,
) {
parent::__construct($locator);
}
public function load(mixed $resource, ?string $type = null): mixed
{
| ader loads config definitions from a PHP file.
*
* The PHP file is required.
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class DefinitionFileLoader extends FileLoader
{
public function __construct(
privat | {
"filepath": "src/Symfony/Component/Config/Definition/Loader/DefinitionFileLoader.php",
"language": "php",
"file_size": 3242,
"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\Config\Tests\Exception;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Exception\LoaderLoadException;
class LoaderLoadExceptionTest extends ... | resource "resource". Make sure there is a loader supporting the "foobar" type.', $exception->getMessage());
}
public function testMessageCannotLoadResourceWithAnnotationType()
{
$exception = new LoaderLoadException('resource', null, 0, | ".', $exception->getMessage());
}
public function testMessageCannotLoadResourceWithType()
{
$exception = new LoaderLoadException('resource', null, 0, null, 'foobar');
$this->assertEquals('Cannot load | {
"filepath": "src/Symfony/Component/Config/Tests/Exception/LoaderLoadExceptionTest.php",
"language": "php",
"file_size": 4020,
"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\Config\Tests\Fixtures\Configuration;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInte... | ')
->fixXmlConfig('cms_page')
->children()
->booleanNode('boolean')->defaultTrue()->end()
->scalarNode('scalar_empty')->end()
->scalarNode('scalar_null')->defaultNull()->end()
| public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('acme_root');
$treeBuilder->getRootNode()
->fixXmlConfig('parameter')
->fixXmlConfig('connection | {
"filepath": "src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php",
"language": "php",
"file_size": 5049,
"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\Config\Definition\Builder;
use Symfony\Component\Config\Definition\EnumNode;
... | throw new \InvalidArgumentException('->values() must be called with at least one value.');
}
$this->values = $values;
return $this;
}
/**
* @param class-string<\UnitEnum> $enumFqcn
*
* @return $thi | EnumNodeDefinition extends ScalarNodeDefinition
{
private array $values;
private string $enumFqcn;
/**
* @return $this
*/
public function values(array $values): static
{
if (!$values) {
| {
"filepath": "src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php",
"language": "php",
"file_size": 1967,
"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\Config\Definition\Builder;
/**
* This class builds vali... | n builder to build it if null is provided.
*
* @return ($closure is \Closure ? $this : ExprBuilder<T>)
*/
public function rule(?\Closure $closure = null): ExprBuilder|static
{
if ($closure) {
$this->rules[] = $clo | public array $rules = [];
/**
* @param T $node
*/
public function __construct(
protected NodeDefinition $node,
) {
}
/**
* Registers a closure to run as normalization or an expressio | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php",
"language": "php",
"file_size": 1114,
"cut_index": 515,
"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\Config\Tests;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Exception\FileLocatorFileNotFound... | an absolute path');
}
public static function getIsAbsolutePathTests(): array
{
return [
['/foo.xml'],
['c:\\\\foo.xml'],
['c:/foo.xml'],
['\\server\\foo.xml'],
['https://serv | )
{
$loader = new FileLocator([]);
$r = new \ReflectionObject($loader);
$m = $r->getMethod('isAbsolutePath');
$this->assertTrue($m->invoke($loader, $path), '->isAbsolutePath() returns true for | {
"filepath": "src/Symfony/Component/Config/Tests/FileLocatorTest.php",
"language": "php",
"file_size": 4133,
"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\Config\Definition\Builder;
use Symfony\Component\Config\De... | nmonod@gmail.com>
*/
class IntegerNodeDefinition extends NumericNodeDefinition
{
protected function instantiateNode(): IntegerNode
{
return new IntegerNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator);
}
}
| on<TParent>
*
* @author Jeanmonod David <david.jea | {
"filepath": "src/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php",
"language": "php",
"file_size": 825,
"cut_index": 517,
"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\Config\Definition\Builder;
/**
* This class builds normalization conditions.
... | * Registers a key to remap to its plural form.
*
* @param string $key The key to remap
* @param string|null $plural The plural of the key in case of irregular plural
*
* @return $this
*/
public function remap( | array $before = [];
public array $declaredTypes = [];
public array $remappings = [];
/**
* @param T $node
*/
public function __construct(
protected NodeDefinition $node,
) {
}
/**
| {
"filepath": "src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php",
"language": "php",
"file_size": 1636,
"cut_index": 537,
"middle_length": 229
} |
ackage.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNo... | ted function getNodeClass(string $type): string
{
return match ($type) {
'bar',
'variable' => __NAMESPACE__ . '\\' . ucfirst($type) . 'NodeDefinition',
default => parent::getNodeClass($type),
};
} | return $this->node($name, 'bar');
}
protec | {
"filepath": "src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php",
"language": "php",
"file_size": 870,
"cut_index": 559,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Config\Definition\Dumper;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\BaseNode;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\EnumNode;
use Symfony\Comp... | nfigurationInterface $configuration): string
{
return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree());
}
public function dumpAtPath(ConfigurationInterface $configuration, string $path): string
{
$rootNo | * Dumps a Yaml reference configuration for the given configuration/node instance.
*
* @author Kevin Bond <kevinbond@gmail.com>
*/
class YamlReferenceDumper
{
private ?string $reference = null;
public function dump(Co | {
"filepath": "src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php",
"language": "php",
"file_size": 7918,
"cut_index": 716,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.