Closed gemal closed 1 year ago
No, because they're not equivalent. assertEquals
is for == false
, but assertFalse
is for === false
.
What about:
$this->assertEquals(null, $test);
to $this->assertNull($test);
and
$this->assertEquals(true, $test);
to $this->assertTrue($test);
and
$this->assertEquals(10, count($test));
to $this->assertCount(10, $test);
would those apply for a pull request?
I'd accept disallowing assertEquals completely and promoting assertSame instead, in phpstan-strict-rules. Similar to what https://github.com/phpstan/phpstan-strict-rules/blob/1.5.x/src/Rules/DisallowedConstructs/DisallowedLooseComparisonRule.php does.
If you rewrite assertEquals about count to assertSame, the existing rule about changing assertSame to assertCount kicks in.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
there is: https://github.com/phpstan/phpstan-phpunit/blob/1.4.x/src/Rules/PHPUnit/AssertSameNullExpectedRule.php
if I made the same for:
assertEquals(false,
and turn it intoassertFalse(
would that be accepted as a pull request?