-
Notifications
You must be signed in to change notification settings - Fork 63
[PHPUnit12] Add AssertIsTypeMethodCallRector
#508
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
[PHPUnit12] Add AssertIsTypeMethodCallRector
#508
Conversation
|
After wanting to continue with the @samsonasik Do you have a preference? |
| $this->assertThat(1, $this->isType('int')); | ||
| $this->assertThat(1, $this->isType('integer')); | ||
| $this->assertThat([], $this->isType('iterable')); | ||
| $this->assertThat(null, $this->isType('null')); |
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.
I wonder if we can have another rule that would simply use exact assert method:
-$this->assertThat($value, $this->isType('null'));
+$this->assertNull($value);E.g. in phpunit code quality set. Much more readable and direct.
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.
I get your point but for this specific rector rule fixture, it makes sense to keep it like this to keep the fixture code somewhat "useful" instead of just calling the relevant methods and doing nothing with the return type.
Also see PHPUnit's test cases for these methods which are the exact same https://github.com/sebastianbergmann/phpunit/blob/a561bbf7dd850c1bef4f8db7230ffa68ca6797af/tests/unit/Framework/Assert/assertThatTest.php#L423-L426
But I guess you are talking more about a different rule from this one.
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.
Yes, this is job for next Rector rule :)
|
@mttsch I forgot to merge this. Fixing that. |
No description provided.