Commit 2b844ffe authored by catch's avatar catch
Browse files

Revert "Issue #3049525 by longwave, fougere, larowlan, kim.pepper,...

Revert "Issue #3049525 by longwave, fougere, larowlan, kim.pepper, AaronBauman, Wim Leers, Charlie ChX Negyesi, alexpott, geek-merlin: Enable service autowiring by adding interface aliases to core service definitions"

This reverts commit 365dfc2e.
parent db089644
Loading
Loading
Loading
Loading
+0 −183

File changed.

Preview size limit exceeded, changes collapsed.

+0 −4
Original line number Diff line number Diff line
@@ -1282,10 +1282,6 @@ protected function compileContainer() {
    $container->register('kernel', 'Symfony\Component\HttpKernel\KernelInterface')->setSynthetic(TRUE);
    $container->register('service_container', 'Symfony\Component\DependencyInjection\ContainerInterface')->setSynthetic(TRUE);

    // Register aliases of synthetic services for autowiring.
    $container->setAlias(DrupalKernelInterface::class, 'kernel');
    $container->setAlias(ContainerInterface::class, 'service_container');

    // Register application services.
    $yaml_loader = new YamlFileLoader($container);
    foreach ($this->serviceYamls['app'] as $filename) {
+1 −3
Original line number Diff line number Diff line
@@ -15,10 +15,8 @@ services:
    alias: 'Drupal\autowire_test\TestInjection'
    public: false

  # A service that tests autowiring for four constructor arguments:
  # A service that tests autowiring for two constructor arguments:
  # - One type-hinted to TestInjectionInterface.
  # - One type-hinted to TestInjection2.
  # - One type-hinted to \Drupal\Core\Database\Connection.
  # - One type-hinted to \Symfony\Component\HttpKernel\KernelInterface.
  Drupal\autowire_test\TestService:
    autowire: true
+1 −24
Original line number Diff line number Diff line
@@ -2,9 +2,6 @@

namespace Drupal\autowire_test;

use Drupal\Core\Database\Connection;
use Drupal\Core\DrupalKernelInterface;

class TestService {

  /**
@@ -17,21 +14,9 @@ class TestService {
   */
  protected $testInjection2;

  /**
   * The database connection.
   */
  protected $database;

  /**
   * The Drupal kernel.
   */
  protected $kernel;

  public function __construct(TestInjectionInterface $test_injection, TestInjection2 $test_injection2, Connection $database, DrupalKernelInterface $kernel) {
  public function __construct(TestInjectionInterface $test_injection, TestInjection2 $test_injection2) {
    $this->testInjection = $test_injection;
    $this->testInjection2 = $test_injection2;
    $this->database = $database;
    $this->kernel = $kernel;
  }

  public function getTestInjection(): TestInjectionInterface {
@@ -42,12 +27,4 @@ public function getTestInjection2(): TestInjection2 {
    return $this->testInjection2;
  }

  public function getDatabase(): Connection {
    return $this->database;
  }

  public function getKernel(): DrupalKernelInterface {
    return $this->kernel;
  }

}
+0 −2
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
use Drupal\Core\Logger\RfcLogLevel;
use Drupal\KernelTests\KernelTestBase;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\TransferException;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
@@ -724,7 +723,6 @@ protected function setTestFeedResponses(array $responses): void {
    $this->container = $this->container->get('kernel')->getContainer();
    $this->container->get('logger.factory')->addLogger($this);
    $this->container->set('http_client', new Client(['handler' => $handler_stack]));
    $this->container->setAlias(ClientInterface::class, 'http_client');
  }

  /**
Loading