mirror of
https://github.com/rectorphp/rector.git
synced 2024-09-06 15:41:59 +00:00
make MinutesToSecondsInCacheRector vendor code independent
This commit is contained in:
parent
0311a5211f
commit
37868819b8
@ -21,19 +21,24 @@ final class MinutesToSecondsInCacheRector extends AbstractRector
|
||||
/**
|
||||
* @var int[][]
|
||||
*/
|
||||
private $typesToMethods = [
|
||||
'Illuminate\Support\Facades\Cache' => [
|
||||
'put' => 2, // time argument position
|
||||
'add' => 2,
|
||||
],
|
||||
'Illuminate\Contracts\Cache\Store' => [
|
||||
'put' => 2,
|
||||
'putMany' => 1,
|
||||
],
|
||||
'Illuminate\Cache\DynamoDbStore' => [
|
||||
'add' => 2,
|
||||
],
|
||||
];
|
||||
private $typesToMethods = [];
|
||||
|
||||
public function __construct(string $storeClass = 'Illuminate\Contracts\Cache\Store')
|
||||
{
|
||||
$this->typesToMethods = [
|
||||
'Illuminate\Support\Facades\Cache' => [
|
||||
'put' => 2, // time argument position
|
||||
'add' => 2,
|
||||
],
|
||||
$storeClass => [
|
||||
'put' => 2,
|
||||
'putMany' => 1,
|
||||
],
|
||||
'Illuminate\Cache\DynamoDbStore' => [
|
||||
'add' => 2,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getDefinition(): RectorDefinition
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Rector\Laravel\Tests\Rector\StaticCall\MinutesToSecondsInCacheRector;
|
||||
|
||||
use Rector\Laravel\Rector\StaticCall\MinutesToSecondsInCacheRector;
|
||||
use Rector\Laravel\Tests\Rector\StaticCall\MinutesToSecondsInCacheRector\Source\LaravelStoreInterface;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class MinutesToSecondsInCacheRectorTest extends AbstractRectorTestCase
|
||||
@ -16,4 +17,14 @@ final class MinutesToSecondsInCacheRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
return MinutesToSecondsInCacheRector::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]|null
|
||||
*/
|
||||
protected function getRectorConfiguration(): ?array
|
||||
{
|
||||
return [
|
||||
'$storeClass' => LaravelStoreInterface::class, // just for test case
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
namespace Rector\Laravel\Tests\Rector\StaticCall\MinutesToSecondsInCacheRector\Source;
|
||||
|
||||
use Illuminate\Contracts\Cache\Store;
|
||||
|
||||
final class ArrayStore implements Store
|
||||
final class ArrayStore implements LaravelStoreInterface
|
||||
{
|
||||
public function get($key)
|
||||
{
|
||||
|
@ -0,0 +1,8 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Laravel\Tests\Rector\StaticCall\MinutesToSecondsInCacheRector\Source;
|
||||
|
||||
interface LaravelStoreInterface
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user