Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
56
vendor/symfony/dependency-injection/Loader/DirectoryLoader.php
vendored
Normal file
56
vendor/symfony/dependency-injection/Loader/DirectoryLoader.php
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?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\DependencyInjection\Loader;
|
||||
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
|
||||
/**
|
||||
* DirectoryLoader is a recursive loader to go through directories.
|
||||
*
|
||||
* @author Sebastien Lavoie <seb@wemakecustom.com>
|
||||
*/
|
||||
class DirectoryLoader extends FileLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
{
|
||||
$file = rtrim($file, '/');
|
||||
$path = $this->locator->locate($file);
|
||||
$this->container->addResource(new DirectoryResource($path));
|
||||
|
||||
foreach (scandir($path) as $dir) {
|
||||
if ('.' !== $dir[0]) {
|
||||
if (is_dir($path.'/'.$dir)) {
|
||||
$dir .= '/'; // append / to allow recursion
|
||||
}
|
||||
|
||||
$this->setCurrentDir($path);
|
||||
|
||||
$this->import($dir, null, false, $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
if ('directory' === $type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return null === $type && is_string($resource) && '/' === substr($resource, -1);
|
||||
}
|
||||
}
|
|
@ -93,8 +93,9 @@ class XmlFileLoader extends FileLoader
|
|||
return;
|
||||
}
|
||||
|
||||
$defaultDirectory = dirname($file);
|
||||
foreach ($imports as $import) {
|
||||
$this->setCurrentDir(dirname($file));
|
||||
$this->setCurrentDir($defaultDirectory);
|
||||
$this->import($import->getAttribute('resource'), null, (bool) XmlUtils::phpize($import->getAttribute('ignore-errors')), $file);
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +148,7 @@ class XmlFileLoader extends FileLoader
|
|||
$definition = new Definition();
|
||||
}
|
||||
|
||||
foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'lazy', 'abstract') as $key) {
|
||||
foreach (array('class', 'shared', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'lazy', 'abstract') as $key) {
|
||||
if ($value = $service->getAttribute($key)) {
|
||||
if (in_array($key, array('factory-class', 'factory-method', 'factory-service'))) {
|
||||
@trigger_error(sprintf('The "%s" attribute of service "%s" in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use the "factory" element instead.', $key, (string) $service->getAttribute('id'), $file), E_USER_DEPRECATED);
|
||||
|
@ -157,6 +158,20 @@ class XmlFileLoader extends FileLoader
|
|||
}
|
||||
}
|
||||
|
||||
if ($value = $service->getAttribute('autowire')) {
|
||||
$definition->setAutowired(XmlUtils::phpize($value));
|
||||
}
|
||||
|
||||
if ($value = $service->getAttribute('scope')) {
|
||||
$triggerDeprecation = 'request' !== (string) $service->getAttribute('id');
|
||||
|
||||
if ($triggerDeprecation) {
|
||||
@trigger_error(sprintf('The "scope" attribute of service "%s" in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', (string) $service->getAttribute('id'), $file), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$definition->setScope(XmlUtils::phpize($value), false);
|
||||
}
|
||||
|
||||
if ($value = $service->getAttribute('synchronized')) {
|
||||
$triggerDeprecation = 'request' !== (string) $service->getAttribute('id');
|
||||
|
||||
|
@ -171,6 +186,10 @@ class XmlFileLoader extends FileLoader
|
|||
$definition->setFile($files[0]->nodeValue);
|
||||
}
|
||||
|
||||
if ($deprecated = $this->getChildren($service, 'deprecated')) {
|
||||
$definition->setDeprecated(true, $deprecated[0]->nodeValue);
|
||||
}
|
||||
|
||||
$definition->setArguments($this->getArgumentsAsPhp($service, 'argument'));
|
||||
$definition->setProperties($this->getArgumentsAsPhp($service, 'property'));
|
||||
|
||||
|
@ -230,12 +249,21 @@ class XmlFileLoader extends FileLoader
|
|||
$parameters[$name] = XmlUtils::phpize($node->nodeValue);
|
||||
}
|
||||
|
||||
if ('' === $tag->getAttribute('name')) {
|
||||
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', (string) $service->getAttribute('id'), $file));
|
||||
}
|
||||
|
||||
$definition->addTag($tag->getAttribute('name'), $parameters);
|
||||
}
|
||||
|
||||
foreach ($this->getChildren($service, 'autowiring-type') as $type) {
|
||||
$definition->addAutowiringType($type->textContent);
|
||||
}
|
||||
|
||||
if ($value = $service->getAttribute('decorates')) {
|
||||
$renameId = $service->hasAttribute('decoration-inner-name') ? $service->getAttribute('decoration-inner-name') : null;
|
||||
$definition->setDecoratedService($value, $renameId);
|
||||
$priority = $service->hasAttribute('decoration-priority') ? $service->getAttribute('decoration-priority') : 0;
|
||||
$definition->setDecoratedService($value, $renameId, $priority);
|
||||
}
|
||||
|
||||
return $definition;
|
||||
|
|
|
@ -95,12 +95,13 @@ class YamlFileLoader extends FileLoader
|
|||
throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in %s. Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
$defaultDirectory = dirname($file);
|
||||
foreach ($content['imports'] as $import) {
|
||||
if (!is_array($import)) {
|
||||
throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
$this->setCurrentDir(dirname($file));
|
||||
$this->setCurrentDir($defaultDirectory);
|
||||
$this->import($import['resource'], null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file);
|
||||
}
|
||||
}
|
||||
|
@ -164,8 +165,15 @@ class YamlFileLoader extends FileLoader
|
|||
$definition->setClass($service['class']);
|
||||
}
|
||||
|
||||
if (isset($service['shared'])) {
|
||||
$definition->setShared($service['shared']);
|
||||
}
|
||||
|
||||
if (isset($service['scope'])) {
|
||||
$definition->setScope($service['scope']);
|
||||
if ('request' !== $id) {
|
||||
@trigger_error(sprintf('The "scope" key of service "%s" in file "%s" is deprecated since version 2.8 and will be removed in 3.0.', $id, $file), E_USER_DEPRECATED);
|
||||
}
|
||||
$definition->setScope($service['scope'], false);
|
||||
}
|
||||
|
||||
if (isset($service['synthetic'])) {
|
||||
|
@ -189,6 +197,10 @@ class YamlFileLoader extends FileLoader
|
|||
$definition->setAbstract($service['abstract']);
|
||||
}
|
||||
|
||||
if (array_key_exists('deprecated', $service)) {
|
||||
$definition->setDeprecated(true, $service['deprecated']);
|
||||
}
|
||||
|
||||
if (isset($service['factory'])) {
|
||||
if (is_string($service['factory'])) {
|
||||
if (strpos($service['factory'], ':') !== false && strpos($service['factory'], '::') === false) {
|
||||
|
@ -269,6 +281,10 @@ class YamlFileLoader extends FileLoader
|
|||
throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
|
||||
}
|
||||
|
||||
if (!is_string($tag['name']) || '' === $tag['name']) {
|
||||
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', $id, $file));
|
||||
}
|
||||
|
||||
$name = $tag['name'];
|
||||
unset($tag['name']);
|
||||
|
||||
|
@ -283,8 +299,35 @@ class YamlFileLoader extends FileLoader
|
|||
}
|
||||
|
||||
if (isset($service['decorates'])) {
|
||||
if ('' !== $service['decorates'] && '@' === $service['decorates'][0]) {
|
||||
throw new InvalidArgumentException(sprintf('The value of the "decorates" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $id, $service['decorates'], substr($service['decorates'], 1)));
|
||||
}
|
||||
|
||||
$renameId = isset($service['decoration_inner_name']) ? $service['decoration_inner_name'] : null;
|
||||
$definition->setDecoratedService($service['decorates'], $renameId);
|
||||
$priority = isset($service['decoration_priority']) ? $service['decoration_priority'] : 0;
|
||||
$definition->setDecoratedService($service['decorates'], $renameId, $priority);
|
||||
}
|
||||
|
||||
if (isset($service['autowire'])) {
|
||||
$definition->setAutowired($service['autowire']);
|
||||
}
|
||||
|
||||
if (isset($service['autowiring_types'])) {
|
||||
if (is_string($service['autowiring_types'])) {
|
||||
$definition->addAutowiringType($service['autowiring_types']);
|
||||
} else {
|
||||
if (!is_array($service['autowiring_types'])) {
|
||||
throw new InvalidArgumentException(sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
foreach ($service['autowiring_types'] as $autowiringType) {
|
||||
if (!is_string($autowiringType)) {
|
||||
throw new InvalidArgumentException(sprintf('A "autowiring_types" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file));
|
||||
}
|
||||
|
||||
$definition->addAutowiringType($autowiringType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->container->setDefinition($id, $definition);
|
||||
|
|
|
@ -81,12 +81,15 @@
|
|||
<xsd:element name="argument" type="argument" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="configurator" type="callable" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="factory" type="callable" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="deprecated" type="xsd:string" minOccurs="0" maxOccurs="1" />
|
||||
<xsd:element name="call" type="call" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="tag" type="tag" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded" />
|
||||
<xsd:element name="autowiring-type" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="id" type="xsd:string" />
|
||||
<xsd:attribute name="class" type="xsd:string" />
|
||||
<xsd:attribute name="shared" type="boolean" />
|
||||
<xsd:attribute name="scope" type="xsd:string" />
|
||||
<xsd:attribute name="public" type="boolean" />
|
||||
<xsd:attribute name="synthetic" type="boolean" />
|
||||
|
@ -100,10 +103,12 @@
|
|||
<xsd:attribute name="parent" type="xsd:string" />
|
||||
<xsd:attribute name="decorates" type="xsd:string" />
|
||||
<xsd:attribute name="decoration-inner-name" type="xsd:string" />
|
||||
<xsd:attribute name="decoration-priority" type="xsd:integer" />
|
||||
<xsd:attribute name="autowire" type="boolean" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="tag">
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:anyAttribute namespace="##any" processContents="lax" />
|
||||
</xsd:complexType>
|
||||
|
||||
|
|
Reference in a new issue