Verified Commit b6b21bda authored by Jess's avatar Jess
Browse files

Issue #3326371 by Spokje: [10.0.x backport] Fix PHPStan L1 error "Anonymous...

Issue #3326371 by Spokje: [10.0.x backport] Fix PHPStan L1 error "Anonymous function has an unused use $foo."
parent 9696ac2b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -208,10 +208,9 @@ public function testUnauthorizedErrorMessage() {
   * @see \Drupal\basic_auth\Authentication\Provider\BasicAuth::challengeException()
   */
  public function testCacheabilityOf401Response() {
    $session = $this->getSession();
    $url = Url::fromRoute('router_test.11');

    $assert_response_cacheability = function ($expected_page_cache_header_value, $expected_dynamic_page_cache_header_value) use ($session, $url) {
    $assert_response_cacheability = function ($expected_page_cache_header_value, $expected_dynamic_page_cache_header_value) use ($url) {
      $this->drupalGet($url);
      $this->assertSession()->statusCodeEquals(401);
      $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', $expected_page_cache_header_value);
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ public function testInstallUninstall() {
    $validation_modules = array_keys($validation_reasons);
    $this->assertEqualsCanonicalizing($expected_modules, $validation_modules);

    $modules_to_uninstall = array_filter($all_modules, function ($module) use ($validation_reasons) {
    $modules_to_uninstall = array_filter($all_modules, function ($module) {
      // Filter required and not enabled modules.
      if (!empty($module->info['required']) || $module->status == FALSE) {
        return FALSE;
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ protected function assertAnnounceLeaveEditMode(): void {
    $web_assert = $this->assertSession();
    $page = $this->getSession()->getPage();
    // Wait till all the contextual links are hidden.
    $page->waitFor(1, function () use ($page, $web_assert) {
    $page->waitFor(1, function () use ($page) {
      return empty($page->find('css', '.contextual .trigger.visually-hidden'));
    });
    $web_assert->elementContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is no longer constrained by the Contextual module.');
+1 −1
Original line number Diff line number Diff line
@@ -580,7 +580,7 @@ public function testGet() {
          ? $link_relation_type->getRegisteredName()
          : $link_relation_type->getExtensionUri();
      }, array_keys($this->entity->getEntityType()->getLinkTemplates()));
      $parse_rel_from_link_header = function ($value) use ($link_relation_type_manager) {
      $parse_rel_from_link_header = function ($value) {
        $matches = [];
        if (preg_match('/rel="([^"]+)"/', $value, $matches) === 1) {
          return $matches[1];
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ public function testLinkRenderArrayText() {
    $l = Link::fromTextAndUrl('foo', Url::fromUri('https://www.drupal.org'))->toString();

    // Test a renderable array passed to the link generator.
    $renderer->executeInRenderContext(new RenderContext(), function () use ($renderer, $l) {
    $renderer->executeInRenderContext(new RenderContext(), function () use ($l) {
      $renderable_text = ['#markup' => 'foo'];
      $l_renderable_text = \Drupal::service('link_generator')->generate($renderable_text, Url::fromUri('https://www.drupal.org'));
      $this->assertEquals($l, $l_renderable_text);
Loading