Skip to content

Use class constants instead of strings for 'generic' and 'genericmessage' #1074

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

Merged
merged 2 commits into from
Apr 13, 2020
Merged

Use class constants instead of strings for 'generic' and 'genericmessage' #1074

merged 2 commits into from
Apr 13, 2020

Conversation

1int
Copy link
Contributor

@1int 1int commented Apr 13, 2020

Summary

This is a trivial change so I decided not to make an issue for it.

This PR replaces occurrences of 'generic' and 'genericmessage' with class constants to improve code clarity and prevent typos. Having class constants with proper comments also helps understand the expected behaviour.

@noplanman noplanman changed the base branch from master to develop April 13, 2020 09:24
@noplanman
Copy link
Member

Thanks, hadn't thought of that!

I do think however, that it makes more sense to use GENERIC_COMMAND instead of FALLBACK_COMMAND, because fallback could mean anything.

Also, please add a short entry in the changelog in the Unreleased - Added section, thanks.

@1int
Copy link
Contributor Author

1int commented Apr 13, 2020

Yeah I was doubting between GENERIC_COMMAND and FALLBACK_COMMAND myself :)
I chose FALLBACK_COMMAND because I think it reflects the point of that command better — if nothing else suits, fall back to this.

Ok, I'll make these changes today. Cheers!

@1int
Copy link
Contributor Author

1int commented Apr 13, 2020

Updated

Copy link
Member

@noplanman noplanman left a comment

Choose a reason for hiding this comment

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

Perfect, thanks!

@noplanman noplanman merged commit 5f1afb0 into php-telegram-bot:develop Apr 13, 2020
@1int
Copy link
Contributor Author

1int commented Apr 13, 2020

@noplanman hey, I also thought that now that there're constants it would possibly be good to rename 'genericmessage' to 'genericMessage' camel-case? Then you could have more consistent naming with GenericMessageCommand instead of GenericmessageCommand.

I can make another PR if you think it makes sense.

@noplanman
Copy link
Member

The whole command system is quite complex and needs a rewrite in general, so I think it makes sense to leave it as is for the moment, but thanks so much for the suggestion!

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