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

[CodeQuality] Adds rules for the with and value helpers #175

Merged

Conversation

peterfox
Copy link
Collaborator

@peterfox peterfox commented Feb 5, 2024

Changes

  • Adds a rule for removing redundant with() helper usage
  • Adds a rule for removing redundant value() helper usage
  • Adds tests for both new rules
  • Updates rule list

Why

Based on rules from Larastan. These are quite simple little use cases where we can remove the use of a helper when it's not needed.

-value(new Object())->something();
+(new Object())->something();

-with(new Object())->something();
+(new Object())->something();

value() => https://github.com/larastan/larastan/blob/2.x/src/Rules/UselessConstructs/NoUselessValueFunctionCallsRule.php
with() => https://github.com/larastan/larastan/blob/2.x/src/Rules/UselessConstructs/NoUselessWithFunctionCallsRule.php

@GeniJaho GeniJaho merged commit 4d9188b into driftingly:main Feb 5, 2024
5 checks passed
@driftingly
Copy link
Owner

Thanks @peterfox 🙌

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.

3 participants