Creation of dynamic property is deprecated

Created on 1 February 2024, 11 months ago
Updated 8 May 2024, 8 months ago

Drupal v. 10.2.2
PHP v. 8.2.15

When I call AT Theme Generator (/admin/appearance/at_generate) from /admin/appearance, I get this error:

Deprecated: Creation of dynamic property Drupal\at_theme_generator\Theme\ThemeInfo::$data is deprecated in My_site/modules/contrib/at_tool/at_theme_generator/src/Theme/ThemeInfo.php on line 17
The website encountered an unexpected error. Try again later.

It is because of this:

public function __construct() {
  $this->data = \Drupal::service('theme_handler')->rebuildThemeData();
}

The variable "data" is not predefined in the class.

The solution is here in "ThemeInfo.php", line 11++:

class ThemeInfo {
+  protected $data;
  /**
   * Constructs a theme info object.
   */
  public function __construct() {
    $this->data = \Drupal::service('theme_handler')->rebuildThemeData();
  }
  ...

Be sure that alle cass-variables is predefined in Drupal 10.

๐Ÿ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ฐDenmark uv516 Denmark

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