Fix fatal error for validateConfig() method signature mismatch

Created on 18 February 2025, about 2 months ago

Problem/Motivation

A PHP fatal error occurs due to a method signature mismatch between FacebookAuth::validateConfig() and NetworkBase::validateConfig():

PHP Fatal error: Declaration of Drupal\social_auth_facebook\Plugin\Network\FacebookAuth::validateConfig(
  Drupal\social_auth\Settings\SettingsInterface $settings
): bool must be compatible with Drupal\social_auth\Plugin\Network\NetworkBase::validateConfig(
  Drupal\social_auth\Plugin\Network\NetworkInterface $network,
  Drupal\social_auth\Settings\SettingsInterface $settings
): bool

This issue arises because FacebookAuth::validateConfig() does not match the method signature defined in the parent class NetworkBase.

Proposed resolution

Update FacebookAuth::validateConfig() to match the expected method signature:

  /**
   * {@inheritdoc}
   */
  protected function validateConfig(NetworkInterface $network, SettingsInterface $settings): bool {
    $graph_version = $settings->getGraphVersion();
    if (!parent::validateConfig($network, $settings) || !$graph_version) {
      $this->loggerFactory
        ->get('social_auth_facebook')
        ->error('Define graph version on module settings.');
      return FALSE;
    }
    return TRUE;
  }

Ensure compatibility with the social_auth module's latest changes.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024