Skip to content

Commit 78cde70

Browse files
committed
[CodeQuality] Skip return createMock() on TypeWillReturnCallableArrowFunctionRector
1 parent 84fe73a commit 78cde70

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\Class_\TypeWillReturnCallableArrowFunctionRector\Fixture;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use Symfony\Component\Form\FormInterface;
7+
8+
final class SkipReturnCreateMock extends TestCase
9+
{
10+
public function test($value): void
11+
{
12+
$form = $this->createMock(FormInterface::class);
13+
14+
$form->method('add')
15+
->willReturnCallback(function ($name, $type, $options) use (&$calls) {
16+
$calls[] = compact('name', 'type', 'options');
17+
return $this->createMock(FormInterface::class);
18+
});
19+
}
20+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Symfony\Component\Form;
6+
7+
if (interface_exists('Symfony\Component\Form\FormInterface')) {
8+
return;
9+
}
10+
11+
interface FormInterface
12+
{
13+
public function add(): static;
14+
}

0 commit comments

Comments
 (0)