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

Describe rules on using @var #11

Open
PauliusMacernis opened this issue Nov 6, 2019 · 0 comments
Open

Describe rules on using @var #11

PauliusMacernis opened this issue Nov 6, 2019 · 0 comments
Labels
question Further information is requested rule Issues related to adding/removing/changing code standard rules

Comments

@PauliusMacernis
Copy link
Member

Should we use @var for referring to abstractions only (refer to SOLID for more info)
or should we use @var for referring to regular classes too?

Few cases may be discussed:

  1. Foo class implements Foo interface. Foo class is the only class implementing the Foo interface. Now we want to use @var to say the property of class X is Foo.
  2. Foo and Bar classes (both) implement Foo interface. Now we want to use @var to say the property of class X is Foo.
  3. Foo class do not implement any interface and it is in vendors (a module of third party we use in our project...). Now we want to use @var to say the property of class X is Foo.
  4. Foo class implements Foo interface, Bar class implements Bar interface. Also, Foo and Bar interfaces (both) extends Baz interface. Now we want to use @var to say the property of class X is Foo or Bar.
  5. Same as 4 but we want to use @var to say the property of class X is Baz.
  6. Consider describing @var usage outside of the class property scope too. For example, in certain places where additional temp variable is created inside the method to deal with the upcoming logic. For example, ORM query returns a specific object while the query return type is "mixed". In this kind of situation we would like to use @var to say it is Foo object.

Please consider IDE support when deciding. For example, we want IDE to provide the methods used, quickly jump to the implementations, etc.

@PauliusMacernis PauliusMacernis added question Further information is requested rule Issues related to adding/removing/changing code standard rules labels Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested rule Issues related to adding/removing/changing code standard rules
Projects
None yet
Development

No branches or pull requests

1 participant