WordPress.org

Make WordPress Core

Opened 8 days ago

Closed 8 days ago

Last modified 8 days ago

#51557 closed task (blessed) (fixed)

Modernize: use explicit visibility for property declarations

Reported by: jrf Owned by: SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: minor Version: trunk
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 8 days 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.


8 days ago

  • 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
8 days ago

Fixes all known instances of this issue

#2 @jrf
8 days ago

  • Keywords has-unit-tests removed

#3 @SergeyBiryukov
8 days ago

Previously: #22234

#4 @SergeyBiryukov
8 days 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
8 days 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 ;-)

#6 @prbot
8 days ago

jrfnl commented on PR #614:

Closing as committed.

Note: See TracTickets for help on using tickets.