Automattic / media-explorer

With Media Explorer, you can now search for tweets and videos on Twitter and YouTube directly from the Add Media screen in WordPress.
126 stars 30 forks source link

Deprecation Warning Thrown on PHP8.2 #84

Open jakewrfoster opened 10 months ago

jakewrfoster commented 10 months ago

Issue

On PHP 8.2, the plugin throws the following deprecation warnings:

PHP Deprecated: Creation of dynamic property Media_Explorer::$file is deprecated in /my-cool-path/wp-content/plugins/media-explorer/class.plugin.php on line 27
PHP Deprecated:  Creation of dynamic property Media_Explorer::$plugin is deprecated in /my-cool-path/wp-content/plugins/media-explorer/class.plugin.php on line 89

Proposed solution

Add the props to the class so that they aren't dynamically created.

jakewrfoster commented 10 months ago

I am unable to push a branch to PR this, but some variation of the following could be added here to address the issue

/**
 * The plugin's file path.
 *
 * @var string
 */
public string $file;
jakewrfoster commented 10 months ago

and...

/**
 * The plugin's configuration.
 *
 * @var array
 */
public array $plugin;