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

Rule Request: typesafe_shorthand_operator #4953

Open
SimplyDanny opened this issue May 1, 2023 · 0 comments
Open

Rule Request: typesafe_shorthand_operator #4953

SimplyDanny opened this issue May 1, 2023 · 0 comments
Labels
rule-request Requests for a new rules.

Comments

@SimplyDanny
Copy link
Collaborator

SimplyDanny commented May 1, 2023

The existing shorthand_operator rule causes false positives for operands that don't support the suggested shorthand operator. Examples have been brought up in #3603, #3643 and #4936. The rule doesn't know anything about the operands' types so such mistakes are unavoidable and must be accepted.

A new typesafe version of shorthand_operator could be added, however, that knows depending on the types of the operands if a shorthand operator is supported or not. It can be based on the existing rule with additional type information at hand.

A similar pair of rules is already available with ArrayInitRule and TypesafeArrayInitRule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

1 participant