rfc:consistent-names

PHP RFC: Use alias to provide both legacy and consistent names

Introduction

PHP has been developed about 20 years. Many legacy functions/methods do not comply CODING_STANDARDS “Naming Conventions”.

Inconsistent names are not appealing for new users. Having consistent names would help to assure PHP's attractiveness to learn. Older names should be usable for compatibility.

Both consistency and compatibility is mandatory, aliases may be used.

Proposal

Add CODING_STANDARDS compliant name as default name and add legacy name as alias.

  1. De facto standard names like string operation function (e.g. strcmp()) remains as it is now.
  2. Other names like mb_encode_mimeheader() become alias of mb_encode_mime_header().
  3. Names in question are discussed in internals@lists.php.net
  4. Aliases are not deprecated and should remain at least next 10 years or more.

Backward Incompatible Changes

None.

Proposed PHP Version(s)

5.7 or later

SAPIs Impacted

None

Impact to Existing Extensions

Many extensions would have aliases.

New Constants

There may be constants that may have better names(?)

php.ini Defaults

No php.ini

Open Issues

Decide which names to be “De factt standard”

Proposed Voting Choices

Yes/No

Patches and Tests

It's a simple aliasing.

Implementation

After the project is implemented, this section should contain

  1. the version(s) it was merged to
  2. a link to the git commit(s)
  3. a link to the PHP manual entry for the feature

References

Rejected Features

rfc/consistent-names.txt · Last modified: 2021/03/27 14:32 by ilutov