Opened 2 years ago
Closed 2 years ago
#56746 closed defect (bug) (invalid)
Unused function parameters in the class-wp-customize-background-image-setting.php files.
Reported by: | upadalavipul | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | coding-standards | Cc: |
Description
As per the PHPCS coding standards suggestion, removing the unused parameter "$value" is needed. file location: wp-includes/customize/class-wp-customize-background-image-setting.php.
Attachments (1)
Change History (4)
#2
@
2 years ago
Hi there, thanks for the ticket!
I believe the proposed patch would cause a warning on PHP 7.x and a fatal error on PHP 8.x due to the number of parameters in the child class method not matching the number of parameters in the parent class.
Running this script in the root directory with the patch applied:
require 'wp-load.php'; require 'wp-includes/class-wp-customize-setting.php'; $setting = new WP_Customize_Background_Image_Setting( null, '' ); $setting->update();
I get: Fatal error: Declaration of WP_Customize_Background_Image_Setting::update() must be compatible with WP_Customize_Setting::update($value) in wp-includes/customize/class-wp-customize-background-image-setting.php on line 32
#3
@
2 years ago
- Keywords close removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version trunk deleted
I'm going to close this one out. This seems to be as intended.
@upadalavipul if you have any further details why this is incorrect, feel free to reopen with more information.
@upadalavipul There is a reason why that sniff is not applied to WP Core / in the
WordPress-Core
ruleset.WordPress is a highly extended package and overloaded (extended) versions of this class could be relying on this parameter.
If it would be removed, it should also be removed from all method calls passing it and that would be considered a BC-break.