Skip to content

[New Rule] Getters SHOULD NOT change the state of an object #26

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

Closed
lenaorobei opened this issue Jan 31, 2019 · 1 comment
Closed

[New Rule] Getters SHOULD NOT change the state of an object #26

lenaorobei opened this issue Jan 31, 2019 · 1 comment
Assignees
Labels
accepted New rule is accepted event: MageTestFest2019 MageTestFest contributions false positive Rule causes false positive findings need to discuss Rule requires discussion new rule New feature implementation technical guidelines The rule is based on Magento Technical Guidelines

Comments

@lenaorobei
Copy link
Contributor

lenaorobei commented Jan 31, 2019

Rule

Getters SHOULD NOT change the state of an object.

Reason

Source: Magento Technical Guidelines.

Implementation

Check if method name starts with get and find class member assignment operation inside this method.

<severity>8</severity>
<type>warning</type>
@lenaorobei lenaorobei added proposal New rule proposal new rule New feature implementation technical guidelines The rule is based on Magento Technical Guidelines labels Jan 31, 2019
@paliarush paliarush added accepted New rule is accepted and removed proposal New rule proposal labels Jan 31, 2019
@larsroettig larsroettig self-assigned this Mar 4, 2019
@lenaorobei lenaorobei added the event: MageTestFest2019 MageTestFest contributions label Mar 8, 2019
@larsroettig larsroettig added the false positive Rule causes false positive findings label Mar 16, 2019
@larsroettig
Copy link
Member

Hi @paliarush and @lenaorobei,
I think we get too many false positives it is very hard to Implementing this with tokens maybe with phpstan it is possible to implement this check.

@larsroettig larsroettig added the need to discuss Rule requires discussion label Mar 16, 2019
magento-devops-reposync-svc pushed a commit that referenced this issue Aug 24, 2021
…-coding-standard-220

[Imported] Fix ImportsFromTestNamespace from lock on group use with trailing comma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted New rule is accepted event: MageTestFest2019 MageTestFest contributions false positive Rule causes false positive findings need to discuss Rule requires discussion new rule New feature implementation technical guidelines The rule is based on Magento Technical Guidelines
Projects
None yet
Development

No branches or pull requests

3 participants