Skip to content
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

Enable ModernClassNameReference sniff #78

Merged
merged 1 commit into from
Aug 31, 2018

Conversation

Majkl578
Copy link
Contributor

The following function calls (or legacy constant) are replaced by their respective constant equivalents:

  • __CLASS__ becomes self::class
  • get_parent_class() becomes parent::class
  • get_called_class() becomes static::class
  • get_class() becomes self::class
  • get_class($this) becomes static::class

There are some issues fixed in Slevomat CS 4.7.1-4.7.2, one more edge case will be fixed in 4.7.3.
Should be ok to land already.

@Majkl578 Majkl578 added this to the 5.0.0 milestone Aug 31, 2018
@Majkl578 Majkl578 requested a review from a team as a code owner August 31, 2018 13:42
Copy link
Member

@ostrolucky ostrolucky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_class($this) becomes static::class

This is wrong in your PR message, but I see tests don't reflect that

@Majkl578
Copy link
Contributor Author

@ostrolucky

This is wrong in your PR message

What's wrong there? I think it's correct. https://3v4l.org/cD9Ml

@ostrolucky
Copy link
Member

Ah yes I've read that wrong. Carry on 👍

@Ocramius
Copy link
Member

🚢

@Ocramius Ocramius merged commit b4cd962 into master Aug 31, 2018
@Ocramius Ocramius deleted the sniff/ModernClassNameReferenceSniff branch August 31, 2018 14:50
@Ocramius Ocramius self-assigned this Aug 31, 2018
@carusogabriel
Copy link
Contributor

Just for the record: this was a speed improve performance: https://belineperspectives.com/2017/03/13/get_classthis-vs-staticclass/

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

Successfully merging this pull request may close these issues.

None yet

6 participants