[PHPUnit12] Add AssertIsTypeMethodCallRector#508
[PHPUnit12] Add AssertIsTypeMethodCallRector#508TomasVotruba merged 2 commits intorectorphp:mainfrom
AssertIsTypeMethodCallRector#508Conversation
|
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.
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.
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.
Yes, this is job for next Rector rule :)
|
@mttsch I forgot to merge this. Fixing that. |
No description provided.