Skip to content

[RFC] Renaming the stdClass to StdClass #4641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

[RFC] Renaming the stdClass to StdClass #4641

wants to merge 3 commits into from

Conversation

SerafimArts
Copy link
Contributor

@SerafimArts SerafimArts commented Aug 28, 2019

This PR proposes renaming stdClass to StdClass.

Reasons

If we consider the standard PHP API, the current stdClass is the only one that does not meet the class naming specifications... I can’t remember a single one that would recommend writing class names with a lowercase letter.

  • Such a change name of stdClass to StdClass will improve the code base consistency.

Against

  • PHP is case-insensitive in class naming, so the name new StdClass() inside any user's code can be used instead.
  • This change that only superficially improves consistency, but affects backward compatibility.

BC

I assume that this change could break some codebase of tests that are based on the var_dump output or any other rather strange comparisons (like: get_class($obj) === 'stdClass').

Is this a potentially useful PR/RFC and does it make sense to test popular packages that will be affected?

@SerafimArts SerafimArts changed the title [RFC] Renamed the stdClass to StdClass [RFC] Renaming the stdClass to StdClass Aug 28, 2019
@KalleZ
Copy link
Member

KalleZ commented Aug 28, 2019

I don't see the gain here in breaking backwards compatibility when you can already write:

$obj = new StdClass;

It is against the defined coding standards, but the gain versus the potential breakage here for just using a different set of capitalized letters is low to none here.

If you wish to make an RFC for it, then please go ahead and follow the wiki instructions.

@SerafimArts
Copy link
Contributor Author

SerafimArts commented Aug 28, 2019

I don't see the gain here in breaking backwards compatibility when you can already write:

Yes, I have already added this to the arguments "against". But I think this is a permissible change in major PHP 8

If you wish to make an RFC for it, then please go ahead and follow the wiki instructions.

I can’t take advantage of the existing registration process described in wiki 2.1 (https://wiki.php.net/rfc/howto), because I get an error message in response: "That wasn't the answer we were expecting".

That's why I decided to get the RFC here, along with the patch.

@KalleZ
Copy link
Member

KalleZ commented Aug 28, 2019

After looking at the wording on both the howto page and the registration, I agree it is a bit vague, but the answer you are looking for on the registration is found in the first section on the howto page

@SerafimArts
Copy link
Contributor Author

SerafimArts commented Aug 28, 2019

@KalleZ Well, you are really right. I really had to start with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants