Commit 494271d0 authored by catch's avatar catch

Issue #2712647 by slasher13, klausi, catch, jibran, Manuel Garcia, alexpott,...

Issue #2712647 by slasher13, klausi, catch, jibran, Manuel Garcia, alexpott, mpdonadio, naveenvalecha, neclimdul, timmillwood, webflo, dawehner, Wim Leers, pounard: Update Symfony components to ~3.2
parent 4d80891f
This diff is collapsed.
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
"license": "GPL-2.0+", "license": "GPL-2.0+",
"require": { "require": {
"php": ">=5.5.9", "php": ">=5.5.9",
"symfony/class-loader": "~2.8", "symfony/class-loader": "3.2.6",
"symfony/console": "~2.8", "symfony/console": "3.2.6",
"symfony/dependency-injection": "~2.8", "symfony/dependency-injection": "3.2.6",
"symfony/event-dispatcher": "~2.8", "symfony/event-dispatcher": "3.2.6",
"symfony/http-foundation": "~2.8", "symfony/http-foundation": "3.2.6",
"symfony/http-kernel": "~2.8", "symfony/http-kernel": "3.2.6",
"symfony/routing": "~2.8", "symfony/routing": "3.2.6",
"symfony/serializer": "~2.8", "symfony/serializer": "3.2.6",
"symfony/translation": "~2.8", "symfony/translation": "3.2.6",
"symfony/validator": "~2.8", "symfony/validator": "3.2.6",
"symfony/process": "~2.8", "symfony/process": "3.2.6",
"symfony/polyfill-iconv": "~1.0", "symfony/polyfill-iconv": "~1.0",
"symfony/yaml": "~2.8", "symfony/yaml": "3.2.6",
"twig/twig": "^1.23.1", "twig/twig": "^1.23.1",
"doctrine/common": "^2.5", "doctrine/common": "^2.5",
"doctrine/annotations": "1.2.*", "doctrine/annotations": "1.2.*",
...@@ -45,8 +45,7 @@ ...@@ -45,8 +45,7 @@
"jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
"mikey179/vfsStream": "~1.2", "mikey179/vfsStream": "~1.2",
"phpunit/phpunit": ">=4.8.35 <5", "phpunit/phpunit": ">=4.8.35 <5",
"symfony/browser-kit": ">=2.8.13 <3.0", "symfony/css-selector": "3.2.6"
"symfony/css-selector": "~2.8"
}, },
"replace": { "replace": {
"drupal/action": "self.version", "drupal/action": "self.version",
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
namespace Drupal\Component\DependencyInjection; namespace Drupal\Component\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\IntrospectableContainerInterface;
use Symfony\Component\DependencyInjection\ResettableContainerInterface; use Symfony\Component\DependencyInjection\ResettableContainerInterface;
use Symfony\Component\DependencyInjection\ScopeInterface;
use Symfony\Component\DependencyInjection\Exception\LogicException; use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\RuntimeException;
...@@ -43,14 +41,10 @@ ...@@ -43,14 +41,10 @@
* getAServiceWithAnIdByCamelCase(). * getAServiceWithAnIdByCamelCase().
* - The function getServiceIds() was added as it has a use-case in core and * - The function getServiceIds() was added as it has a use-case in core and
* contrib. * contrib.
* - Scopes are explicitly not allowed, because Symfony 2.8 has deprecated
* them and they will be removed in Symfony 3.0.
* - Synchronized services are explicitly not supported, because Symfony 2.8 has
* deprecated them and they will be removed in Symfony 3.0.
* *
* @ingroup container * @ingroup container
*/ */
class Container implements IntrospectableContainerInterface, ResettableContainerInterface { class Container implements ContainerInterface, ResettableContainerInterface {
/** /**
* The parameters of the container. * The parameters of the container.
...@@ -311,12 +305,8 @@ protected function createService(array $definition, $id) { ...@@ -311,12 +305,8 @@ protected function createService(array $definition, $id) {
} }
} }
// Share the service if it is public. if (!isset($definition['shared']) || $definition['shared'] !== FALSE) {
if (!isset($definition['public']) || $definition['public'] !== FALSE) { $this->services[$id] = $service;
// Forward compatibility fix for Symfony 2.8 update.
if (!isset($definition['shared']) || $definition['shared'] !== FALSE) {
$this->services[$id] = $service;
}
} }
if (isset($definition['calls'])) { if (isset($definition['calls'])) {
...@@ -361,11 +351,7 @@ protected function createService(array $definition, $id) { ...@@ -361,11 +351,7 @@ protected function createService(array $definition, $id) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) { public function set($id, $service) {
if (!in_array($scope, ['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; $this->services[$id] = $service;
} }
...@@ -587,61 +573,6 @@ protected function getParameterAlternatives($name) { ...@@ -587,61 +573,6 @@ protected function getParameterAlternatives($name) {
return $this->getAlternatives($name, array_keys($this->parameters)); return $this->getAlternatives($name, array_keys($this->parameters));
} }
/**
* {@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__));
}
/**
* {@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__));
}
/**
* {@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__));
}
/**
* {@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__));
}
/**
* {@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__));
}
/** /**
* Gets all defined service IDs. * Gets all defined service IDs.
* *
......
...@@ -237,18 +237,6 @@ protected function getServiceDefinition(Definition $definition) { ...@@ -237,18 +237,6 @@ protected function getServiceDefinition(Definition $definition) {
$service['calls'] = $this->dumpMethodCalls($definition->getMethodCalls()); $service['calls'] = $this->dumpMethodCalls($definition->getMethodCalls());
} }
if (($scope = $definition->getScope()) !== ContainerInterface::SCOPE_CONTAINER) {
if ($scope === ContainerInterface::SCOPE_PROTOTYPE) {
// Scope prototype has been replaced with 'shared' => FALSE.
// This is a Symfony 2.8 forward compatibility fix.
// Reference: https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md#dependencyinjection
$service['shared'] = FALSE;
}
else {
throw new InvalidArgumentException("The 'scope' definition is deprecated in Symfony 3.0 and not supported by Drupal 8.");
}
}
// By default services are shared, so just provide the flag, when needed. // By default services are shared, so just provide the flag, when needed.
if ($definition->isShared() === FALSE) { if ($definition->isShared() === FALSE) {
$service['shared'] = $definition->isShared(); $service['shared'] = $definition->isShared();
......
...@@ -136,12 +136,8 @@ protected function createService(array $definition, $id) { ...@@ -136,12 +136,8 @@ protected function createService(array $definition, $id) {
} }
} }
// Share the service if it is public. if (!isset($definition['shared']) || $definition['shared'] !== FALSE) {
if (!isset($definition['public']) || $definition['public'] !== FALSE) { $this->services[$id] = $service;
// Forward compatibility fix for Symfony 2.8 update.
if (!isset($definition['shared']) || $definition['shared'] !== FALSE) {
$this->services[$id] = $service;
}
} }
if (isset($definition['calls'])) { if (isset($definition['calls'])) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace Drupal\Component\EventDispatcher; namespace Drupal\Component\EventDispatcher;
use Symfony\Component\DependencyInjection\IntrospectableContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
...@@ -36,7 +36,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface { ...@@ -36,7 +36,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
/** /**
* The service container. * The service container.
* *
* @var \Symfony\Component\DependencyInjection\IntrospectableContainerInterface; * @var \Symfony\Component\DependencyInjection\ContainerInterface;
*/ */
protected $container; protected $container;
...@@ -66,7 +66,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface { ...@@ -66,7 +66,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
/** /**
* Constructs a container aware event dispatcher. * Constructs a container aware event dispatcher.
* *
* @param \Symfony\Component\DependencyInjection\IntrospectableContainerInterface $container * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The service container. * The service container.
* @param array $listeners * @param array $listeners
* A nested array of listener definitions keyed by event name and priority. * A nested array of listener definitions keyed by event name and priority.
...@@ -77,7 +77,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface { ...@@ -77,7 +77,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
* A service entry will be resolved to a callable only just before its * A service entry will be resolved to a callable only just before its
* invocation. * invocation.
*/ */
public function __construct(IntrospectableContainerInterface $container, array $listeners = []) { public function __construct(ContainerInterface $container, array $listeners = []) {
$this->container = $container; $this->container = $container;
$this->listeners = $listeners; $this->listeners = $listeners;
$this->unsorted = []; $this->unsorted = [];
...@@ -91,9 +91,6 @@ public function dispatch($event_name, Event $event = NULL) { ...@@ -91,9 +91,6 @@ public function dispatch($event_name, Event $event = NULL) {
$event = new Event(); $event = new Event();
} }
$event->setDispatcher($this);
$event->setName($event_name);
if (isset($this->listeners[$event_name])) { if (isset($this->listeners[$event_name])) {
// Sort listeners if necessary. // Sort listeners if necessary.
if (isset($this->unsorted[$event_name])) { if (isset($this->unsorted[$event_name])) {
......
...@@ -27,6 +27,13 @@ public static function encode($data) { ...@@ -27,6 +27,13 @@ public static function encode($data) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function decode($raw) { public static function decode($raw) {
static $init;
if (!isset($init)) {
// Decode binary, since Symfony YAML parser encodes binary from 3.1
// onwards.
ini_set('yaml.decode_binary', 1);
$init = TRUE;
}
// yaml_parse() will error with an empty value. // yaml_parse() will error with an empty value.
if (!trim($raw)) { if (!trim($raw)) {
return NULL; return NULL;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
use Drupal\Component\Serialization\Exception\InvalidDataTypeException; use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
use Symfony\Component\Yaml\Parser; use Symfony\Component\Yaml\Parser;
use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Dumper;
use Symfony\Component\Yaml\Yaml as SymfonyYaml;
/** /**
* Default serialization for YAML using the Symfony component. * Default serialization for YAML using the Symfony component.
...@@ -18,7 +19,7 @@ public static function encode($data) { ...@@ -18,7 +19,7 @@ public static function encode($data) {
try { try {
$yaml = new Dumper(); $yaml = new Dumper();
$yaml->setIndentation(2); $yaml->setIndentation(2);
return $yaml->dump($data, PHP_INT_MAX, 0, TRUE, FALSE); return $yaml->dump($data, PHP_INT_MAX, 0, SymfonyYaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
} }
catch (\Exception $e) { catch (\Exception $e) {
throw new InvalidDataTypeException($e->getMessage(), $e->getCode(), $e); throw new InvalidDataTypeException($e->getMessage(), $e->getCode(), $e);
...@@ -33,7 +34,7 @@ public static function decode($raw) { ...@@ -33,7 +34,7 @@ public static function decode($raw) {
$yaml = new Parser(); $yaml = new Parser();
// Make sure we have a single trailing newline. A very simple config like // Make sure we have a single trailing newline. A very simple config like
// 'foo: bar' with no newline will fail to parse otherwise. // 'foo: bar' with no newline will fail to parse otherwise.
return $yaml->parse($raw, TRUE, FALSE); return $yaml->parse($raw, SymfonyYaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
} }
catch (\Exception $e) { catch (\Exception $e) {
throw new InvalidDataTypeException($e->getMessage(), $e->getCode(), $e); throw new InvalidDataTypeException($e->getMessage(), $e->getCode(), $e);
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace Drupal\Core\DependencyInjection; namespace Drupal\Core\DependencyInjection;
use Drupal\Component\DependencyInjection\Container as DrupalContainer; use Drupal\Component\DependencyInjection\Container as DrupalContainer;
use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Extends the Drupal container to set the service ID on the created object. * Extends the Drupal container to set the service ID on the created object.
...@@ -13,8 +12,8 @@ class Container extends DrupalContainer { ...@@ -13,8 +12,8 @@ class Container extends DrupalContainer {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) { public function set($id, $service) {
parent::set($id, $service, $scope); parent::set($id, $service);
// Ensure that the _serviceId property is set on synthetic services as well. // Ensure that the _serviceId property is set on synthetic services as well.
if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) { if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
......
...@@ -46,20 +46,12 @@ private function getProxyInstantiator() ...@@ -46,20 +46,12 @@ private function getProxyInstantiator()
} }
/** /**
* Direct copy of the parent function. * {@inheritdoc}
*/ */
protected function shareService(Definition $definition, $service, $id) protected function shareService(Definition $definition, $service, $id)
{ {
if ($definition->isShared() && self::SCOPE_PROTOTYPE !== $scope = $definition->getScope(false)) { if ($definition->isShared()) {
if (self::SCOPE_CONTAINER !== $scope && !isset($this->scopedServices[$scope])) {
throw new InactiveScopeException($id, $scope);
}
$this->services[$lowerId = strtolower($id)] = $service; $this->services[$lowerId = strtolower($id)] = $service;
if (self::SCOPE_CONTAINER !== $scope) {
$this->scopedServices[$scope][$lowerId] = $service;
}
} }
} }
...@@ -74,11 +66,11 @@ protected function shareService(Definition $definition, $service, $id) ...@@ -74,11 +66,11 @@ protected function shareService(Definition $definition, $service, $id)
* ContainerBuilder class should be fixed to allow setting synthetic * ContainerBuilder class should be fixed to allow setting synthetic
* services in a frozen builder. * services in a frozen builder.
*/ */
public function set($id, $service, $scope = self::SCOPE_CONTAINER) { public function set($id, $service) {
if (strtolower($id) !== $id) { if (strtolower($id) !== $id) {
throw new \InvalidArgumentException("Service ID names must be lowercase: $id"); throw new \InvalidArgumentException("Service ID names must be lowercase: $id");
} }
SymfonyContainer::set($id, $service, $scope); SymfonyContainer::set($id, $service);
// Ensure that the _serviceId property is set on synthetic services as well. // Ensure that the _serviceId property is set on synthetic services as well.
if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) { if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
......
...@@ -168,21 +168,10 @@ private function parseDefinition($id, $service, $file) ...@@ -168,21 +168,10 @@ private function parseDefinition($id, $service, $file)
$definition->setShared($service['shared']); $definition->setShared($service['shared']);
} }
if (isset($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'])) { if (isset($service['synthetic'])) {
$definition->setSynthetic($service['synthetic']); $definition->setSynthetic($service['synthetic']);
} }
if (isset($service['synchronized'])) {
$definition->setSynchronized($service['synchronized'], 'request' !== $id);
}
if (isset($service['lazy'])) { if (isset($service['lazy'])) {
$definition->setLazy($service['lazy']); $definition->setLazy($service['lazy']);
} }
...@@ -213,15 +202,15 @@ private function parseDefinition($id, $service, $file) ...@@ -213,15 +202,15 @@ private function parseDefinition($id, $service, $file)
} }
if (isset($service['factory_class'])) { if (isset($service['factory_class'])) {
$definition->setFactoryClass($service['factory_class']); $definition->setFactory($service['factory_class']);
} }
if (isset($service['factory_method'])) { if (isset($service['factory_method'])) {
$definition->setFactoryMethod($service['factory_method']); $definition->setFactory($service['factory_method']);
} }
if (isset($service['factory_service'])) { if (isset($service['factory_service'])) {
$definition->setFactoryService($service['factory_service']); $definition->setFactory($service['factory_service']);
} }
if (isset($service['file'])) { if (isset($service['file'])) {
......
...@@ -189,9 +189,9 @@ public function onRespond(FilterResponseEvent $event) { ...@@ -189,9 +189,9 @@ public function onRespond(FilterResponseEvent $event) {
* *
* When neither Cache-Control nor any of the ETag, Last-Modified, Expires * When neither Cache-Control nor any of the ETag, Last-Modified, Expires
* headers are set on the response, ::get('Cache-Control') returns the value * headers are set on the response, ::get('Cache-Control') returns the value
* 'no-cache'. If any of ETag, Last-Modified or Expires are set but not * 'no-cache, private'. If any of ETag, Last-Modified or Expires are set but
* Cache-Control, then 'private, must-revalidate' (in exactly this order) is * not Cache-Control, then 'private, must-revalidate' (in exactly this order)
* returned. * is returned.
* *
* @see \Symfony\Component\HttpFoundation\ResponseHeaderBag::computeCacheControlValue() * @see \Symfony\Component\HttpFoundation\ResponseHeaderBag::computeCacheControlValue()
* *
...@@ -202,7 +202,7 @@ public function onRespond(FilterResponseEvent $event) { ...@@ -202,7 +202,7 @@ public function onRespond(FilterResponseEvent $event) {
*/ */
protected function isCacheControlCustomized(Response $response) { protected function isCacheControlCustomized(Response $response) {
$cache_control = $response->headers->get('Cache-Control'); $cache_control = $response->headers->get('Cache-Control');
return $cache_control != 'no-cache' && $cache_control != 'private, must-revalidate'; return $cache_control != 'no-cache, private' && $cache_control != 'private, must-revalidate';
} }
/** /**
......
...@@ -18,7 +18,7 @@ class CommandLineOrUnsafeMethod implements RequestPolicyInterface { ...@@ -18,7 +18,7 @@ class CommandLineOrUnsafeMethod implements RequestPolicyInterface {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function check(Request $request) { public function check(Request $request) {
if ($this->isCli() || !$request->isMethodSafe()) { if ($this->isCli() || !$request->isMethodCacheable()) {
return static::DENY; return static::DENY;
} }
} }
......
...@@ -93,7 +93,7 @@ public function __construct(RequestStack $request_stack, CacheFactoryInterface $ ...@@ -93,7 +93,7 @@ public function __construct(RequestStack $request_stack, CacheFactoryInterface $
*/ */
public function get(array $elements) { public function get(array $elements) {
// @todo remove this check when https://www.drupal.org/node/2367555 lands. // @todo remove this check when https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodSafe()) { if (!$this->requestStack->getCurrentRequest()->isMethodCacheable()) {
return FALSE; return FALSE;
} }
...@@ -127,7 +127,7 @@ public function set(array &$elements, array $pre_bubbling_elements) { ...@@ -127,7 +127,7 @@ public function set(array &$elements, array $pre_bubbling_elements) {
$result = parent::set($elements, $pre_bubbling_elements); $result = parent::set($elements, $pre_bubbling_elements);
// @todo remove this check when https://www.drupal.org/node/2367555 lands. // @todo remove this check when https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodSafe()) { if (!$this->requestStack->getCurrentRequest()->isMethodCacheable()) {
return FALSE; return FALSE;
} }
......
...@@ -61,9 +61,9 @@ public function __construct(RequestStack $request_stack, CacheFactoryInterface $ ...@@ -61,9 +61,9 @@ public function __construct(RequestStack $request_stack, CacheFactoryInterface $
public function get(array $elements) { public function get(array $elements) {
// Form submissions rely on the form being built during the POST request, // Form submissions rely on the form being built during the POST request,
// and render caching of forms prevents this from happening. // and render caching of forms prevents this from happening.
// @todo remove the isMethodSafe() check when // @todo remove the isMethodCacheable() check when
// https://www.drupal.org/node/2367555 lands. // https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodSafe() || !$cid = $this->createCacheID($elements)) { if (!$this->requestStack->getCurrentRequest()->isMethodCacheable() || !$cid = $this->createCacheID($elements)) {
return FALSE; return FALSE;
} }
$bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'render'; $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'render';
...@@ -88,9 +88,9 @@ public function get(array $elements) { ...@@ -88,9 +88,9 @@ public function get(array $elements) {
public function set(array &$elements, array $pre_bubbling_elements) { public function set(array &$elements, array $pre_bubbling_elements) {
// Form submissions rely on the form being built during the POST request, // Form submissions rely on the form being built during the POST request,
// and render caching of forms prevents this from happening. // and render caching of forms prevents this from happening.
// @todo remove the isMethodSafe() check when // @todo remove the isMethodCacheable() check when
// https://www.drupal.org/node/2367555 lands. // https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodSafe() || !$cid = $this->createCacheID($elements)) { if (!$this->requestStack->getCurrentRequest()->isMethodCacheable() || !$cid = $this->createCacheID($elements)) {
return FALSE; return FALSE;
} }
......
...@@ -338,9 +338,9 @@ protected function doRender(&$elements, $is_root_call = FALSE) { ...@@ -338,9 +338,9 @@ protected function doRender(&$elements, $is_root_call = FALSE) {
// If instructed to create a placeholder, and a #lazy_builder callback is // If instructed to create a placeholder, and a #lazy_builder callback is
// present (without such a callback, it would be impossible to replace the // present (without such a callback, it would be impossible to replace the
// placeholder), replace the current element with a placeholder. // placeholder), replace the current element with a placeholder.
// @todo remove the isMethodSafe() check when // @todo remove the isMethodCacheable() check when
// https://www.drupal.org/node/2367555 lands. // https://www.drupal.org/node/2367555 lands.
if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === TRUE && $this->requestStack->getCurrentRequest()->isMethodSafe()) { if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === TRUE && $this->requestStack->getCurrentRequest()->isMethodCacheable()) {
if (!isset($elements['#lazy_builder'])) { if (!isset($elements['#lazy_builder'])) {
throw new \LogicException('When #create_placeholder is set, a #lazy_builder callback must be present as well.'); throw new \LogicException('When #create_placeholder is set, a #lazy_builder callback must be present as well.');
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
class ExecutionContext implements ExecutionContextInterface { class ExecutionContext implements ExecutionContextInterface {
/** /**
* @var \Symfony\Component\Validator\ValidatorInterface * @var \Symfony\Component\Validator\Validator\ValidatorInterface
*/ */
protected $validator; protected $validator;
......
...@@ -109,7 +109,7 @@ public function processPlaceholders(array $placeholders) { ...@@ -109,7 +109,7 @@ public function processPlaceholders(array $placeholders) {
$request = $this->requestStack->getCurrentRequest(); $request = $this->requestStack->getCurrentRequest();
// @todo remove this check when https://www.drupal.org/node/2367555 lands. // @todo remove this check when https://www.drupal.org/node/2367555 lands.
if (!$request->isMethodSafe()) { if (!$request->isMethodCacheable()) {
return []; return [];
} }
......
...@@ -47,7 +47,7 @@ public function testProcessPlaceholders(array $placeholders, $method, $route_mat ...@@ -47,7 +47,7 @@ public function testProcessPlaceholders(array $placeholders, $method, $route_mat
$big_pipe_strategy = new BigPipeStrategy($session_configuration->reveal(), $request_stack->reveal(), $route_match->reveal()); $big_pipe_strategy = new BigPipeStrategy($session_configuration->reveal(), $request_stack->reveal(), $route_match->reveal());
$processed_placeholders = $big_pipe_strategy->processPlaceholders($placeholders); $processed_placeholders = $big_pipe_strategy->processPlaceholders($placeholders);
if ($request->isMethodSafe() && !$route_match_has_no_big_pipe_option && $request_has_session) { if ($request->isMethodCacheable() && !$route_match_has_no_big_pipe_option && $request_has_session) {
$this->assertSameSize($expected_big_pipe_placeholders, $processed_placeholders, 'BigPipe is able to deliver all placeholders.'); $this->assertSameSize($expected_big_pipe_placeholders, $processed_placeholders, 'BigPipe is able to deliver all placeholders.');
foreach (array_keys($placeholders) as $placeholder) { foreach (array_keys($placeholders) as $placeholder) {
$this->assertSame($expected_big_pipe_placeholders[$placeholder], $processed_placeholders[$placeholder], "Verifying how BigPipeStrategy handles the placeholder '$placeholder'"); $this->assertSame($expected_big_pipe_placeholders[$placeholder], $processed_placeholders[$placeholder], "Verifying how BigPipeStrategy handles the placeholder '$placeholder'");
......
...@@ -76,7 +76,7 @@ public function testBlock() { ...@@ -76,7 +76,7 @@ public function testBlock() {
// Render the block. // Render the block.
// @todo The request stack manipulation won't be necessary once // @todo The request stack manipulation won't be necessary once
// https://www.drupal.org/node/2367555 is fixed and the // https://www.drupal.org/node/2367555 is fixed and the
// corresponding $request->isMethodSafe() checks are removed from // corresponding $request->isMethodCacheable() checks are removed from
// Drupal\Core\Render\Renderer. // Drupal\Core\Render\Renderer.
$request_stack = $this->container->get('request_stack'); $request_stack = $this->container->get('request_stack');
$request_stack->push(new Request()); $request_stack->push(new Request());
......