Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51557 closed task (blessed) (fixed)

Modernize: use explicit visibility for property declarations

Reported by: jrf's profile jrf Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: minor Version: 5.6
Component: General Keywords: has-patch commit
Focuses: coding-standards Cc:

Description

Using var or just and only static to declare a class property is PHP 4 code. PHP 5 introduced visibility modifiers.

This updates the code base to use explicit visibility modifier for properties.

No review has been done on what the visibility of the properties should be as a property without visibility defaults to public and changing that to a more closed visibility would be a BC-break.

Note: the same should be done for class methods at some point, but I wouldn't want the fixes for that to interfere with patches for ticket #51533, so I'm leaving that till later.

Related to #50767

Attachments (1)

51557-property-visibility.patch (32.2 KB) - added by jrf 4 years ago.
Fixes all known instances of this issue

Download all attachments as: .zip

Change History (7)

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


4 years ago
#1

  • Keywords has-unit-tests added

Using var or just and only static to declare a class property is PHP 4 code. PHP 5 introduced visibility modifiers.

This updates the code base to use explicit visibility modifier for properties.

No review has been done on what the visibility of the properties _should_ be as a property without visibility defaults to public and changing that to a more closed visibility would be a BC-break.

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

@jrf
4 years ago

Fixes all known instances of this issue

#2 @jrf
4 years ago

  • Keywords has-unit-tests removed

#4 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 49184:

Code Modernization: Use explicit visibility for class property declarations.

Using var or only static to declare a class property is PHP 4 code.

This updates the codebase to use explicit visibility modifiers introduced in PHP 5.

Props jrf.
Fixes #51557. See #22234.

#5 @jrf
4 years ago

Thanks @SergeyBiryukov for committing and finding the previous ticket, I did search, but my trac search-fu is nowhere near as good as yours ;-)

jrfnl commented on PR #614:


4 years ago
#6

Closing as committed.

Note: See TracTickets for help on using tickets.