Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\AddReturnDocblockDataProviderRector\Fixture;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class SkipAlreadySetType extends TestCase
{
#[DataProvider('provideData')]
public function testSomething()
{
}

/**
* @return \Generator<array<int, array{0: string, 1: string}>>
*/
public static function provideData(): \Generator
{
yield ['data1', 'data2'];
yield ['item4', 'item5'];
}

#[DataProvider('provideDataNext')]
public function testSomethingElse()
{
}

/**
* @return \Iterator<array<int, array{0: string, 1: string}>>
*/
public static function provideDataNext(): \Iterator
{
yield ['data1', 'data2'];
yield ['item4', 'item5'];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\AddReturnDocblockDataProviderRector\Fixture;

use Nette\Utils\FileSystem;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class UnionSameArrayType extends TestCase
{
#[DataProvider('provideData')]
public function testSomething()
{
}

public static function provideData(): \Iterator
{
yield ['...', __DIR__ . '/Source/expected/expected.txt'];
yield ["-old\n+new", __DIR__ . '/Source/expected/expected_old_new.txt'];

yield [
FileSystem::read('...'),
__DIR__ . '/Fixture/expected_with_full_diff_by_phpunit.diff',
];
}
}

?>
-----
<?php

namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\AddReturnDocblockDataProviderRector\Fixture;

use Nette\Utils\FileSystem;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

final class UnionSameArrayType extends TestCase
{
#[DataProvider('provideData')]
public function testSomething()
{
}

/**
* @return \Iterator<array<int, string>>
*/
public static function provideData(): \Iterator
{
yield ['...', __DIR__ . '/Source/expected/expected.txt'];
yield ["-old\n+new", __DIR__ . '/Source/expected/expected_old_new.txt'];

yield [
FileSystem::read('...'),
__DIR__ . '/Fixture/expected_with_full_diff_by_phpunit.diff',
];
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public function test(string $docFilePath): void
$this->assertSame($docComment, $printedPhpDocInfo);
}

/**
* @return Iterator<array<int, string>>
*/
public static function provideData(): Iterator
{
yield [__DIR__ . '/Source/Multiline/multiline2.txt'];
Expand Down
3 changes: 3 additions & 0 deletions tests/Console/Formatter/ColorConsoleDiffFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function test(string $content, string $expectedFormattedFileContent): voi
$this->assertStringEqualsFile($expectedFormattedFileContent, $formattedContent);
}

/**
* @return Iterator<array<int, string>>
*/
public static function provideData(): Iterator
{
yield ['...', __DIR__ . '/Source/expected/expected.txt'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public function testMainConfigValues(string $configFile, array $expectedConfigur
$this->assertSame($expectedConfiguration, $renamedClassesDataCollector->getOldToNewClasses());
}

/**
* @return Iterator<(array<int, array<string, string>>|array<int, string>)>
*/
public static function provideData(): Iterator
{
yield [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function test(string $file, int $nodePosition, ObjectType $expectedObject
$this->assertSame($expectedObjectType->getClassName(), $resolvedType->getClassName());
}

/**
* @return Iterator<array<int, (int|ObjectType|string)>>
*/
public static function dataProvider(): Iterator
{
yield [
Expand Down
Loading