-
-
Notifications
You must be signed in to change notification settings - Fork 739
Incorrect behavior of DataProviderArrayItemsNewLinedRector #9689
Copy link
Copy link
Closed
rectorphp/rector-phpunit
#664Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | v2.3.8 |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/74dc9db5-9d81-42d6-9d0e-5a8bdcc1c6dc
<?php
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
final class ImporterTest extends TestCase
{
#[Test]
public function severalQueries(): void
{
$importer = self::createMock(Importer::class);
$importer->expects($invokedCount)
->method('processFiles')
->willReturnCallback(function (array $parameters) use ($invokedCount): array {
switch ($invokedCount->numberOfInvocations()) {
case 1:
self::assertSame(range(1, 250), $parameters);
return [233, [], []];
case 2:
self::assertSame(range(251, 500), $parameters);
return [15, [], []];
default:
throw new \OutOfBoundsException('Did not expect this to run thrice.');
}
});
}
}Responsible rules
DataProviderArrayItemsNewLinedRector
Expected Behavior
No changes, as I'm not building a dataprovider, but a test here.
Reactions are currently unavailable