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

Dedicated static function to parse out mutator name #1331

Merged
merged 7 commits into from Sep 15, 2020

Conversation

sanmai
Copy link
Member

@sanmai sanmai commented Sep 15, 2020

This PR:

  • Adds a dedicated static function to parse out mutator name
  • Covered by tests

$parts = explode('\\', $className);

return (string) end($parts);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Closest place where Mutator::getName() is used.

@sanmai sanmai merged commit d6bd395 into infection:master Sep 15, 2020
@sanmai sanmai deleted the pr/2020-09/GetMutatorName branch September 15, 2020 07:24
@theofidry
Copy link
Member

theofidry commented Sep 16, 2020

Looks a bit weird to me that it's the factory responsible for giving the mutator name (by default) – even more so than an object depends on its external factory IMO

@sanmai
Copy link
Member Author

sanmai commented Sep 16, 2020

It is. Should be easy to refactor. What do you have in mind?

@theofidry
Copy link
Member

What was wrong with how it was before? I saw there was a bunch of PRs so maybe I missed the overall picture

@sanmai
Copy link
Member Author

sanmai commented Sep 17, 2020

It was only an instance method before (still is), but sometimes you want to get a name for a mutator having only a class name for it.

@theofidry
Copy link
Member

Do you have a place where this is the case? I think it would help to understand what's going on because indeed it's a bit tricky

@sanmai
Copy link
Member Author

sanmai commented Sep 17, 2020

Sure, right about here.

@theofidry
Copy link
Member

Replied there

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.

None yet

3 participants