if (! $this->isObjectType($node->class, new ObjectType('PHPUnit\Framework\TestCase'))) {
return null;
}
Because we already check if we are in test case on line 73 if (! $this->testsNodeAnalyzer->isInTestClass($node)) { and i thought it was unnecessary to do this extra check.
And i got
src/Rector/Class_/PreferPHPUnitThisCallRector.php:72
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- '#Cognitive complexity for "Rector\\PHPUnit\\Rector\\Class_\\PreferPHPUnitThisCallRector\:\:refactor\(\)" is 11, keep it under 10#'
This should fix: https://github.com/rectorphp/rector-phpunit/pull/194#discussion_r1234849677
I removed:
Because we already check if we are in test case on line 73
if (! $this->testsNodeAnalyzer->isInTestClass($node)) {
and i thought it was unnecessary to do this extra check. And i gotfrom PHPStan