mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 08:20:53 +00:00
move FunctionToStaticMethodRector to Transform (#5613)
This commit is contained in:
parent
cfd0b526d2
commit
19810c2b9a
|
@ -7565,7 +7565,7 @@ Change singleton class to normal class that can be registered as a service
|
|||
|
||||
Change functions to static calls, so composer can autoload them
|
||||
|
||||
- class: `Rector\Legacy\Rector\FileWithoutNamespace\FunctionToStaticMethodRector`
|
||||
- class: `Rector\Transform\Rector\FileWithoutNamespace\FunctionToStaticMethodRector`
|
||||
|
||||
```diff
|
||||
-function some_function()
|
||||
|
|
|
@ -61,7 +61,9 @@ foreach ($items as $item) {
|
|||
return false;
|
||||
CODE_SAMPLE
|
||||
,
|
||||
'in_array("something", $items, true);'
|
||||
<<<'CODE_SAMPLE'
|
||||
return in_array('something', $items, true);
|
||||
CODE_SAMPLE
|
||||
),
|
||||
]
|
||||
);
|
||||
|
|
|
@ -60,7 +60,7 @@ final class SomeClass
|
|||
{
|
||||
private $value;
|
||||
|
||||
public function __construct($value)
|
||||
public function __construct(stdClass $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ final class SomeClass
|
|||
{
|
||||
private $value;
|
||||
|
||||
public function __construct($value)
|
||||
public function __construct(stdClass $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Legacy\Rector\FileWithoutNamespace;
|
||||
namespace Rector\Transform\Rector\FileWithoutNamespace;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -22,7 +22,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
/**
|
||||
* @see \Rector\Legacy\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\FunctionToStaticMethodRectorTest
|
||||
* @see \Rector\Transform\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\FunctionToStaticMethodRectorTest
|
||||
*/
|
||||
final class FunctionToStaticMethodRector extends AbstractRector
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Legacy\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\Fixture;
|
||||
namespace Rector\Transform\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\Fixture;
|
||||
|
||||
function first_static_function()
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ $value = first_static_function();
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Legacy\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\Fixture;
|
||||
namespace Rector\Transform\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\Fixture;
|
||||
|
||||
$value = %sStaticFunctions::firstStaticFunction();
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Legacy\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector;
|
||||
namespace Rector\Transform\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Legacy\Rector\FileWithoutNamespace\FunctionToStaticMethodRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Transform\Rector\FileWithoutNamespace\FunctionToStaticMethodRector;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class FunctionToStaticMethodRectorTest extends AbstractRectorTestCase
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Legacy\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\Fixture;
|
||||
namespace Rector\Transform\Tests\Rector\FileWithoutNamespace\FunctionToStaticMethodRector\Fixture;
|
||||
|
||||
final class StaticFunctions
|
||||
{
|
Loading…
Reference in New Issue
Block a user