WordPress / WordPress/WordPress-Coding-Standards

Warn about using alias functions

Open
#1,966 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem?

Core recently replaced alias functions with their canonical counterparts in r49193:

Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:

join() with implode()
sizeof() with count()
is_writeable() with is_writable()
doubleval() with a (float) cast

That hasn't been formalized in a sniff yet, so new instances can be added to the codebase, like in r49803 (see ticket:51056#comment:16.

Describe the solution you'd like

Calls to join(), sizeof(), is_writeable(), and doubleval() could produce a warning, and let ask devs to use the canonical counterpart.

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

No implementation files or tests are named; begin by locating the PHP_CodeSniffer sniff and its test fixtures that handle function calls. Done means calls to join(), sizeof(), is_writeable(), and doubleval() warn with their canonical alternatives, with coverage for each case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.