wp-media / imagify-plugin

Speed up your website with lighter images without losing quality.
https://imagify.io
71 stars 25 forks source link

Closes #734: Deprecated notice Imagify_Files_Iterator::accept() #748

Closed Miraeld closed 12 months ago

Miraeld commented 1 year ago

Description

Please include a summary of the change and which issue is fixed/closed. Please also include relevant motivation and context. List any dependencies that are required for this change.

With PHP 8.0+ a notice was appearing while using custom folders.

PHP Deprecated:  Return type of Imagify_Files_Iterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /shared/httpd/wprocketest/htdocs/wp-content/plugins/imagify-plugin/inc/classes/class-imagify-files-iterator.php on line 65

&

PHP Deprecated:  Return type of Imagify_Files_Recursive_Iterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/classes/class-imagify-files-recursive-iterator.php on line 55

This happened because FilterIterator::accept() is declared as it will returns a bool. However Imagify_Files_Recursive_Iterator::accept() wasn't explicitly saying that it will returns a bool.

Fixes #734

Type of change

Is the solution different from the one proposed during the grooming?

There wasn't any solution provided, however, I've only added a return type to 2 functions.

Checklists

Generic development checklist

Test summary