mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 14:27:14 +01:00
rename issue 2863 to CommentPreserving
This commit is contained in:
parent
574de08dfa
commit
9a75aaa4b9
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue2863\Fixture;
|
||||
|
||||
class Fixture2863KeepComment
|
||||
{
|
||||
public function foo($foo)
|
||||
{
|
||||
//thiscommentshouldnotberemoved
|
||||
return $foo;
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue2863\Fixture;
|
||||
|
||||
class Fixture2863KeepSpace
|
||||
{
|
||||
public function bar($bar)
|
||||
{
|
||||
// @var string $bar['should_not_be_changed]
|
||||
|
||||
return $bar['should_not_be_changed'];
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
parameters:
|
||||
sets:
|
||||
- "dead-code"
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3222\Fixture;
|
||||
|
||||
/**
|
||||
* This docblock is being deleted when there's an empty docblock after it.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
final class Fixture3222
|
||||
{
|
||||
private $eventDispatcher;
|
||||
|
||||
public function __construct(EventDispatcher $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3222\Fixture;
|
||||
|
||||
/**
|
||||
* This docblock is being deleted when there's an empty docblock after it.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
final class Fixture3222
|
||||
{
|
||||
private \Rector\Core\Tests\Issues\Issue3222\Fixture\EventDispatcher $eventDispatcher;
|
||||
|
||||
public function __construct(EventDispatcher $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3222\Fixture;
|
||||
|
||||
/**
|
||||
* The empty line after this docblock is being deleted.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Another dockblock.
|
||||
*
|
||||
*
|
||||
* first_function()
|
||||
*
|
||||
*
|
||||
* second_function()
|
||||
* third_function()
|
||||
* fourth_function()
|
||||
*/
|
||||
|
||||
final class Fixture3222WithManyComments
|
||||
{
|
||||
private $eventDispatcher;
|
||||
|
||||
public function __construct(EventDispatcher $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3222\Fixture;
|
||||
|
||||
/**
|
||||
* The empty line after this docblock is being deleted.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Another dockblock.
|
||||
*
|
||||
*
|
||||
* first_function()
|
||||
*
|
||||
*
|
||||
* second_function()
|
||||
* third_function()
|
||||
* fourth_function()
|
||||
*/
|
||||
|
||||
final class Fixture3222WithManyComments
|
||||
{
|
||||
private \Rector\Core\Tests\Issues\Issue3222\Fixture\EventDispatcher $eventDispatcher;
|
||||
|
||||
public function __construct(EventDispatcher $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue3222;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class Issue3222Test extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function provideConfig(): string
|
||||
{
|
||||
return __DIR__ . '/config3222.yaml';
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
services:
|
||||
Rector\Php74\Rector\Property\TypedPropertyRector: null
|
@ -2,13 +2,14 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue2863;
|
||||
namespace Rector\Core\Tests\PhpParser\Printer\CommentPreserving;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Php74\Rector\Property\TypedPropertyRector;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class Issue2863Test extends AbstractRectorTestCase
|
||||
final class CommentPreservingTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
@ -23,8 +24,8 @@ final class Issue2863Test extends AbstractRectorTestCase
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function provideConfig(): string
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return __DIR__ . '/config2863.yaml';
|
||||
return TypedPropertyRector::class;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Fixture;
|
||||
|
||||
use Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Source\LocalEventDispatcher;
|
||||
|
||||
/**
|
||||
* This docblock is being deleted when there's an empty docblock after it.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Another dockblock.
|
||||
*
|
||||
*
|
||||
* first_function()
|
||||
*
|
||||
*
|
||||
* second_function()
|
||||
* third_function()
|
||||
* fourth_function()
|
||||
*/
|
||||
|
||||
final class CommentsForTypedProperty
|
||||
{
|
||||
private $eventDispatcher;
|
||||
|
||||
public function __construct(LocalEventDispatcher $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Fixture;
|
||||
|
||||
use Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Source\LocalEventDispatcher;
|
||||
|
||||
/**
|
||||
* This docblock is being deleted when there's an empty docblock after it.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Another dockblock.
|
||||
*
|
||||
*
|
||||
* first_function()
|
||||
*
|
||||
*
|
||||
* second_function()
|
||||
* third_function()
|
||||
* fourth_function()
|
||||
*/
|
||||
|
||||
final class CommentsForTypedProperty
|
||||
{
|
||||
private \Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Source\LocalEventDispatcher $eventDispatcher;
|
||||
|
||||
public function __construct(LocalEventDispatcher $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Fixture;
|
||||
|
||||
class KeepComment
|
||||
{
|
||||
public function foo($foo)
|
||||
{
|
||||
//thiscommentshouldnotberemoved
|
||||
return $foo;
|
||||
}
|
||||
|
||||
public function bar($bar)
|
||||
{
|
||||
// @var string $bar['should_not_be_changed]
|
||||
|
||||
return $bar['should_not_be_changed'];
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue2863\Fixture;
|
||||
namespace Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Fixture;
|
||||
|
||||
class Fixture2863KeepDoubleComments
|
||||
class KeepDoubleComments
|
||||
{
|
||||
/*****************************************
|
||||
* should not be removed
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\Tests\Issues\Issue2863\Fixture;
|
||||
namespace Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Fixture;
|
||||
|
||||
class Fixture2863KeepMultilineSingleAsterisk
|
||||
class KeepMultilineSingleAsterisk
|
||||
{
|
||||
public function baz($baz)
|
||||
{
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Tests\PhpParser\Printer\CommentPreserving\Source;
|
||||
|
||||
final class LocalEventDispatcher
|
||||
{
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user