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
|
@ -1,14 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Component\DependencyInjection\Container.
|
||||
*/
|
||||
|
||||
namespace Drupal\Component\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ScopeInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
@ -54,7 +50,7 @@ use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceExce
|
|||
*
|
||||
* @ingroup container
|
||||
*/
|
||||
class Container implements IntrospectableContainerInterface {
|
||||
class Container implements IntrospectableContainerInterface, ResettableContainerInterface {
|
||||
|
||||
/**
|
||||
* The parameters of the container.
|
||||
|
@ -182,11 +178,7 @@ class Container implements IntrospectableContainerInterface {
|
|||
}
|
||||
catch (\Exception $e) {
|
||||
unset($this->loading[$id]);
|
||||
|
||||
// Remove a potentially shared service that was constructed incompletely.
|
||||
if (array_key_exists($id, $this->services)) {
|
||||
unset($this->services[$id]);
|
||||
}
|
||||
unset($this->services[$id]);
|
||||
|
||||
if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalid_behavior) {
|
||||
return;
|
||||
|
@ -200,6 +192,17 @@ class Container implements IntrospectableContainerInterface {
|
|||
return $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reset() {
|
||||
if (!empty($this->scopedServices)) {
|
||||
throw new LogicException('Resetting the container is not allowed when a scope is active.');
|
||||
}
|
||||
|
||||
$this->services = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a service from a service definition.
|
||||
*
|
||||
|
@ -359,6 +362,10 @@ class Container implements IntrospectableContainerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) {
|
||||
if (!in_array($scope, array('container', 'request')) || ('request' === $scope && 'request' !== $id)) {
|
||||
@trigger_error('The concept of container scopes is deprecated since version 2.8 and will be removed in 3.0. Omit the third parameter.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->services[$id] = $service;
|
||||
}
|
||||
|
||||
|
@ -585,6 +592,10 @@ class Container implements IntrospectableContainerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function enterScope($name) {
|
||||
if ('request' !== $name) {
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf("'%s' is not supported by Drupal 8.", __FUNCTION__));
|
||||
}
|
||||
|
||||
|
@ -592,6 +603,10 @@ class Container implements IntrospectableContainerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function leaveScope($name) {
|
||||
if ('request' !== $name) {
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf("'%s' is not supported by Drupal 8.", __FUNCTION__));
|
||||
}
|
||||
|
||||
|
@ -599,6 +614,11 @@ class Container implements IntrospectableContainerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function addScope(ScopeInterface $scope) {
|
||||
|
||||
$name = $scope->getName();
|
||||
if ('request' !== $name) {
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
throw new \BadMethodCallException(sprintf("'%s' is not supported by Drupal 8.", __FUNCTION__));
|
||||
}
|
||||
|
||||
|
@ -606,6 +626,10 @@ class Container implements IntrospectableContainerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasScope($name) {
|
||||
if ('request' !== $name) {
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf("'%s' is not supported by Drupal 8.", __FUNCTION__));
|
||||
}
|
||||
|
||||
|
@ -613,6 +637,8 @@ class Container implements IntrospectableContainerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function isScopeActive($name) {
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
throw new \BadMethodCallException(sprintf("'%s' is not supported by Drupal 8.", __FUNCTION__));
|
||||
}
|
||||
|
||||
|
@ -626,4 +652,11 @@ class Container implements IntrospectableContainerInterface {
|
|||
return array_keys($this->serviceDefinitions + $this->services);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that cloning doesn't work.
|
||||
*/
|
||||
private function __clone()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue