PHP 8.3 Deprecated get_class()

Created on 21 August 2024, 5 months ago

Problem/Motivation

Calling get_class() without arguments is deprecated in PHP 8.3. This module is still using get_class() causing the following deprecated warning.

Deprecated function: Calling get_class() without arguments is deprecated in Drupal\access_unpublished\Form\AccessTokenEntityOverviewForm->buildForm() (line 187 of modules/contrib/access_unpublished/src/Form/AccessTokenEntityOverviewForm.php).

Usage:

    $form['access_token_generate']['generate_token'] = [
      '#type' => 'button',
      '#value' => $this->t('Generate token'),
      '#ajax' => [
        'callback' => [get_class(), 'generateToken'],
      ],
    ];

Steps to reproduce

View any access token overview form.

Proposed resolution

Update the code to:

 'callback' => [static::class, 'generateToken'],

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States recrit

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

Comments & Activities

Production build 0.71.5 2024