Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6
This commit is contained in:
parent
db56c09587
commit
f1e72395cb
588 changed files with 26857 additions and 2777 deletions
|
@ -17,8 +17,6 @@ class Alias
|
|||
private $public;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $id Alias identifier
|
||||
* @param bool $public If this alias is public
|
||||
*/
|
||||
|
|
|
@ -34,8 +34,6 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
|
|||
private $onlyConstructorArguments;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param bool $onlyConstructorArguments Sets this Service Reference pass to ignore method calls
|
||||
*/
|
||||
public function __construct($onlyConstructorArguments = false)
|
||||
|
@ -128,7 +126,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
|
|||
/**
|
||||
* Returns a service definition given the full name or an alias.
|
||||
*
|
||||
* @param string $id A full id or alias for a service definition.
|
||||
* @param string $id A full id or alias for a service definition
|
||||
*
|
||||
* @return Definition|null The definition related to the supplied id
|
||||
*/
|
||||
|
|
|
@ -34,19 +34,32 @@ class AutowirePass implements CompilerPassInterface
|
|||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
foreach ($container->getDefinitions() as $id => $definition) {
|
||||
if ($definition->isAutowired()) {
|
||||
$this->completeDefinition($id, $definition);
|
||||
$throwingAutoloader = function ($class) { throw new \ReflectionException(sprintf('Class %s does not exist', $class)); };
|
||||
spl_autoload_register($throwingAutoloader);
|
||||
|
||||
try {
|
||||
$this->container = $container;
|
||||
foreach ($container->getDefinitions() as $id => $definition) {
|
||||
if ($definition->isAutowired()) {
|
||||
$this->completeDefinition($id, $definition);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
|
||||
spl_autoload_unregister($throwingAutoloader);
|
||||
|
||||
// Free memory and remove circular reference to container
|
||||
$this->container = null;
|
||||
$this->reflectionClasses = array();
|
||||
$this->definedTypes = array();
|
||||
$this->types = null;
|
||||
$this->notGuessableTypes = array();
|
||||
|
||||
if (isset($e)) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +105,7 @@ class AutowirePass implements CompilerPassInterface
|
|||
$this->populateAvailableTypes();
|
||||
}
|
||||
|
||||
if (isset($this->types[$typeHint->name])) {
|
||||
if (isset($this->types[$typeHint->name]) && !isset($this->notGuessableTypes[$typeHint->name])) {
|
||||
$value = new Reference($this->types[$typeHint->name]);
|
||||
} else {
|
||||
try {
|
||||
|
@ -107,11 +120,11 @@ class AutowirePass implements CompilerPassInterface
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (\ReflectionException $reflectionException) {
|
||||
} catch (\ReflectionException $e) {
|
||||
// Typehint against a non-existing class
|
||||
|
||||
if (!$parameter->isDefaultValueAvailable()) {
|
||||
throw new RuntimeException(sprintf('Cannot autowire argument %s for %s because the type-hinted class does not exist (%s).', $index + 1, $definition->getClass(), $reflectionException->getMessage()), 0, $reflectionException);
|
||||
throw new RuntimeException(sprintf('Cannot autowire argument %s for %s because the type-hinted class does not exist (%s).', $index + 1, $definition->getClass(), $e->getMessage()), 0, $e);
|
||||
}
|
||||
|
||||
$value = $parameter->getDefaultValue();
|
||||
|
@ -177,22 +190,26 @@ class AutowirePass implements CompilerPassInterface
|
|||
*/
|
||||
private function set($type, $id)
|
||||
{
|
||||
if (isset($this->definedTypes[$type]) || isset($this->notGuessableTypes[$type])) {
|
||||
if (isset($this->definedTypes[$type])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($this->types[$type])) {
|
||||
if ($this->types[$type] === $id) {
|
||||
return;
|
||||
}
|
||||
if (!isset($this->types[$type])) {
|
||||
$this->types[$type] = $id;
|
||||
|
||||
unset($this->types[$type]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->types[$type] === $id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($this->notGuessableTypes[$type])) {
|
||||
$this->notGuessableTypes[$type] = true;
|
||||
|
||||
return;
|
||||
$this->types[$type] = (array) $this->types[$type];
|
||||
}
|
||||
|
||||
$this->types[$type] = $id;
|
||||
$this->types[$type][] = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,8 +224,16 @@ class AutowirePass implements CompilerPassInterface
|
|||
*/
|
||||
private function createAutowiredDefinition(\ReflectionClass $typeHint, $id)
|
||||
{
|
||||
if (isset($this->notGuessableTypes[$typeHint->name]) || !$typeHint->isInstantiable()) {
|
||||
throw new RuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s".', $typeHint->name, $id));
|
||||
if (isset($this->notGuessableTypes[$typeHint->name])) {
|
||||
$classOrInterface = $typeHint->isInterface() ? 'interface' : 'class';
|
||||
$matchingServices = implode(', ', $this->types[$typeHint->name]);
|
||||
|
||||
throw new RuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". Multiple services exist for this %s (%s).', $typeHint->name, $id, $classOrInterface, $matchingServices));
|
||||
}
|
||||
|
||||
if (!$typeHint->isInstantiable()) {
|
||||
$classOrInterface = $typeHint->isInterface() ? 'interface' : 'class';
|
||||
throw new RuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". No services were found matching this %s and it cannot be auto-registered.', $typeHint->name, $id, $classOrInterface));
|
||||
}
|
||||
|
||||
$argumentId = sprintf('autowired.%s', $typeHint->name);
|
||||
|
@ -217,7 +242,14 @@ class AutowirePass implements CompilerPassInterface
|
|||
$argumentDefinition->setPublic(false);
|
||||
|
||||
$this->populateAvailableType($argumentId, $argumentDefinition);
|
||||
$this->completeDefinition($argumentId, $argumentDefinition);
|
||||
|
||||
try {
|
||||
$this->completeDefinition($argumentId, $argumentDefinition);
|
||||
} catch (RuntimeException $e) {
|
||||
$classOrInterface = $typeHint->isInterface() ? 'interface' : 'class';
|
||||
$message = sprintf('Unable to autowire argument of type "%s" for the service "%s". No services were found matching this %s and it cannot be auto-registered.', $typeHint->name, $id, $classOrInterface);
|
||||
throw new RuntimeException($message, 0, $e);
|
||||
}
|
||||
|
||||
return new Reference($argumentId);
|
||||
}
|
||||
|
@ -228,7 +260,7 @@ class AutowirePass implements CompilerPassInterface
|
|||
* @param string $id
|
||||
* @param Definition $definition
|
||||
*
|
||||
* @return \ReflectionClass|null
|
||||
* @return \ReflectionClass|false
|
||||
*/
|
||||
private function getReflectionClass($id, Definition $definition)
|
||||
{
|
||||
|
@ -238,15 +270,17 @@ class AutowirePass implements CompilerPassInterface
|
|||
|
||||
// Cannot use reflection if the class isn't set
|
||||
if (!$class = $definition->getClass()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
$class = $this->container->getParameterBag()->resolveValue($class);
|
||||
|
||||
try {
|
||||
return $this->reflectionClasses[$id] = new \ReflectionClass($class);
|
||||
} catch (\ReflectionException $reflectionException) {
|
||||
// return null
|
||||
$reflector = new \ReflectionClass($class);
|
||||
} catch (\ReflectionException $e) {
|
||||
$reflector = false;
|
||||
}
|
||||
|
||||
return $this->reflectionClasses[$id] = $reflector;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,15 +60,19 @@ class CheckCircularReferencesPass implements CompilerPassInterface
|
|||
$id = $node->getId();
|
||||
|
||||
if (empty($this->checkedNodes[$id])) {
|
||||
$searchKey = array_search($id, $this->currentPath);
|
||||
$this->currentPath[] = $id;
|
||||
|
||||
if (false !== $searchKey) {
|
||||
throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey));
|
||||
// don't check circular dependencies for lazy services
|
||||
if (!$node->getValue() || !$node->getValue()->isLazy()) {
|
||||
$searchKey = array_search($id, $this->currentPath);
|
||||
$this->currentPath[] = $id;
|
||||
|
||||
if (false !== $searchKey) {
|
||||
throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey));
|
||||
}
|
||||
|
||||
$this->checkOutEdges($node->getOutEdges());
|
||||
}
|
||||
|
||||
$this->checkOutEdges($node->getOutEdges());
|
||||
|
||||
$this->checkedNodes[$id] = true;
|
||||
array_pop($this->currentPath);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,6 @@ class Compiler
|
|||
private $loggingFormatter;
|
||||
private $serviceReferenceGraph;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->passConfig = new PassConfig();
|
||||
|
|
|
@ -52,10 +52,14 @@ class DecoratorServicePass implements CompilerPassInterface
|
|||
$public = $alias->isPublic();
|
||||
$container->setAlias($renamedId, new Alias((string) $alias, false));
|
||||
} else {
|
||||
$definition = $container->getDefinition($inner);
|
||||
$public = $definition->isPublic();
|
||||
$definition->setPublic(false);
|
||||
$container->setDefinition($renamedId, $definition);
|
||||
$decoratedDefinition = $container->getDefinition($inner);
|
||||
$definition->setTags(array_merge($decoratedDefinition->getTags(), $definition->getTags()));
|
||||
$definition->setAutowiringTypes(array_merge($decoratedDefinition->getAutowiringTypes(), $definition->getAutowiringTypes()));
|
||||
$public = $decoratedDefinition->isPublic();
|
||||
$decoratedDefinition->setPublic(false);
|
||||
$decoratedDefinition->setTags(array());
|
||||
$decoratedDefinition->setAutowiringTypes(array());
|
||||
$container->setDefinition($renamedId, $decoratedDefinition);
|
||||
}
|
||||
|
||||
$container->setAlias($inner, new Alias($id, $public));
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Symfony\Component\DependencyInjection\Compiler;
|
|||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* A pass to automatically process extensions if they implement
|
||||
* A pass to automatically process extensions if they implement
|
||||
* CompilerPassInterface.
|
||||
*
|
||||
* @author Wouter J <wouter@wouterj.nl>
|
||||
|
|
|
@ -35,9 +35,6 @@ class PassConfig
|
|||
private $optimizationPasses;
|
||||
private $removingPasses;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->mergePass = new MergeExtensionConfigurationPass();
|
||||
|
@ -58,8 +55,8 @@ class PassConfig
|
|||
|
||||
$this->removingPasses = array(
|
||||
new RemovePrivateAliasesPass(),
|
||||
new RemoveAbstractDefinitionsPass(),
|
||||
new ReplaceAliasByActualDefinitionPass(),
|
||||
new RemoveAbstractDefinitionsPass(),
|
||||
new RepeatedPass(array(
|
||||
new AnalyzeServiceReferencesPass(),
|
||||
new InlineServiceDefinitionsPass(),
|
||||
|
@ -102,8 +99,7 @@ class PassConfig
|
|||
throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type));
|
||||
}
|
||||
|
||||
$passes = &$this->$property;
|
||||
$passes[] = $pass;
|
||||
$this->{$property}[] = $pass;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,9 +153,9 @@ class PassConfig
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets all passes for the Merge pass.
|
||||
* Gets the Merge pass.
|
||||
*
|
||||
* @return array An array of passes
|
||||
* @return CompilerPassInterface The merge pass
|
||||
*/
|
||||
public function getMergePass()
|
||||
{
|
||||
|
|
|
@ -32,8 +32,6 @@ class RepeatedPass implements CompilerPassInterface
|
|||
private $passes;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param RepeatablePassInterface[] $passes An array of RepeatablePassInterface objects
|
||||
*
|
||||
* @throws InvalidArgumentException when the passes don't implement RepeatablePassInterface
|
||||
|
@ -58,14 +56,12 @@ class RepeatedPass implements CompilerPassInterface
|
|||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$this->repeat = false;
|
||||
foreach ($this->passes as $pass) {
|
||||
$pass->process($container);
|
||||
}
|
||||
|
||||
if ($this->repeat) {
|
||||
$this->process($container);
|
||||
}
|
||||
do {
|
||||
$this->repeat = false;
|
||||
foreach ($this->passes as $pass) {
|
||||
$pass->process($container);
|
||||
}
|
||||
} while ($this->repeat);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,6 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
|
|||
{
|
||||
private $compiler;
|
||||
private $formatter;
|
||||
private $sourceId;
|
||||
|
||||
/**
|
||||
* Process the Container to replace aliases with service definitions.
|
||||
|
@ -36,113 +35,108 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
|
|||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
// Setup
|
||||
$this->compiler = $container->getCompiler();
|
||||
$this->formatter = $this->compiler->getLoggingFormatter();
|
||||
|
||||
foreach ($container->getAliases() as $id => $alias) {
|
||||
$aliasId = (string) $alias;
|
||||
|
||||
try {
|
||||
$definition = $container->getDefinition($aliasId);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with actual definition "%s".', $id, $alias), null, $e);
|
||||
// First collect all alias targets that need to be replaced
|
||||
$seenAliasTargets = array();
|
||||
$replacements = array();
|
||||
foreach ($container->getAliases() as $definitionId => $target) {
|
||||
$targetId = (string) $target;
|
||||
// Special case: leave this target alone
|
||||
if ('service_container' === $targetId) {
|
||||
continue;
|
||||
}
|
||||
// Check if target needs to be replaces
|
||||
if (isset($replacements[$targetId])) {
|
||||
$container->setAlias($definitionId, $replacements[$targetId]);
|
||||
}
|
||||
// No neeed to process the same target twice
|
||||
if (isset($seenAliasTargets[$targetId])) {
|
||||
continue;
|
||||
}
|
||||
// Process new target
|
||||
$seenAliasTargets[$targetId] = true;
|
||||
try {
|
||||
$definition = $container->getDefinition($targetId);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with actual definition "%s".', $definitionId, $targetId), null, $e);
|
||||
}
|
||||
|
||||
if ($definition->isPublic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove private definition and schedule for replacement
|
||||
$definition->setPublic(true);
|
||||
$container->setDefinition($id, $definition);
|
||||
$container->removeDefinition($aliasId);
|
||||
$container->setDefinition($definitionId, $definition);
|
||||
$container->removeDefinition($targetId);
|
||||
$replacements[$targetId] = $definitionId;
|
||||
}
|
||||
|
||||
$this->updateReferences($container, $aliasId, $id);
|
||||
|
||||
// we have to restart the process due to concurrent modification of
|
||||
// the container
|
||||
$this->process($container);
|
||||
|
||||
break;
|
||||
// Now replace target instances in all definitions
|
||||
foreach ($container->getDefinitions() as $definitionId => $definition) {
|
||||
$definition->setArguments($this->updateArgumentReferences($replacements, $definitionId, $definition->getArguments()));
|
||||
$definition->setMethodCalls($this->updateArgumentReferences($replacements, $definitionId, $definition->getMethodCalls()));
|
||||
$definition->setProperties($this->updateArgumentReferences($replacements, $definitionId, $definition->getProperties()));
|
||||
$definition->setFactoryService($this->updateFactoryReferenceId($replacements, $definition->getFactoryService(false)), false);
|
||||
$definition->setFactory($this->updateFactoryReference($replacements, $definition->getFactory()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates references to remove aliases.
|
||||
* Recursively updates references in an array.
|
||||
*
|
||||
* @param ContainerBuilder $container The container
|
||||
* @param string $currentId The alias identifier being replaced
|
||||
* @param string $newId The id of the service the alias points to
|
||||
*/
|
||||
private function updateReferences($container, $currentId, $newId)
|
||||
{
|
||||
foreach ($container->getAliases() as $id => $alias) {
|
||||
if ($currentId === (string) $alias) {
|
||||
$container->setAlias($id, $newId);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($container->getDefinitions() as $id => $definition) {
|
||||
$this->sourceId = $id;
|
||||
|
||||
$definition->setArguments(
|
||||
$this->updateArgumentReferences($definition->getArguments(), $currentId, $newId)
|
||||
);
|
||||
|
||||
$definition->setMethodCalls(
|
||||
$this->updateArgumentReferences($definition->getMethodCalls(), $currentId, $newId)
|
||||
);
|
||||
|
||||
$definition->setProperties(
|
||||
$this->updateArgumentReferences($definition->getProperties(), $currentId, $newId)
|
||||
);
|
||||
|
||||
$definition->setFactoryService($this->updateFactoryServiceReference($definition->getFactoryService(false), $currentId, $newId), false);
|
||||
$definition->setFactory($this->updateFactoryReference($definition->getFactory(), $currentId, $newId));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates argument references.
|
||||
*
|
||||
* @param array $arguments An array of Arguments
|
||||
* @param string $currentId The alias identifier
|
||||
* @param string $newId The identifier the alias points to
|
||||
* @param array $replacements Table of aliases to replace
|
||||
* @param string $definitionId Identifier of this definition
|
||||
* @param array $arguments Where to replace the aliases
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function updateArgumentReferences(array $arguments, $currentId, $newId)
|
||||
private function updateArgumentReferences(array $replacements, $definitionId, array $arguments)
|
||||
{
|
||||
foreach ($arguments as $k => $argument) {
|
||||
// Handle recursion step
|
||||
if (is_array($argument)) {
|
||||
$arguments[$k] = $this->updateArgumentReferences($argument, $currentId, $newId);
|
||||
} elseif ($argument instanceof Reference) {
|
||||
if ($currentId === (string) $argument) {
|
||||
$arguments[$k] = new Reference($newId, $argument->getInvalidBehavior());
|
||||
$this->compiler->addLogMessage($this->formatter->formatUpdateReference($this, $this->sourceId, $currentId, $newId));
|
||||
}
|
||||
$arguments[$k] = $this->updateArgumentReferences($replacements, $definitionId, $argument);
|
||||
continue;
|
||||
}
|
||||
// Skip arguments that don't need replacement
|
||||
if (!$argument instanceof Reference) {
|
||||
continue;
|
||||
}
|
||||
$referenceId = (string) $argument;
|
||||
if (!isset($replacements[$referenceId])) {
|
||||
continue;
|
||||
}
|
||||
// Perform the replacement
|
||||
$newId = $replacements[$referenceId];
|
||||
$arguments[$k] = new Reference($newId, $argument->getInvalidBehavior());
|
||||
$this->compiler->addLogMessage($this->formatter->formatUpdateReference($this, $definitionId, $referenceId, $newId));
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
private function updateFactoryServiceReference($factoryService, $currentId, $newId)
|
||||
/**
|
||||
* Returns the updated reference for the factory service.
|
||||
*
|
||||
* @param array $replacements Table of aliases to replace
|
||||
* @param string|null $referenceId Factory service reference identifier
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private function updateFactoryReferenceId(array $replacements, $referenceId)
|
||||
{
|
||||
if (null === $factoryService) {
|
||||
if (null === $referenceId) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $currentId === $factoryService ? $newId : $factoryService;
|
||||
return isset($replacements[$referenceId]) ? $replacements[$referenceId] : $referenceId;
|
||||
}
|
||||
|
||||
private function updateFactoryReference($factory, $currentId, $newId)
|
||||
private function updateFactoryReference(array $replacements, $factory)
|
||||
{
|
||||
if (null === $factory || !is_array($factory) || !$factory[0] instanceof Reference) {
|
||||
return $factory;
|
||||
}
|
||||
|
||||
if ($currentId === (string) $factory[0]) {
|
||||
$factory[0] = new Reference($newId, $factory[0]->getInvalidBehavior());
|
||||
if (is_array($factory) && $factory[0] instanceof Reference && isset($replacements[$referenceId = (string) $factory[0]])) {
|
||||
$factory[0] = new Reference($replacements[$referenceId], $factory[0]->getInvalidBehavior());
|
||||
}
|
||||
|
||||
return $factory;
|
||||
|
|
|
@ -136,6 +136,7 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
|
|||
$def->setFile($parentDef->getFile());
|
||||
$def->setPublic($parentDef->isPublic());
|
||||
$def->setLazy($parentDef->isLazy());
|
||||
$def->setAutowired($parentDef->isAutowired());
|
||||
|
||||
// overwrite with values specified in the decorator
|
||||
$changes = $definition->getChanges();
|
||||
|
@ -169,12 +170,15 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
|
|||
if (isset($changes['deprecated'])) {
|
||||
$def->setDeprecated($definition->isDeprecated(), $definition->getDeprecationMessage('%service_id%'));
|
||||
}
|
||||
if (isset($changes['autowire'])) {
|
||||
$def->setAutowired($definition->isAutowired());
|
||||
}
|
||||
if (isset($changes['decorated_service'])) {
|
||||
$decoratedService = $definition->getDecoratedService();
|
||||
if (null === $decoratedService) {
|
||||
$def->setDecoratedService($decoratedService);
|
||||
} else {
|
||||
$def->setDecoratedService($decoratedService[0], $decoratedService[1]);
|
||||
$def->setDecoratedService($decoratedService[0], $decoratedService[1], $decoratedService[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
namespace Symfony\Component\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
|
|
@ -45,7 +45,7 @@ class ServiceReferenceGraph
|
|||
*
|
||||
* @param string $id The id to retrieve
|
||||
*
|
||||
* @return ServiceReferenceGraphNode The node matching the supplied identifier
|
||||
* @return ServiceReferenceGraphNode
|
||||
*
|
||||
* @throws InvalidArgumentException if no node matches the supplied identifier
|
||||
*/
|
||||
|
@ -61,7 +61,7 @@ class ServiceReferenceGraph
|
|||
/**
|
||||
* Returns all nodes.
|
||||
*
|
||||
* @return ServiceReferenceGraphNode[] An array of all ServiceReferenceGraphNode objects
|
||||
* @return ServiceReferenceGraphNode[]
|
||||
*/
|
||||
public function getNodes()
|
||||
{
|
||||
|
|
|
@ -25,8 +25,6 @@ class ServiceReferenceGraphEdge
|
|||
private $value;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ServiceReferenceGraphNode $sourceNode
|
||||
* @param ServiceReferenceGraphNode $destNode
|
||||
* @param string $value
|
||||
|
@ -41,7 +39,7 @@ class ServiceReferenceGraphEdge
|
|||
/**
|
||||
* Returns the value of the edge.
|
||||
*
|
||||
* @return ServiceReferenceGraphNode
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
|
|
|
@ -29,8 +29,6 @@ class ServiceReferenceGraphNode
|
|||
private $value;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $id The node identifier
|
||||
* @param mixed $value The node value
|
||||
*/
|
||||
|
|
|
@ -78,8 +78,6 @@ class Container implements IntrospectableContainerInterface, ResettableContainer
|
|||
private $underscoreMap = array('_' => '', '.' => '_', '\\' => '_');
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ParameterBagInterface $parameterBag A ParameterBagInterface instance
|
||||
*/
|
||||
public function __construct(ParameterBagInterface $parameterBag = null)
|
||||
|
@ -297,10 +295,10 @@ class Container implements IntrospectableContainerInterface, ResettableContainer
|
|||
}
|
||||
|
||||
$alternatives = array();
|
||||
foreach ($this->services as $key => $associatedService) {
|
||||
$lev = levenshtein($id, $key);
|
||||
if ($lev <= strlen($id) / 3 || false !== strpos($key, $id)) {
|
||||
$alternatives[] = $key;
|
||||
foreach ($this->getServiceIds() as $knownId) {
|
||||
$lev = levenshtein($id, $knownId);
|
||||
if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) {
|
||||
$alternatives[] = $knownId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,6 +320,11 @@ class Container implements IntrospectableContainerInterface, ResettableContainer
|
|||
return;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
} catch (\Throwable $e) {
|
||||
unset($this->loading[$id]);
|
||||
unset($this->services[$id]);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,7 @@ abstract class ContainerAware implements ContainerAwareInterface
|
|||
protected $container;
|
||||
|
||||
/**
|
||||
* Sets the container.
|
||||
*
|
||||
* @param ContainerInterface|null $container A ContainerInterface instance or null
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
|
|
|
@ -201,7 +201,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
*
|
||||
* @param ResourceInterface $resource A resource instance
|
||||
*
|
||||
* @return ContainerBuilder The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function addResource(ResourceInterface $resource)
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
*
|
||||
* @param ResourceInterface[] $resources An array of resources
|
||||
*
|
||||
* @return ContainerBuilder The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setResources(array $resources)
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
*
|
||||
* @param object $object An object instance
|
||||
*
|
||||
* @return ContainerBuilder The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function addObjectResource($object)
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
*
|
||||
* @param \ReflectionClass $class
|
||||
*
|
||||
* @return ContainerBuilder The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function addClassResource(\ReflectionClass $class)
|
||||
{
|
||||
|
@ -276,7 +276,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
* @param string $extension The extension alias or namespace
|
||||
* @param array $values An array of values that customizes the extension
|
||||
*
|
||||
* @return ContainerBuilder The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @throws BadMethodCallException When this ContainerBuilder is frozen
|
||||
* @throws \LogicException if the container is frozen
|
||||
|
@ -300,7 +300,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
* @param CompilerPassInterface $pass A compiler pass
|
||||
* @param string $type The type of compiler pass
|
||||
*
|
||||
* @return ContainerBuilder The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
/**
|
||||
* Returns all Scope children.
|
||||
*
|
||||
* @return array An array of scope children.
|
||||
* @return array An array of scope children
|
||||
*
|
||||
* @deprecated since version 2.8, to be removed in 3.0.
|
||||
*/
|
||||
|
@ -381,21 +381,14 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
|
||||
{
|
||||
$id = strtolower($id);
|
||||
$set = isset($this->definitions[$id]);
|
||||
|
||||
if ($this->isFrozen()) {
|
||||
if ($this->isFrozen() && ($set || isset($this->obsoleteDefinitions[$id])) && !$this->{$set ? 'definitions' : 'obsoleteDefinitions'}[$id]->isSynthetic()) {
|
||||
// setting a synthetic service on a frozen container is alright
|
||||
if (
|
||||
(!isset($this->definitions[$id]) && !isset($this->obsoleteDefinitions[$id]))
|
||||
||
|
||||
(isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())
|
||||
||
|
||||
(isset($this->obsoleteDefinitions[$id]) && !$this->obsoleteDefinitions[$id]->isSynthetic())
|
||||
) {
|
||||
throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id));
|
||||
}
|
||||
throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id));
|
||||
}
|
||||
|
||||
if (isset($this->definitions[$id])) {
|
||||
if ($set) {
|
||||
$this->obsoleteDefinitions[$id] = $this->definitions[$id];
|
||||
}
|
||||
|
||||
|
@ -456,7 +449,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
}
|
||||
|
||||
if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) {
|
||||
return $this->get($this->aliasDefinitions[$id]);
|
||||
return $this->get((string) $this->aliasDefinitions[$id], $invalidBehavior);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -480,6 +473,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
return;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
} catch (\Throwable $e) {
|
||||
unset($this->loading[$id]);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
@ -506,7 +503,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
* parameter, the value will still be 'bar' as defined in the ContainerBuilder
|
||||
* constructor.
|
||||
*
|
||||
* @param ContainerBuilder $container The ContainerBuilder instance to merge.
|
||||
* @param ContainerBuilder $container The ContainerBuilder instance to merge
|
||||
*
|
||||
* @throws BadMethodCallException When this ContainerBuilder is frozen
|
||||
*/
|
||||
|
@ -862,6 +859,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
*/
|
||||
public function createService(Definition $definition, $id, $tryProxy = true)
|
||||
{
|
||||
if ($definition instanceof DefinitionDecorator) {
|
||||
throw new RuntimeException(sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id));
|
||||
}
|
||||
|
||||
if ($definition->isSynthetic()) {
|
||||
throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
|
||||
}
|
||||
|
@ -936,15 +937,15 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
$this->shareService($definition, $service, $id);
|
||||
}
|
||||
|
||||
foreach ($definition->getMethodCalls() as $call) {
|
||||
$this->callMethod($service, $call);
|
||||
}
|
||||
|
||||
$properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())));
|
||||
foreach ($properties as $name => $value) {
|
||||
$service->$name = $value;
|
||||
}
|
||||
|
||||
foreach ($definition->getMethodCalls() as $call) {
|
||||
$this->callMethod($service, $call);
|
||||
}
|
||||
|
||||
if ($callable = $definition->getConfigurator()) {
|
||||
if (is_array($callable)) {
|
||||
$callable[0] = $parameterBag->resolveValue($callable[0]);
|
||||
|
@ -1007,7 +1008,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
*
|
||||
* @param string $name The tag name
|
||||
*
|
||||
* @return array An array of tags with the tagged service as key, holding a list of attribute arrays.
|
||||
* @return array An array of tags with the tagged service as key, holding a list of attribute arrays
|
||||
*/
|
||||
public function findTaggedServiceIds($name)
|
||||
{
|
||||
|
@ -1063,7 +1064,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
/**
|
||||
* Returns the Service Conditionals.
|
||||
*
|
||||
* @param mixed $value An array of conditionals to return.
|
||||
* @param mixed $value An array of conditionals to return
|
||||
*
|
||||
* @return array An array of Service conditionals
|
||||
*/
|
||||
|
@ -1144,15 +1145,15 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
/**
|
||||
* Shares a given service in the container.
|
||||
*
|
||||
* @param Definition $definition
|
||||
* @param mixed $service
|
||||
* @param string $id
|
||||
* @param Definition $definition
|
||||
* @param mixed $service
|
||||
* @param string|null $id
|
||||
*
|
||||
* @throws InactiveScopeException
|
||||
*/
|
||||
private function shareService(Definition $definition, $service, $id)
|
||||
{
|
||||
if ($definition->isShared() && self::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
|
||||
if (null !== $id && $definition->isShared() && self::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) {
|
||||
if (self::SCOPE_CONTAINER !== $scope && !isset($this->scopedServices[$scope])) {
|
||||
throw new InactiveScopeException($id, $scope);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,6 @@ class Definition
|
|||
protected $arguments;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|null $class The service class
|
||||
* @param array $arguments An array of arguments to pass to the service constructor
|
||||
*/
|
||||
|
@ -63,7 +61,7 @@ class Definition
|
|||
*
|
||||
* @param string|array $factory A PHP function or an array containing a class/Reference and a method to call
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setFactory($factory)
|
||||
{
|
||||
|
@ -92,7 +90,7 @@ class Definition
|
|||
*
|
||||
* @param string $factoryClass The factory class name
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 2.6, to be removed in 3.0.
|
||||
*/
|
||||
|
@ -126,7 +124,7 @@ class Definition
|
|||
*
|
||||
* @param string $factoryMethod The factory method name
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 2.6, to be removed in 3.0.
|
||||
*/
|
||||
|
@ -146,7 +144,7 @@ class Definition
|
|||
* @param null|string $renamedId The new decorated service id
|
||||
* @param int $priority The priority of decoration
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException In case the decorated service id and the new decorated service id are equals.
|
||||
*/
|
||||
|
@ -196,7 +194,7 @@ class Definition
|
|||
*
|
||||
* @param string $factoryService The factory service id
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 2.6, to be removed in 3.0.
|
||||
*/
|
||||
|
@ -232,7 +230,7 @@ class Definition
|
|||
*
|
||||
* @param string $class The service class
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setClass($class)
|
||||
{
|
||||
|
@ -256,7 +254,7 @@ class Definition
|
|||
*
|
||||
* @param array $arguments An array of arguments
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setArguments(array $arguments)
|
||||
{
|
||||
|
@ -289,7 +287,7 @@ class Definition
|
|||
*
|
||||
* @param mixed $argument An argument
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function addArgument($argument)
|
||||
{
|
||||
|
@ -304,7 +302,7 @@ class Definition
|
|||
* @param int $index
|
||||
* @param mixed $argument
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @throws OutOfBoundsException When the replaced argument does not exist
|
||||
*/
|
||||
|
@ -352,7 +350,7 @@ class Definition
|
|||
*
|
||||
* @param array $calls An array of method calls
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethodCalls(array $calls = array())
|
||||
{
|
||||
|
@ -370,7 +368,7 @@ class Definition
|
|||
* @param string $method The method name to call
|
||||
* @param array $arguments An array of arguments to pass to the method call
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException on empty $method param
|
||||
*/
|
||||
|
@ -389,7 +387,7 @@ class Definition
|
|||
*
|
||||
* @param string $method The method name to remove
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function removeMethodCall($method)
|
||||
{
|
||||
|
@ -436,7 +434,7 @@ class Definition
|
|||
*
|
||||
* @param array $tags
|
||||
*
|
||||
* @return Definition the current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setTags(array $tags)
|
||||
{
|
||||
|
@ -473,7 +471,7 @@ class Definition
|
|||
* @param string $name The tag name
|
||||
* @param array $attributes An array of attributes
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function addTag($name, array $attributes = array())
|
||||
{
|
||||
|
@ -499,7 +497,7 @@ class Definition
|
|||
*
|
||||
* @param string $name The tag name
|
||||
*
|
||||
* @return Definition
|
||||
* @return $this
|
||||
*/
|
||||
public function clearTag($name)
|
||||
{
|
||||
|
@ -511,7 +509,7 @@ class Definition
|
|||
/**
|
||||
* Clears the tags for this definition.
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function clearTags()
|
||||
{
|
||||
|
@ -525,7 +523,7 @@ class Definition
|
|||
*
|
||||
* @param string $file A full pathname to include
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
|
@ -549,7 +547,7 @@ class Definition
|
|||
*
|
||||
* @param bool $shared Whether the service must be shared or not
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setShared($shared)
|
||||
{
|
||||
|
@ -573,7 +571,7 @@ class Definition
|
|||
*
|
||||
* @param string $scope Whether the service must be shared or not
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 2.8, to be removed in 3.0.
|
||||
*/
|
||||
|
@ -613,7 +611,7 @@ class Definition
|
|||
*
|
||||
* @param bool $boolean
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setPublic($boolean)
|
||||
{
|
||||
|
@ -637,7 +635,7 @@ class Definition
|
|||
*
|
||||
* @param bool $boolean
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 2.7, will be removed in 3.0.
|
||||
*/
|
||||
|
@ -673,7 +671,7 @@ class Definition
|
|||
*
|
||||
* @param bool $lazy
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setLazy($lazy)
|
||||
{
|
||||
|
@ -698,7 +696,7 @@ class Definition
|
|||
*
|
||||
* @param bool $boolean
|
||||
*
|
||||
* @return Definition the current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setSynthetic($boolean)
|
||||
{
|
||||
|
@ -724,7 +722,7 @@ class Definition
|
|||
*
|
||||
* @param bool $boolean
|
||||
*
|
||||
* @return Definition the current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setAbstract($boolean)
|
||||
{
|
||||
|
@ -751,7 +749,7 @@ class Definition
|
|||
* @param bool $status
|
||||
* @param string $template Template message to use if the definition is deprecated
|
||||
*
|
||||
* @return Definition the current instance
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException When the message template is invalid.
|
||||
*/
|
||||
|
@ -802,7 +800,7 @@ class Definition
|
|||
*
|
||||
* @param callable $callable A PHP callable
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setConfigurator($callable)
|
||||
{
|
||||
|
@ -826,7 +824,7 @@ class Definition
|
|||
*
|
||||
* @param string[] $types
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutowiringTypes(array $types)
|
||||
{
|
||||
|
@ -852,9 +850,9 @@ class Definition
|
|||
/**
|
||||
* Sets autowired.
|
||||
*
|
||||
* @param $autowired
|
||||
* @param bool $autowired
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutowired($autowired)
|
||||
{
|
||||
|
@ -878,7 +876,7 @@ class Definition
|
|||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function addAutowiringType($type)
|
||||
{
|
||||
|
@ -892,7 +890,7 @@ class Definition
|
|||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return Definition The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAutowiringType($type)
|
||||
{
|
||||
|
|
|
@ -25,9 +25,7 @@ class DefinitionDecorator extends Definition
|
|||
private $changes = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $parent The id of Definition instance to decorate.
|
||||
* @param string $parent The id of Definition instance to decorate
|
||||
*/
|
||||
public function __construct($parent)
|
||||
{
|
||||
|
@ -166,6 +164,16 @@ class DefinitionDecorator extends Definition
|
|||
return parent::setDeprecated($boolean, $template);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAutowired($autowired)
|
||||
{
|
||||
$this->changes['autowire'] = true;
|
||||
|
||||
return parent::setAutowired($autowired);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an argument to pass to the service constructor/factory method.
|
||||
*
|
||||
|
@ -204,7 +212,7 @@ class DefinitionDecorator extends Definition
|
|||
* @param int $index
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return DefinitionDecorator the current instance
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException when $index isn't an integer
|
||||
*/
|
||||
|
|
|
@ -23,8 +23,6 @@ abstract class Dumper implements DumperInterface
|
|||
protected $container;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ContainerBuilder $container The service container to dump
|
||||
*/
|
||||
public function __construct(ContainerBuilder $container)
|
||||
|
|
|
@ -130,7 +130,7 @@ class GraphvizDumper extends Dumper
|
|||
*
|
||||
* @return array An array of edges
|
||||
*/
|
||||
private function findEdges($id, $arguments, $required, $name)
|
||||
private function findEdges($id, array $arguments, $required, $name)
|
||||
{
|
||||
$edges = array();
|
||||
foreach ($arguments as $argument) {
|
||||
|
@ -246,7 +246,7 @@ class GraphvizDumper extends Dumper
|
|||
*
|
||||
* @return string A comma separated list of attributes
|
||||
*/
|
||||
private function addAttributes($attributes)
|
||||
private function addAttributes(array $attributes)
|
||||
{
|
||||
$code = array();
|
||||
foreach ($attributes as $k => $v) {
|
||||
|
@ -263,7 +263,7 @@ class GraphvizDumper extends Dumper
|
|||
*
|
||||
* @return string A space separated list of options
|
||||
*/
|
||||
private function addOptions($options)
|
||||
private function addOptions(array $options)
|
||||
{
|
||||
$code = array();
|
||||
foreach ($options as $k => $v) {
|
||||
|
|
|
@ -144,6 +144,7 @@ class PhpDumper extends Dumper
|
|||
if ($this->container->isFrozen()) {
|
||||
$code .= $this->addFrozenConstructor();
|
||||
$code .= $this->addFrozenCompile();
|
||||
$code .= $this->addIsFrozenMethod();
|
||||
} else {
|
||||
$code .= $this->addConstructor();
|
||||
}
|
||||
|
@ -334,8 +335,8 @@ class PhpDumper extends Dumper
|
|||
$code .= $this->addNewInstance($id, $sDefinition, '$'.$name, ' = ');
|
||||
|
||||
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
|
||||
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
|
||||
$code .= $this->addServiceProperties(null, $sDefinition, $name);
|
||||
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
|
||||
$code .= $this->addServiceConfigurator(null, $sDefinition, $name);
|
||||
}
|
||||
|
||||
|
@ -374,7 +375,7 @@ class PhpDumper extends Dumper
|
|||
* @throws InvalidArgumentException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private function addServiceInstance($id, $definition)
|
||||
private function addServiceInstance($id, Definition $definition)
|
||||
{
|
||||
$class = $definition->getClass();
|
||||
|
||||
|
@ -424,7 +425,7 @@ class PhpDumper extends Dumper
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isSimpleInstance($id, $definition)
|
||||
private function isSimpleInstance($id, Definition $definition)
|
||||
{
|
||||
foreach (array_merge(array($definition), $this->getInlinedDefinitions($definition)) as $sDefinition) {
|
||||
if ($definition !== $sDefinition && !$this->hasReference($id, $sDefinition->getMethodCalls())) {
|
||||
|
@ -448,7 +449,7 @@ class PhpDumper extends Dumper
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function addServiceMethodCalls($id, $definition, $variableName = 'instance')
|
||||
private function addServiceMethodCalls($id, Definition $definition, $variableName = 'instance')
|
||||
{
|
||||
$calls = '';
|
||||
foreach ($definition->getMethodCalls() as $call) {
|
||||
|
@ -463,7 +464,7 @@ class PhpDumper extends Dumper
|
|||
return $calls;
|
||||
}
|
||||
|
||||
private function addServiceProperties($id, $definition, $variableName = 'instance')
|
||||
private function addServiceProperties($id, Definition $definition, $variableName = 'instance')
|
||||
{
|
||||
$code = '';
|
||||
foreach ($definition->getProperties() as $name => $value) {
|
||||
|
@ -483,7 +484,7 @@ class PhpDumper extends Dumper
|
|||
*
|
||||
* @throws ServiceCircularReferenceException when the container contains a circular reference
|
||||
*/
|
||||
private function addServiceInlinedDefinitionsSetup($id, $definition)
|
||||
private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
|
||||
{
|
||||
$this->referenceVariables[$id] = new Variable('instance');
|
||||
|
||||
|
@ -506,8 +507,8 @@ class PhpDumper extends Dumper
|
|||
}
|
||||
|
||||
$name = (string) $this->definitionVariables->offsetGet($iDefinition);
|
||||
$code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
|
||||
$code .= $this->addServiceProperties(null, $iDefinition, $name);
|
||||
$code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
|
||||
$code .= $this->addServiceConfigurator(null, $iDefinition, $name);
|
||||
}
|
||||
|
||||
|
@ -527,7 +528,7 @@ class PhpDumper extends Dumper
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function addServiceConfigurator($id, $definition, $variableName = 'instance')
|
||||
private function addServiceConfigurator($id, Definition $definition, $variableName = 'instance')
|
||||
{
|
||||
if (!$callable = $definition->getConfigurator()) {
|
||||
return '';
|
||||
|
@ -559,7 +560,7 @@ class PhpDumper extends Dumper
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function addService($id, $definition)
|
||||
private function addService($id, Definition $definition)
|
||||
{
|
||||
$this->definitionVariables = new \SplObjectStorage();
|
||||
$this->referenceVariables = array();
|
||||
|
@ -570,22 +571,22 @@ class PhpDumper extends Dumper
|
|||
if ($definition->isSynthetic()) {
|
||||
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
|
||||
} elseif ($class = $definition->getClass()) {
|
||||
$return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : '\\'.ltrim($class, '\\'), ltrim($class, '\\'));
|
||||
$return[] = sprintf('@return %s A %s instance', 0 === strpos($class, '%') ? 'object' : '\\'.ltrim($class, '\\'), ltrim($class, '\\'));
|
||||
} elseif ($definition->getFactory()) {
|
||||
$factory = $definition->getFactory();
|
||||
if (is_string($factory)) {
|
||||
$return[] = sprintf('@return object An instance returned by %s().', $factory);
|
||||
$return[] = sprintf('@return object An instance returned by %s()', $factory);
|
||||
} elseif (is_array($factory) && (is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) {
|
||||
if (is_string($factory[0]) || $factory[0] instanceof Reference) {
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s().', (string) $factory[0], $factory[1]);
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s()', (string) $factory[0], $factory[1]);
|
||||
} elseif ($factory[0] instanceof Definition) {
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s().', $factory[0]->getClass(), $factory[1]);
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s()', $factory[0]->getClass(), $factory[1]);
|
||||
}
|
||||
}
|
||||
} elseif ($definition->getFactoryClass(false)) {
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(false), $definition->getFactoryMethod(false));
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s()', $definition->getFactoryClass(false), $definition->getFactoryMethod(false));
|
||||
} elseif ($definition->getFactoryService(false)) {
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryService(false), $definition->getFactoryMethod(false));
|
||||
$return[] = sprintf('@return object An instance returned by %s::%s()', $definition->getFactoryService(false), $definition->getFactoryMethod(false));
|
||||
}
|
||||
|
||||
$scope = $definition->getScope(false);
|
||||
|
@ -682,8 +683,8 @@ EOF;
|
|||
$this->addServiceInlinedDefinitions($id, $definition).
|
||||
$this->addServiceInstance($id, $definition).
|
||||
$this->addServiceInlinedDefinitionsSetup($id, $definition).
|
||||
$this->addServiceMethodCalls($id, $definition).
|
||||
$this->addServiceProperties($id, $definition).
|
||||
$this->addServiceMethodCalls($id, $definition).
|
||||
$this->addServiceConfigurator($id, $definition).
|
||||
$this->addServiceReturn($id, $definition)
|
||||
;
|
||||
|
@ -977,6 +978,26 @@ EOF;
|
|||
throw new LogicException('You cannot compile a dumped frozen container.');
|
||||
}
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the isFrozen method for a frozen container.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function addIsFrozenMethod()
|
||||
{
|
||||
return <<<EOF
|
||||
|
||||
/*{$this->docStar}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFrozen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1144,7 @@ EOF;
|
|||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function exportParameters($parameters, $path = '', $indent = 12)
|
||||
private function exportParameters(array $parameters, $path = '', $indent = 12)
|
||||
{
|
||||
$php = array();
|
||||
foreach ($parameters as $key => $value) {
|
||||
|
@ -1288,10 +1309,17 @@ EOF;
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($deep && !isset($visited[$argumentId])) {
|
||||
if ($deep && !isset($visited[$argumentId]) && 'service_container' !== $argumentId) {
|
||||
$visited[$argumentId] = true;
|
||||
|
||||
$service = $this->container->getDefinition($argumentId);
|
||||
|
||||
// if the proxy manager is enabled, disable searching for references in lazy services,
|
||||
// as these services will be instantiated lazily and don't have direct related references.
|
||||
if ($service->isLazy() && !$this->getProxyDumper() instanceof NullDumper) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$arguments = array_merge($service->getMethodCalls(), $service->getArguments(), $service->getProperties());
|
||||
|
||||
if ($this->hasReference($id, $arguments, $deep, $visited)) {
|
||||
|
|
|
@ -286,7 +286,7 @@ class XmlDumper extends Dumper
|
|||
* @param \DOMElement $parent
|
||||
* @param string $keyAttribute
|
||||
*/
|
||||
private function convertParameters($parameters, $type, \DOMElement $parent, $keyAttribute = 'key')
|
||||
private function convertParameters(array $parameters, $type, \DOMElement $parent, $keyAttribute = 'key')
|
||||
{
|
||||
$withKeys = array_keys($parameters) !== range(0, count($parameters) - 1);
|
||||
foreach ($parameters as $key => $value) {
|
||||
|
@ -335,7 +335,7 @@ class XmlDumper extends Dumper
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
private function escape($arguments)
|
||||
private function escape(array $arguments)
|
||||
{
|
||||
$args = array();
|
||||
foreach ($arguments as $k => $v) {
|
||||
|
|
|
@ -188,7 +188,7 @@ class YamlDumper extends Dumper
|
|||
return sprintf(" %s: '@%s'\n", $alias, $id);
|
||||
}
|
||||
|
||||
return sprintf(" %s:\n alias: %s\n public: false", $alias, $id);
|
||||
return sprintf(" %s:\n alias: %s\n public: false\n", $alias, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -327,7 +327,7 @@ class YamlDumper extends Dumper
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
private function prepareParameters($parameters, $escape = true)
|
||||
private function prepareParameters(array $parameters, $escape = true)
|
||||
{
|
||||
$filtered = array();
|
||||
foreach ($parameters as $key => $value) {
|
||||
|
@ -350,7 +350,7 @@ class YamlDumper extends Dumper
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
private function escape($arguments)
|
||||
private function escape(array $arguments)
|
||||
{
|
||||
$args = array();
|
||||
foreach ($arguments as $k => $v) {
|
||||
|
|
|
@ -24,8 +24,6 @@ class ParameterNotFoundException extends InvalidArgumentException
|
|||
private $alternatives;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $key The requested parameter key
|
||||
* @param string $sourceId The service id that references the non-existent parameter
|
||||
* @param string $sourceKey The parameter key that references the non-existent parameter
|
||||
|
|
|
@ -27,9 +27,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||
abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface
|
||||
{
|
||||
/**
|
||||
* Returns the base path for the XSD files.
|
||||
*
|
||||
* @return string The XSD base path
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getXsdValidationBasePath()
|
||||
{
|
||||
|
@ -37,9 +35,7 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the namespace to be used for this extension (XML namespace).
|
||||
*
|
||||
* @return string The XML namespace
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
|
|
2
vendor/symfony/dependency-injection/LICENSE
vendored
2
vendor/symfony/dependency-injection/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2016 Fabien Potencier
|
||||
Copyright (c) 2004-2017 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -26,8 +26,6 @@ class ClosureLoader extends Loader
|
|||
private $container;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
*/
|
||||
public function __construct(ContainerBuilder $container)
|
||||
|
|
|
@ -25,8 +25,6 @@ abstract class FileLoader extends BaseFileLoader
|
|||
protected $container;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
* @param FileLocatorInterface $locator A FileLocator instance
|
||||
*/
|
||||
|
|
|
@ -187,7 +187,7 @@ class XmlFileLoader extends FileLoader
|
|||
}
|
||||
|
||||
if ($deprecated = $this->getChildren($service, 'deprecated')) {
|
||||
$definition->setDeprecated(true, $deprecated[0]->nodeValue);
|
||||
$definition->setDeprecated(true, $deprecated[0]->nodeValue ?: null);
|
||||
}
|
||||
|
||||
$definition->setArguments($this->getArgumentsAsPhp($service, 'argument'));
|
||||
|
@ -315,6 +315,10 @@ class XmlFileLoader extends FileLoader
|
|||
if ($services = $this->getChildren($node, 'service')) {
|
||||
$definitions[$id] = array($services[0], $file, false);
|
||||
$services[0]->setAttribute('id', $id);
|
||||
|
||||
// anonymous services are always private
|
||||
// we could not use the constant false here, because of XML parsing
|
||||
$services[0]->setAttribute('public', 'false');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,11 +329,7 @@ class XmlFileLoader extends FileLoader
|
|||
// give it a unique name
|
||||
$id = sprintf('%s_%d', hash('sha256', $file), ++$count);
|
||||
$node->setAttribute('id', $id);
|
||||
|
||||
if ($services = $this->getChildren($node, 'service')) {
|
||||
$definitions[$id] = array($node, $file, true);
|
||||
$services[0]->setAttribute('id', $id);
|
||||
}
|
||||
$definitions[$id] = array($node, $file, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,10 +338,6 @@ class XmlFileLoader extends FileLoader
|
|||
foreach ($definitions as $id => $def) {
|
||||
list($domElement, $file, $wild) = $def;
|
||||
|
||||
// anonymous services are always private
|
||||
// we could not use the constant false here, because of XML parsing
|
||||
$domElement->setAttribute('public', 'false');
|
||||
|
||||
if (null !== $definition = $this->parseDefinition($domElement, $file)) {
|
||||
$this->container->setDefinition($id, $definition);
|
||||
}
|
||||
|
@ -373,21 +369,22 @@ class XmlFileLoader extends FileLoader
|
|||
$arg->setAttribute('key', $arg->getAttribute('name'));
|
||||
}
|
||||
|
||||
if (!$arg->hasAttribute('key')) {
|
||||
$key = !$arguments ? 0 : max(array_keys($arguments)) + 1;
|
||||
} else {
|
||||
$key = $arg->getAttribute('key');
|
||||
}
|
||||
|
||||
// parameter keys are case insensitive
|
||||
if ('parameter' == $name && $lowercase) {
|
||||
$key = strtolower($key);
|
||||
}
|
||||
|
||||
// this is used by DefinitionDecorator to overwrite a specific
|
||||
// argument of the parent definition
|
||||
if ($arg->hasAttribute('index')) {
|
||||
$key = 'index_'.$arg->getAttribute('index');
|
||||
} elseif (!$arg->hasAttribute('key')) {
|
||||
// Append an empty argument, then fetch its key to overwrite it later
|
||||
$arguments[] = null;
|
||||
$keys = array_keys($arguments);
|
||||
$key = array_pop($keys);
|
||||
} else {
|
||||
$key = $arg->getAttribute('key');
|
||||
|
||||
// parameter keys are case insensitive
|
||||
if ('parameter' == $name && $lowercase) {
|
||||
$key = strtolower($key);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($arg->getAttribute('type')) {
|
||||
|
@ -418,7 +415,7 @@ class XmlFileLoader extends FileLoader
|
|||
$arguments[$key] = $arg->nodeValue;
|
||||
break;
|
||||
case 'constant':
|
||||
$arguments[$key] = constant($arg->nodeValue);
|
||||
$arguments[$key] = constant(trim($arg->nodeValue));
|
||||
break;
|
||||
default:
|
||||
$arguments[$key] = XmlUtils::phpize($arg->nodeValue);
|
||||
|
@ -511,7 +508,9 @@ $imports
|
|||
EOF
|
||||
;
|
||||
|
||||
$disableEntities = libxml_disable_entity_loader(false);
|
||||
$valid = @$dom->schemaValidateSource($source);
|
||||
libxml_disable_entity_loader($disableEntities);
|
||||
|
||||
foreach ($tmpfiles as $tmpfile) {
|
||||
@unlink($tmpfile);
|
||||
|
@ -589,7 +588,7 @@ EOF
|
|||
*
|
||||
* @return array A PHP array
|
||||
*/
|
||||
public static function convertDomElementToArray(\DomElement $element)
|
||||
public static function convertDomElementToArray(\DOMElement $element)
|
||||
{
|
||||
return XmlUtils::convertDomElementToArray($element);
|
||||
}
|
||||
|
|
|
@ -420,9 +420,9 @@ class YamlFileLoader extends FileLoader
|
|||
{
|
||||
if (is_array($value)) {
|
||||
$value = array_map(array($this, 'resolveServices'), $value);
|
||||
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
|
||||
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
|
||||
return new Expression(substr($value, 2));
|
||||
} elseif (is_string($value) && 0 === strpos($value, '@')) {
|
||||
} elseif (is_string($value) && 0 === strpos($value, '@')) {
|
||||
if (0 === strpos($value, '@@')) {
|
||||
$value = substr($value, 1);
|
||||
$invalidBehavior = null;
|
||||
|
|
|
@ -24,14 +24,28 @@
|
|||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="imports" type="imports" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="parameters" type="parameters" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="services" type="services" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:group ref="foreign" />
|
||||
<xsd:sequence minOccurs="0">
|
||||
<xsd:element name="imports" type="imports" />
|
||||
<xsd:group ref="foreign" />
|
||||
</xsd:sequence>
|
||||
<xsd:sequence minOccurs="0">
|
||||
<xsd:element name="parameters" type="parameters" />
|
||||
<xsd:group ref="foreign" />
|
||||
</xsd:sequence>
|
||||
<xsd:sequence minOccurs="0">
|
||||
<xsd:element name="services" type="services" />
|
||||
<xsd:group ref="foreign" />
|
||||
</xsd:sequence>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:group name="foreign">
|
||||
<xsd:sequence>
|
||||
<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xsd:sequence>
|
||||
</xsd:group>
|
||||
|
||||
<xsd:complexType name="services">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
|
@ -139,7 +153,7 @@
|
|||
<xsd:attribute name="id" type="xsd:string" />
|
||||
<xsd:attribute name="key" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="on-invalid" type="xsd:string" />
|
||||
<xsd:attribute name="on-invalid" type="invalid_sequence" />
|
||||
<xsd:attribute name="strict" type="boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
|
@ -152,7 +166,7 @@
|
|||
<xsd:attribute name="id" type="xsd:string" />
|
||||
<xsd:attribute name="key" type="xsd:string" />
|
||||
<xsd:attribute name="index" type="xsd:integer" />
|
||||
<xsd:attribute name="on-invalid" type="xsd:string" />
|
||||
<xsd:attribute name="on-invalid" type="invalid_sequence" />
|
||||
<xsd:attribute name="strict" type="boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ class Parameter
|
|||
private $id;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $id The parameter key
|
||||
*/
|
||||
public function __construct($id)
|
||||
|
@ -31,8 +29,6 @@ class Parameter
|
|||
}
|
||||
|
||||
/**
|
||||
* __toString.
|
||||
*
|
||||
* @return string The parameter key
|
||||
*/
|
||||
public function __toString()
|
||||
|
|
|
@ -21,8 +21,6 @@ use Symfony\Component\DependencyInjection\Exception\LogicException;
|
|||
class FrozenParameterBag extends ParameterBag
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* For performance reasons, the constructor assumes that
|
||||
* all keys are already lowercased.
|
||||
*
|
||||
|
|
|
@ -26,8 +26,6 @@ class ParameterBag implements ParameterBagInterface
|
|||
protected $resolved = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $parameters An array of parameters
|
||||
*/
|
||||
public function __construct(array $parameters = array())
|
||||
|
@ -56,9 +54,7 @@ class ParameterBag implements ParameterBagInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the service container parameters.
|
||||
*
|
||||
* @return array An array of parameters
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
|
@ -66,13 +62,7 @@ class ParameterBag implements ParameterBagInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a service container parameter.
|
||||
*
|
||||
* @param string $name The parameter name
|
||||
*
|
||||
* @return mixed The parameter value
|
||||
*
|
||||
* @throws ParameterNotFoundException if the parameter is not defined
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
|
@ -109,11 +99,7 @@ class ParameterBag implements ParameterBagInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if a parameter name is defined.
|
||||
*
|
||||
* @param string $name The parameter name
|
||||
*
|
||||
* @return bool true if the parameter name is defined, false otherwise
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($name)
|
||||
{
|
||||
|
@ -131,7 +117,7 @@ class ParameterBag implements ParameterBagInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Replaces parameter placeholders (%name%) by their values for all parameters.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve()
|
||||
{
|
||||
|
@ -266,6 +252,9 @@ class ParameterBag implements ParameterBagInterface
|
|||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function unescapeValue($value)
|
||||
{
|
||||
if (is_string($value)) {
|
||||
|
|
|
@ -23,8 +23,6 @@ class Reference
|
|||
private $strict;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Note: The $strict parameter is deprecated since version 2.8 and will be removed in 3.0.
|
||||
*
|
||||
* @param string $id The service identifier
|
||||
|
@ -41,8 +39,6 @@ class Reference
|
|||
}
|
||||
|
||||
/**
|
||||
* __toString.
|
||||
*
|
||||
* @return string The service identifier
|
||||
*/
|
||||
public function __toString()
|
||||
|
|
|
@ -29,8 +29,6 @@ class Variable
|
|||
private $name;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/yaml": "~2.1|~3.0.0",
|
||||
"symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7",
|
||||
"symfony/config": "~2.2|~3.0.0",
|
||||
"symfony/expression-language": "~2.6|~3.0.0"
|
||||
},
|
||||
|
@ -29,6 +29,7 @@
|
|||
"suggest": {
|
||||
"symfony/yaml": "",
|
||||
"symfony/config": "",
|
||||
"symfony/expression-language": "For using expressions in service container configuration",
|
||||
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them"
|
||||
},
|
||||
"autoload": {
|
||||
|
|
Reference in a new issue