Skip to content
Snippets Groups Projects
Commit 73b7d8da authored by Angie Byron's avatar Angie Byron
Browse files

Issue #1834594 by effulgentsia, Rob Loach: Update dependencies (Symfony and Twig).

parent d06d55ce
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Showing
with 164 additions and 39 deletions
......@@ -242,11 +242,15 @@ public function register($prepend = false)
* Loads the given class or interface.
*
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
require $file;
return true;
}
}
......
......
......@@ -20,16 +20,15 @@
"php": ">=5.3.3"
},
"require-dev": {
"symfony/finder": "2.1.*"
"symfony/finder": "2.2.*"
},
"autoload": {
"psr-0": { "Symfony\\Component\\ClassLoader": "" }
"psr-0": { "Symfony\\Component\\ClassLoader\\": "" }
},
"target-dir": "Symfony/Component/ClassLoader",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
"dev-master": "2.2-dev"
}
}
}
......@@ -9,7 +9,7 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="Tests/bootstrap.php"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Symfony ClassLoader Component Test Suite">
......
......
/Tests export-ignore
phpunit.xml.dist export-ignore
vendor/
composer.lock
phpunit.xml
......@@ -116,7 +116,7 @@ private function processArguments(array $arguments)
*
* @param string $id A full id or alias for a service definition.
*
* @return Definition The definition related to the supplied id
* @return Definition|null The definition related to the supplied id
*/
private function getDefinition($id)
{
......
......
......@@ -49,7 +49,7 @@ public function process(ContainerBuilder $container)
/**
* Checks for circular references.
*
* @param array $edges An array of Nodes
* @param ServiceReferenceGraphEdge[] $edges An array of Edges
*
* @throws ServiceCircularReferenceException When a circular reference is found.
*/
......
......
......@@ -70,6 +70,8 @@ public function process(ContainerBuilder $container)
*
* @param ContainerBuilder $container The ContainerBuilder
* @param array $arguments An array of arguments
*
* @return array
*/
private function inlineArguments(ContainerBuilder $container, array $arguments)
{
......
......
......@@ -21,14 +21,22 @@
*/
class RepeatedPass implements CompilerPassInterface
{
private $repeat;
/**
* @var Boolean
*/
private $repeat = false;
/**
* @var RepeatablePassInterface[]
*/
private $passes;
/**
* Constructor.
*
* @param array $passes An array of RepeatablePassInterface objects
* @throws InvalidArgumentException if a pass is not a RepeatablePassInterface instance
* @param RepeatablePassInterface[] $passes An array of RepeatablePassInterface objects
*
* @throws InvalidArgumentException when the passes don't implement RepeatablePassInterface
*/
public function __construct(array $passes)
{
......@@ -71,7 +79,7 @@ public function setRepeat()
/**
* Returns the passes
*
* @return array An array of RepeatablePassInterface objects
* @return RepeatablePassInterface[] An array of RepeatablePassInterface objects
*/
public function getPasses()
{
......
......
......@@ -97,6 +97,8 @@ private function updateReferences($container, $currentId, $newId)
* @param array $arguments An array of Arguments
* @param string $currentId The alias identifier
* @param string $newId The identifier the alias points to
*
* @return array
*/
private function updateArgumentReferences(array $arguments, $currentId, $newId)
{
......
......
......@@ -58,6 +58,8 @@ public function process(ContainerBuilder $container)
* @param DefinitionDecorator $definition
*
* @return Definition
*
* @throws \RuntimeException When the definition is invalid
*/
private function resolveDefinition($id, DefinitionDecorator $definition)
{
......
......
......@@ -71,6 +71,10 @@ public function process(ContainerBuilder $container)
*
* @param array $arguments An array of Reference objects
* @param Boolean $inMethodCall
*
* @return array
*
* @throws \RuntimeException When the config is invalid
*/
private function processArguments(array $arguments, $inMethodCall = false)
{
......
......
......@@ -25,6 +25,8 @@ class ResolveParameterPlaceHoldersPass implements CompilerPassInterface
* Processes the ContainerBuilder to resolve parameter placeholders.
*
* @param ContainerBuilder $container
*
* @throws ParameterNotFoundException When an invalid parameter is referenced
*/
public function process(ContainerBuilder $container)
{
......
......
......@@ -23,6 +23,9 @@
*/
class ServiceReferenceGraph
{
/**
* @var ServiceReferenceGraphNode[]
*/
private $nodes;
/**
......@@ -37,6 +40,8 @@ public function __construct()
* Checks if the graph has a specific node.
*
* @param string $id Id to check
*
* @return Boolean
*/
public function hasNode($id)
{
......@@ -64,7 +69,7 @@ public function getNode($id)
/**
* Returns all nodes.
*
* @return array An array of all ServiceReferenceGraphNode objects
* @return ServiceReferenceGraphNode[] An array of all ServiceReferenceGraphNode objects
*/
public function getNodes()
{
......
......
......@@ -61,7 +61,11 @@
*/
class Container implements IntrospectableContainerInterface
{
/**
* @var ParameterBagInterface
*/
protected $parameterBag;
protected $services;
protected $scopes;
protected $scopeChildren;
......@@ -180,6 +184,9 @@ public function setParameter($name, $value)
* @param object $service The service instance
* @param string $scope The scope of the service
*
* @throws \RuntimeException When trying to set a service in an inactive scope
* @throws \InvalidArgumentException When trying to set a service in the prototype scope
*
* @api
*/
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
......@@ -229,6 +236,8 @@ public function has($id)
* @return object The associated service
*
* @throws InvalidArgumentException if the service is not defined
* @throws ServiceCircularReferenceException When a circular reference is detected
* @throws ServiceNotFoundException When the service is not defined
*
* @see Reference
*
......@@ -253,6 +262,11 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
$service = $this->$method();
} catch (\Exception $e) {
unset($this->loading[$id]);
if (isset($this->services[$id])) {
unset($this->services[$id]);
}
throw $e;
}
......@@ -301,6 +315,9 @@ public function getServiceIds()
*
* @param string $name
*
* @throws RuntimeException When the parent scope is inactive
* @throws InvalidArgumentException When the scope does not exist
*
* @api
*/
public function enterScope($name)
......@@ -384,6 +401,8 @@ public function leaveScope($name)
*
* @param ScopeInterface $scope
*
* @throws \InvalidArgumentException When the scope is invalid
*
* @api
*/
public function addScope(ScopeInterface $scope)
......
......
......@@ -31,12 +31,36 @@
*/
class ContainerBuilder extends Container implements TaggedContainerInterface
{
/**
* @var ExtensionInterface[]
*/
private $extensions = array();
/**
* @var ExtensionInterface[]
*/
private $extensionsByNs = array();
/**
* @var Definition[]
*/
private $definitions = array();
/**
* @var Alias[]
*/
private $aliases = array();
/**
* @var ResourceInterface[]
*/
private $resources = array();
private $extensionConfigs = array();
/**
* @var Compiler
*/
private $compiler;
/**
......@@ -62,6 +86,8 @@ public function registerExtension(ExtensionInterface $extension)
*
* @return ExtensionInterface An extension instance
*
* @throws \LogicException if the extension is not registered
*
* @api
*/
public function getExtension($name)
......@@ -80,7 +106,7 @@ public function getExtension($name)
/**
* Returns all registered extensions.
*
* @return array An array of ExtensionInterface
* @return ExtensionInterface[] An array of ExtensionInterface
*
* @api
*/
......@@ -131,6 +157,15 @@ public function addResource(ResourceInterface $resource)
return $this;
}
/**
* Sets the resources for this configuration.
*
* @param ResourceInterface[] $resources An array of resources
*
* @return ContainerBuilder The current instance
*
* @api
*/
public function setResources(array $resources)
{
$this->resources = $resources;
......@@ -143,6 +178,8 @@ public function setResources(array $resources)
*
* @param object $object An object instance
*
* @return ContainerBuilder The current instance
*
* @api
*/
public function addObjectResource($object)
......@@ -151,6 +188,8 @@ public function addObjectResource($object)
do {
$this->addResource(new FileResource($parent->getFileName()));
} while ($parent = $parent->getParentClass());
return $this;
}
/**
......@@ -162,6 +201,8 @@ public function addObjectResource($object)
* @return ContainerBuilder The current instance
* @throws BadMethodCallException When this ContainerBuilder is frozen
*
* @throws \LogicException if the container is frozen
*
* @api
*/
public function loadFromExtension($extension, array $values = array())
......@@ -183,6 +224,8 @@ public function loadFromExtension($extension, array $values = array())
* @param CompilerPassInterface $pass A compiler pass
* @param string $type The type of compiler pass
*
* @return ContainerBuilder The current instance
*
* @api
*/
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
......@@ -194,6 +237,8 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig:
$this->compiler->addPass($pass, $type);
$this->addObjectResource($pass);
return $this;
}
/**
......@@ -480,7 +525,7 @@ public function addAliases(array $aliases)
/**
* Sets the service aliases.
*
* @param array $aliases An array of service definitions
* @param array $aliases An array of aliases
*
* @api
*/
......@@ -494,7 +539,10 @@ public function setAliases(array $aliases)
* Sets an alias for an existing service.
*
* @param string $alias The alias to create
* @param mixed $id The service to alias
* @param string|Alias $id The service to alias
*
* @throws \InvalidArgumentException if the id is not a string or an Alias
* @throws \InvalidArgumentException if the alias is for itself
*
* @api
*/
......@@ -546,7 +594,7 @@ public function hasAlias($id)
/**
* Gets all defined aliases.
*
* @return array An array of aliases
* @return Alias[] An array of aliases
*
* @api
*/
......@@ -612,7 +660,7 @@ public function addDefinitions(array $definitions)
/**
* Sets the service definitions.
*
* @param array $definitions An array of service definitions
* @param Definition[] $definitions An array of service definitions
*
* @api
*/
......@@ -625,7 +673,7 @@ public function setDefinitions(array $definitions)
/**
* Gets all service definitions.
*
* @return array An array of Definition instances
* @return Definition[] An array of Definition instances
*
* @api
*/
......@@ -640,6 +688,8 @@ public function getDefinitions()
* @param string $id The service identifier
* @param Definition $definition A Definition instance
*
* @return Definition the service definition
*
* @throws BadMethodCallException When this ContainerBuilder is frozen
*
* @api
......@@ -723,7 +773,8 @@ public function findDefinition($id)
*
* @return object The service described by the service definition
*
* @throws RuntimeException When factory specification is incomplete or scope is inactive
* @throws RuntimeException When the scope is inactive
* @throws RuntimeException When the factory definition is incomplete
* @throws InvalidArgumentException When configure callable is not callable
*/
private function createService(Definition $definition, $id)
......@@ -788,10 +839,8 @@ private function createService(Definition $definition, $id)
}
if ($callable = $definition->getConfigurator()) {
if (is_array($callable) && is_object($callable[0]) && $callable[0] instanceof Reference) {
$callable[0] = $this->get((string) $callable[0]);
} elseif (is_array($callable)) {
$callable[0] = $parameterBag->resolveValue($callable[0]);
if (is_array($callable)) {
$callable[0] = $callable[0] instanceof Reference ? $this->get((string) $callable[0]) : $parameterBag->resolveValue($callable[0]);
}
if (!is_callable($callable)) {
......@@ -817,9 +866,9 @@ public function resolveServices($value)
foreach ($value as &$v) {
$v = $this->resolveServices($v);
}
} elseif (is_object($value) && $value instanceof Reference) {
} elseif ($value instanceof Reference) {
$value = $this->get((string) $value, $value->getInvalidBehavior());
} elseif (is_object($value) && $value instanceof Definition) {
} elseif ($value instanceof Definition) {
$value = $this->createService($value, null);
}
......@@ -847,6 +896,21 @@ public function findTaggedServiceIds($name)
return $tags;
}
/**
* Returns all tags the defined services use.
*
* @return array An array of tags
*/
public function findTags()
{
$tags = array();
foreach ($this->getDefinitions() as $id => $definition) {
$tags = array_merge(array_keys($definition->getTags()), $tags);
}
return array_unique($tags);
}
/**
* Returns the Service Conditionals.
*
......@@ -862,7 +926,7 @@ public static function getServiceConditionals($value)
foreach ($value as $v) {
$services = array_unique(array_merge($services, self::getServiceConditionals($v)));
}
} elseif (is_object($value) && $value instanceof Reference && $value->getInvalidBehavior() === ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
} elseif ($value instanceof Reference && $value->getInvalidBehavior() === ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
$services[] = (string) $value;
}
......
......
......@@ -12,6 +12,8 @@
namespace Symfony\Component\DependencyInjection;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
/**
* ContainerInterface is the interface implemented by service container classes.
......@@ -49,6 +51,8 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER);
* @return object The associated service
*
* @throws InvalidArgumentException if the service is not defined
* @throws ServiceCircularReferenceException When a circular reference is detected
* @throws ServiceNotFoundException When the service is not defined
*
* @see Reference
*
......
......
......@@ -241,6 +241,8 @@ public function addArgument($argument)
*
* @return Definition The current instance
*
* @throws \OutOfBoundsException When the replaced argument does not exist
*
* @api
*/
public function replaceArgument($index, $argument)
......@@ -273,6 +275,8 @@ public function getArguments()
*
* @return mixed The argument value
*
* @throws \OutOfBoundsException When the argument does not exist
*
* @api
*/
public function getArgument($index)
......@@ -628,7 +632,7 @@ public function isAbstract()
/**
* Sets a configurator to call after the service is fully initialized.
*
* @param mixed $callable A PHP callable
* @param callable $callable A PHP callable
*
* @return Definition The current instance
*
......@@ -644,7 +648,7 @@ public function setConfigurator($callable)
/**
* Gets the configurator to call after the service is fully initialized.
*
* @return mixed The PHP callable to call
* @return callable The PHP callable to call
*
* @api
*/
......
......
......@@ -29,7 +29,7 @@ class DefinitionDecorator extends Definition
/**
* Constructor.
*
* @param Definition $parent The Definition instance to decorate.
* @param string $parent The id of Definition instance to decorate.
*
* @api
*/
......@@ -44,7 +44,7 @@ public function __construct($parent)
/**
* Returns the Definition being decorated.
*
* @return Definition
* @return string
*
* @api
*/
......@@ -159,6 +159,8 @@ public function setPublic($boolean)
*
* @return mixed The argument value
*
* @throws \OutOfBoundsException When the argument does not exist
*
* @api
*/
public function getArgument($index)
......
......
......@@ -130,7 +130,7 @@ private function findEdges($id, $arguments, $required, $name)
{
$edges = array();
foreach ($arguments as $argument) {
if (is_object($argument) && $argument instanceof Parameter) {
if ($argument instanceof Parameter) {
$argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null;
} elseif (is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) {
$argument = $this->container->hasParameter($match[1]) ? $this->container->getParameter($match[1]) : null;
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment