Problem/Motivation

PHP 8.4 deprecates implicitly nullable parameter types. On PHP 8.4+ the following deprecation is triggered:

Deprecated function: Drupal\social_api\AuthManager\OAuth2Manager::__construct(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in include()

Steps to reproduce

  1. Run a site with Social API enabled on PHP 8.4 or later.
  2. Load any page that instantiates an OAuth2 manager (e.g. a Social Auth login route).
  3. See the deprecation message in the log or on screen.

Proposed resolution

Use explicit nullable types, e.g. in src/AuthManager/OAuth2Manager.php:

- Request $request = NULL
+ ?Request $request = NULL

Check the rest of the module for the same pattern and fix all occurrences. Explicit nullable types are supported since PHP 7.1, so there are no backwards-compatibility concerns.

Remaining tasks

  • Create MR
  • Review

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork social_api-3629245

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

livido created an issue. See original summary.

livido’s picture

Status: Active » Needs review