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

[make:entity] managing keyword prefixes (is, has) for boolean properties getters #1493

Merged
merged 10 commits into from Mar 27, 2024

Conversation

ClemRiviere
Copy link
Contributor

  • Refactoring the getter prefixes for make:entity
  • Introducing exceptions for boolean fields : not adding the prefix to getter name if field begins with "is" or "has"

Related to #1492

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

This change makes sense to me. It's consistent with the autodetection of the type (boolean) when asking for the type.
I'd suggest doing the same for setters, but only for the "is" prefix: isInternational property => setInternational. (but hasColor => setHasColor)

src/Util/ClassSourceManipulator.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@jrushlow jrushlow left a comment

Choose a reason for hiding this comment

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

This looks pretty good @ClemRiviere! - 1 minor comment. Also if you're up for doing the same for addSetter() as @nicolas-grekas suggested, that would be even more awesome!

src/Util/ClassSourceManipulator.php Outdated Show resolved Hide resolved
@jrushlow jrushlow added Feature New Feature Status: Needs Work Additional work is needed labels Mar 27, 2024
Copy link
Collaborator

@jrushlow jrushlow left a comment

Choose a reason for hiding this comment

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

Thanks @ClemRiviere!

@jrushlow jrushlow added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Work Additional work is needed labels Mar 27, 2024
@jrushlow jrushlow merged commit 876c779 into symfony:main Mar 27, 2024
6 checks passed
@ClemRiviere ClemRiviere deleted the 1492_boolean_getter_prefix branch April 2, 2024 08:27
@jrushlow jrushlow mentioned this pull request Apr 5, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants