Problem/Motivation

When saving form admin/config/people/authorization/profile/ldap_to_drupal_roles

The error occures
Fatal error: Class Drupal\authorization\Form\SubFormState contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Drupal\Core\Form\FormStateInterface::setIgnoreDestination, Drupal\Core\Form\FormStateInterface::getIgnoreDestination) in /web/modules/contrib/authorization/src/Form/SubFormState.php on line 17

This happens after upgrading to Drupal 10.2

From FormState.php of Drupal 10.2

  /**
   * Determines whether the redirect respects the destination query parameter.
   *
   * @param bool $status
   *   (optional) TRUE if the redirect should take precedence over the
   *   destination query parameter. FALSE if not. Defaults to TRUE.
   *
   * @return $this
   */
  public function setIgnoreDestination(bool $status = TRUE) {
    $this->ignoreDestination = $status;
    return $this;
  }

  /**
   * Gets whether the redirect respects the destination query parameter.
   *
   * @return bool
   *   TRUE if the redirect should take precedence over the destination query
   *   parameter.
   */
  public function getIgnoreDestination(): bool {
    return $this->ignoreDestination;
  }
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fox_01 created an issue. See original summary.

chetan 11 made their first commit to this issue’s fork.

chetan 11’s picture

Status: Active » Needs review

Please Check the above raised MR.

bluegeek9’s picture

Status: Needs review » Needs work
$ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
FILE: ...3409489/web/modules/custom/authorization-3409489/src/Form/SubFormState.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 849 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
     |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 850 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
     |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 851 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
     |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
bluegeek9’s picture

Category: Bug report » Task
Issue summary: View changes

Since SubFormState is custom, and requires a main form state, maybe something like this.

  /**
   * {@inheritdoc}
   */
  public function setIgnoreDestination(bool $status = TRUE) {
    $this->mainFormState->setIgnoreDestination($status);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getIgnoreDestination(): bool {
    return $this->mainFormState->getIgnoreDestination();
  }

  • bluegeek9 committed 8214deb9 on 8.x-1.x
    Issue #3409489: Fatal error: Class SubFormState contains 2 abstract...
bluegeek9’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.