-
Notifications
You must be signed in to change notification settings - Fork 45
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
Addition of rule for cases better represented with assertSameSize() method #207
base: 1.4.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
this should only be reported with bleeding edge. Use private bool $bleedingEdge
in the rule constructor and add the new behaviour only when this is true. Here's an example how it should look in config: https://github.com/phpstan/phpstan-doctrine/blob/0d967379b8ea58c4f4499b17eeb9f29718350497/rules.neon#L57
Hi, @ondrejmirtes! Thanks for the quick feedback! I'll be sure to use the bleeding edge flag as you suggested. Just hang tight a little longer! Best regards, |
f74e9be
to
bff5e12
Compare
Expanded the AssertSameWithCountRule in PHPUnit rules to handle additional scenarios. Now the rule checks if both sides of the assertSame are counts, and suggests assertSameSize instead when necessary. The modification enhances the rule's applicability and accuracy.
bff5e12
to
3a37222
Compare
I have completed the necessary corrections that were of concern. |
The link in the README file's "bleeding edge" reference has been updated to accurately direct users to the relevant blog post. Also corrected the typo by capitalizing the initial letter of the sentence.
} | ||
|
||
if ( | ||
$right instanceof Node\Expr\MethodCall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH this diff is very messy. I can't tell if the no-bleedingEdge behaviour is preserved or not. Can you split the changes in multiple commits? First extract logic into isCount...
methods without changing the behaviour, and then introduce bleedingEdge-on
behaviour that will be a new separate if
statement. Can you please do that? Thank you.
This Pull Request enhances the AssertSameWithCountRule in PHPUnit to handle additional use cases. The new rule now checks when both sides of the assertSame are counts, and suggests assertSameSize instead when necessary.
Here is some detail on what has changed:
The code changes involve adjustments in method call structures, evaluation of counts and introduction of cases for assertSameSize.