Automattic / Automattic/custom-metadata

Rename underscore-prefixed methods and properties

Open
#156 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
PHP
Stars
190
Forks
46
Avg merge
46m
Merged PRs (30d)
15

Description

Split out from the coding-standards cleanup (#147).

The `custom_metadata_manager` class uses a legacy pseudo-private convention of underscore-prefixed method and property names (e.g. `_validate_metadata_field()`, `_display_post_metadata_box()`, `$_non_post_types`). PSR-2 disallows this, and the cleanup PR suppresses `PSR2.Methods.MethodDeclaration.Underscore` and `PSR2.Classes.PropertyDeclaration.Underscore` for `custom_metadata.php` rather than renaming, because renaming is a breaking change: several of these methods are registered as hook callbacks by string, and the names are part of the class's public surface.

This issue tracks doing that rename properly in a dedicated PR — updating every definition, every `$this->_x` reference, and the hook-callback strings together, verified by the test suite — after which the two suppressions can be removed.

Contributor guide

Open the contributing guide

Research direction

Start in custom_metadata.php by locating the custom_metadata_manager definitions, the $this->_ references, and hook-callback strings named in the issue. Update all definitions and references together, run the test suite, and confirm the PSR2 underscore suppressions can be removed without breaking callbacks or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.