Skip to content

Conversation

rodrigoprimo
Copy link
Contributor

This PR fixes the following deprecation warnings when running wp --info with PHP 8.2 RC6:

Deprecated: Creation of dynamic property WP_CLI\Dispatcher\CompositeCommand::$longdesc is deprecated in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 38
Deprecated: Creation of dynamic property WP_CLI\Dispatcher\Subcommand::$longdesc is deprecated in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 38
Deprecated: Creation of dynamic property WP_CLI\Dispatcher\CommandNamespace::$longdesc is deprecated in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 38

Dynamic properties are deprecated in PHP 8.2. The solution was to simply declare CompositeCommand::$longdesc before it is used.

This commit fixes the following deprecation warnings when running `wp
--info` with PHP 8.2 RC6:

```
Deprecated: Creation of dynamic property WP_CLI\Dispatcher\CompositeCommand::$longdesc is deprecated in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 38
Deprecated: Creation of dynamic property WP_CLI\Dispatcher\Subcommand::$longdesc is deprecated in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 38
Deprecated: Creation of dynamic property WP_CLI\Dispatcher\CommandNamespace::$longdesc is deprecated in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CompositeCommand.php on line 38
```

Dynamic properties are deprecated in PHP 8.2. The solution was to simply
declare CompositeCommand::$longdesc before it is used.
@rodrigoprimo rodrigoprimo requested a review from a team as a code owner November 29, 2022 12:48
@rodrigoprimo
Copy link
Contributor Author

I'm currently testing a plugin that I maintain with PHP 8.2. Besides this deprecation warning, I saw a few others in some WP-CLI packages. Please let me know if PRs like this one help, and I will create a few more in the corresponding repositories.

@danielbachhuber danielbachhuber added this to the 2.8.0 milestone Nov 29, 2022
@danielbachhuber
Copy link
Member

Please let me know if PRs like this one help, and I will create a few more in the corresponding repositories.

That would be great, thank you!

@danielbachhuber danielbachhuber enabled auto-merge (squash) November 29, 2022 13:00
@danielbachhuber danielbachhuber merged commit a2f0250 into wp-cli:main Nov 29, 2022
@rodrigoprimo
Copy link
Contributor Author

Thanks for quickly reviewing and approving this PR.

That would be great, thank you!

In the end, it was just one deprecation notice in one package: wp-cli/i18n-command#346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants