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,44 @@
<?php

namespace Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Fixture;

use Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Source\ParentTestCase;

final class ShouldNotRemoveComments extends ParentTestCase
{
public function provideData(): array
{
// Let's pretend that this comment is extremely important and meaningful.
// It should not be removed by Rector.
return [
// This is yet another comment.
['item1'],

// And a final one.
['item2'],
];
}
}

?>
-----
<?php

namespace Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Fixture;

use Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Source\ParentTestCase;

final class ShouldNotRemoveComments extends ParentTestCase
{
// Let's pretend that this comment is extremely important and meaningful.
// It should not be removed by Rector.
public function provideData(): \Iterator
{
// This is yet another comment.
yield ['item1'];
// And a final one.
yield ['item2'];
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Fixture;

use Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Source\ParentTestCase;

final class ShouldNotRemoveComment extends ParentTestCase
{
public function provideData(): array
{
/**
* @todo Let's pretend that this comment is extremely important and meaningful.
*
* It should not be removed by Rector.
*/
return [
/**
* @todo Yet another important comment
*/
['item1'],
/**
* @todo One final important comment
*/
['item2']
];
}
}

?>
-----
<?php

namespace Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Fixture;

use Rector\CodingStyle\Tests\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector\Source\ParentTestCase;

final class ShouldNotRemoveComment extends ParentTestCase
{
/**
* @todo Let's pretend that this comment is extremely important and meaningful.
*
* It should not be removed by Rector.
*/
public function provideData(): \Iterator
{
/**
* @todo Yet another important comment
*/
yield ['item1'];
/**
* @todo One final important comment
*/
yield ['item2'];
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public function provideDataForTest(): Iterator
yield [__DIR__ . '/Fixture/fixture3.php.inc'];
yield [__DIR__ . '/Fixture/fixture4.php.inc'];
yield [__DIR__ . '/Fixture/data_provider.php.inc'];
yield [__DIR__ . '/Fixture/should_not_remove_comments.php.inc'];
yield [__DIR__ . '/Fixture/should_not_remove_doc_blocks.php.inc'];
}

/**
Expand Down