WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 7 weeks ago

#50897 closed defect (bug) (fixed)

PHP 8: fix final private methods

Reported by: jrf Owned by: SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: minor Version:
Component: General Keywords: has-patch php8 has-unit-tests has-dev-note
Focuses: coding-standards Cc:

Description

Declaring a private method as final is an oxymoron, as private methods cannot be overloaded anyway.

Using final private function... will generate a warning in PHP 8.

The attached patch fixes all known instances of this in WP Core at the time of writing.

Attachments (1)

50897-fix-final-private-methods.patch (2.5 KB) - added by jrf 6 months ago.

Download all attachments as: .zip

Change History (8)

#1 @johnbillion
6 months ago

  • Milestone changed from Awaiting Review to 5.6

This ticket was mentioned in PR #467 on WordPress/wordpress-develop by jrfnl.


6 months ago

  • Keywords has-unit-tests added

Declaring a private method as final is an oxymoron, as private methods cannot be overloaded anyway.

This will generate a warning in PHP 8.

Trac ticket: https://core.trac.wordpress.org/ticket/50897

#3 @SergeyBiryukov
6 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#4 @SergeyBiryukov
6 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 48788:

Code Modernization: Remove final keyword from private methods.

Declaring a private method as final is an oxymoron, as private methods cannot be overloaded anyway.

Using final private function... will generate a warning in PHP 8.

Props jrf.
Fixes #50897.

#5 @prbot
6 months ago

jrfnl commented on PR #467:

Patch has been committed. Closing.

#6 @desrosj
5 months ago

  • Keywords needs-dev-note added

Adding needs-dev-note to include in the PHP 8 developer note.

#7 @daisyo
7 weeks ago

  • Keywords has-dev-note added; needs-dev-note removed
Note: See TracTickets for help on using tickets.