Skip to content

Commit d38ce7a

Browse files
committed
fix review comments
1 parent 813245b commit d38ce7a

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ It also contains this strict framework-specific rules (can be enabled separately
2424
* Check that you are not using `assertSame()` with `count($variable)` as second parameter. `assertCount($variable)` should be used instead.
2525
* Check that you are not using `assertEquals()` with same types (`assertSame()` should be used)
2626
* Check that you are not using `assertNotEquals()` with same types (`assertNotSame()` should be used)
27-
* When PHPStan Strict Rules' `disallowedEmpty` rule is enabled, disallow PHPUnit's `assertEmpty()` and `assertNotEmpty()` assertions as well.
27+
* If PHPStan Strict Rules are enabled, PHPUnit's `assertEmpty()` and `assertNotEmpty()` assertions are disallowed as well.
2828

2929
## How to document mock objects in phpDocs?
3030

‎src/Rules/PHPUnit/AssertEmptyIsDiscouragedRule.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public function getNodeType(): string
2727

2828
public function processNode(Node $node, Scope $scope): array
2929
{
30-
if ($node->isFirstClassCallable() || count($node->getArgs()) < 1) {
30+
if (!($node instanceof MethodCall) && !($node instanceof StaticCall)) {
3131
return [];
3232
}
3333

34-
if (!($node instanceof MethodCall) && !($node instanceof StaticCall)) {
34+
if ($node->isFirstClassCallable() || count($node->getArgs()) < 1) {
3535
return [];
3636
}
3737

‎tests/Rules/PHPUnit/data/assert-empty-is-discouraged.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
final class AssertEmptyTest extends TestCase
99
{
1010

11-
public function test(): void
11+
public function test(string $bar): void
1212
{
1313
$this->assertEmpty([]);
1414
$this->assertNotEmpty([1]);
1515
Assert::assertEmpty([]);
1616
static::assertNotEmpty([1]);
17+
static::assertSame('foo', $bar);
18+
static::assertEquals(1, '1');
1719
}
1820

1921
}

0 commit comments

Comments
 (0)