inpsyde / Wonolog

Monolog-based logging package for WordPress.
https://inpsyde.github.io/Wonolog/
MIT License
172 stars 17 forks source link

[Bug]: PHP Deprecated: Return type of Inpsyde\Wonolog\Processor\ProcessorsRegistry::count() #68

Closed thefrosty closed 1 year ago

thefrosty commented 2 years ago

Description of the bug

PHP deprecation notice in PHP 8.1.

PHP Deprecated:  Return type of Inpsyde\Wonolog\Processor\ProcessorsRegistry::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/local/wordpress/vendor/inpsyde/wonolog/src/Processor/ProcessorsRegistry.php on line 93

Reproduction instructions

Log into the admin, and note tailed error logs.

Expected behavior

No logs.

Environment info

Relevant log output

PHP Deprecated:  Return type of Inpsyde\Wonolog\Processor\ProcessorsRegistry::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/local/wordpress/vendor/inpsyde/wonolog/src/Processor/ProcessorsRegistry.php on line 93

Additional context

See code examples for #[\ReturnTypeWillChange] fix in core: https://github.com/WordPress/wordpress-develop/search?q=%23%5BReturnTypeWillChange%5D

Code of Conduct

gmazzap commented 2 years ago

@thefrosty this is done for v2

https://github.com/inpsyde/Wonolog/blob/2.x/src/Registry/ProcessorsRegistry.php#L247 where we added return type.

I don't think we want to support PHP 8.1 in v1.