Verified Commit be07eed9 authored by Dave Long's avatar Dave Long
Browse files

fix: #3557917 Remove stale implementations of WorkspaceNegotiatorInterface::getActiveWorkspace()

By: amateescu
(cherry picked from commit 0838ccf8c927b394a616c6d69acf919fe47de569)
parent e6cf2a7c
Loading
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -44990,12 +44990,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/workspaces/src/Negotiator/QueryParameterWorkspaceNegotiator.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\workspaces\\\\Negotiator\\\\SessionWorkspaceNegotiator\\:\\:getActiveWorkspace\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/workspaces/src/Negotiator/SessionWorkspaceNegotiator.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\workspaces\\\\Negotiator\\\\SessionWorkspaceNegotiator\\:\\:setActiveWorkspace\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -45195,12 +45189,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/workspaces/src/WorkspacesServiceProvider.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\workspace_update_test\\\\Negotiator\\\\TestWorkspaceNegotiator\\:\\:getActiveWorkspace\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\workspace_update_test\\\\Negotiator\\\\TestWorkspaceNegotiator\\:\\:setActiveWorkspace\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+2 −17
Original line number Diff line number Diff line
@@ -2,11 +2,10 @@

namespace Drupal\workspaces\Negotiator;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\workspaces\WorkspaceInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

/**
 * Defines the session workspace negotiator.
@@ -15,8 +14,7 @@ class SessionWorkspaceNegotiator implements WorkspaceNegotiatorInterface, Worksp

  public function __construct(
    protected readonly AccountInterface $currentUser,
    protected readonly Session $session,
    protected readonly EntityTypeManagerInterface $entityTypeManager,
    protected readonly SessionInterface $session,
  ) {}

  /**
@@ -34,19 +32,6 @@ public function getActiveWorkspaceId(Request $request): ?string {
    return $this->session->get('active_workspace_id');
  }

  /**
   * {@inheritdoc}
   */
  public function getActiveWorkspace(Request $request) {
    $workspace_id = $this->getActiveWorkspaceId($request);

    if ($workspace_id && ($workspace = $this->entityTypeManager->getStorage('workspace')->load($workspace_id))) {
      return $workspace;
    }

    return NULL;
  }

  /**
   * {@inheritdoc}
   */
+0 −8
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@

namespace Drupal\workspace_update_test\Negotiator;

use Drupal\workspaces\Entity\Workspace;
use Drupal\workspaces\Negotiator\WorkspaceIdNegotiatorInterface;
use Drupal\workspaces\Negotiator\WorkspaceNegotiatorInterface;
use Drupal\workspaces\WorkspaceInterface;
@@ -29,13 +28,6 @@ public function getActiveWorkspaceId(Request $request): ?string {
    return 'test';
  }

  /**
   * {@inheritdoc}
   */
  public function getActiveWorkspace(Request $request) {
    return Workspace::load($this->getActiveWorkspaceId($request));
  }

  /**
   * {@inheritdoc}
   */
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ services:

  workspaces.negotiator.session:
    class: Drupal\workspaces\Negotiator\SessionWorkspaceNegotiator
    arguments: ['@current_user', '@session', '@entity_type.manager']
    autowire: true
    tags:
      - { name: workspace_negotiator, priority: 50 }
  workspaces.negotiator.query_parameter: