class RequestStack

Same name in other branches
  1. 10 core/lib/Drupal/Core/Http/RequestStack.php \Drupal\Core\Http\RequestStack

Forward-compatibility shim for Symfony's RequestStack.

@todo https://www.drupal.org/node/3265121 Remove in Drupal 10.0.x.

Hierarchy

  • class \Drupal\Core\Http\RequestStack extends \Symfony\Component\HttpFoundation\RequestStack

Expanded class hierarchy of RequestStack

4 files declare their use of RequestStack
PrivateTempStoreTest.php in core/tests/Drupal/Tests/Core/TempStore/PrivateTempStoreTest.php
RendererTestBase.php in core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
Contains \Drupal\Tests\Core\Render\RendererTestBase.
RequestStackLegacyTest.php in core/tests/Drupal/Tests/Core/Http/RequestStackLegacyTest.php
SharedTempStoreTest.php in core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php
3 string references to 'RequestStack'
core.services.yml in core/core.services.yml
core/core.services.yml
LocalTaskIntegrationTestBase::getLocalTaskManager in core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php
Sets up the local task manager for the test.
SharedTempStoreTest::testSerialization in core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php
Tests the serialization of a shared temp store.
1 service uses RequestStack
request_stack in core/core.services.yml
Drupal\Core\Http\RequestStack

File

core/lib/Drupal/Core/Http/RequestStack.php, line 13

Namespace

Drupal\Core\Http
View source
class RequestStack extends SymfonyRequestStack {
    
    /**
     * Gets the main request.
     *
     * @return \Symfony\Component\HttpFoundation\Request|null
     *   The main request.
     */
    public function getMainRequest() : ?Request {
        if (method_exists(SymfonyRequestStack::class, 'getMainRequest')) {
            return parent::getMainRequest();
        }
        else {
            return parent::getMasterRequest();
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public function getMasterRequest() {
        @trigger_error(__METHOD__ . '() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use getMainRequest() instead. See https://www.drupal.org/node/3253744', E_USER_DEPRECATED);
        return $this->getMainRequest();
    }

}

Members

Title Sort descending Modifiers Object type Summary
RequestStack::getMainRequest public function Gets the main request.
RequestStack::getMasterRequest public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.