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 to avoid keyword self #8

Closed
GuySartorelli opened this issue Jun 16, 2024 · 0 comments
Closed

Rule to avoid keyword self #8

GuySartorelli opened this issue Jun 16, 2024 · 0 comments

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Jun 16, 2024

We've recently updated our coding standards to avoid using self.

We should add a linting rule that enforces this and fails if self is used.
There is a documented exception to this with traits.

Acceptance criteria

  • Outside of traits, any use of the keyword self results in CI failure
  • In traits, self is only directly used to get the class name, const values, or as type hints. For everything else, self::class is used first, e.g. self::class::myMethod()

PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants