WordPress / WordPress/WordPress-Coding-Standards

Support checking for methods in addition to functions

Open
#731 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

As these are methods, not functions, I can imagine we might need a separate AbstractMethodsSniff / DeprecatedMethodsSniff to deal with this or alternatively, the existing AbstractFunctionRestrictionsSniff could be adjusted to make the distinction between methods and functions.
By @jrfnl https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/633#discussion_r91864236

These methods are deprecated and would need to be checked.

WP_Filesystem_Base::find_base_dir(); // Bad, use WP_Filesystem::abspath instead.
WP_Filesystem_Base::get_base_dir(); // Bad, use WP_Filesystem::abspath instead.
WP_Widget_Recent_Comments::flush_widget_cache();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading AbstractFunctionRestrictionsSniff and the discussion linked in the issue to understand how function restrictions are currently handled. Decide whether method checks belong there or in a separate sniff, then verify that the three listed deprecated methods are reported by tests; no test path is provided in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.