Skip to content

Commit

Permalink
fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Apr 28, 2019
1 parent 6c3c75c commit 3c2ff06
Show file tree
Hide file tree
Showing 84 changed files with 494 additions and 385 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ protected function getRectorClass(): string
protected function getRectorConfiguration(): array
{
return [
SomeModelType::class => [
'config' => [
'get' => 'getConfig',
'minimal_argument_count' => 2,
'first_argument_type_to_set' => 'array',
'$methodNamesByTypes' => [
SomeModelType::class => [
'config' => [
'get' => 'getConfig',
'minimal_argument_count' => 2,
'first_argument_type_to_set' => 'array',
],
'customMethod' => [
'get' => 'customMethodGetName',
'set' => 'customMethodSetName',
'minimal_argument_count' => 2,
'first_argument_type_to_set' => 'array',
],
'method' => null,
],
'customMethod' => [
'get' => 'customMethodGetName',
'set' => 'customMethodSetName',
'minimal_argument_count' => 2,
'first_argument_type_to_set' => 'array',
],
'method' => null,
],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ final class ReturnArrayClassMethodToYieldRector extends AbstractRector
* @param string[][] $methodsByType
*/
public function __construct(
array $methodsByType = [],
NodeTransformer $nodeTransformer,
DocBlockManipulator $docBlockManipulator
DocBlockManipulator $docBlockManipulator,
array $methodsByType = []
) {
$this->methodsByType = $methodsByType;
$this->nodeTransformer = $nodeTransformer;
$this->docBlockManipulator = $docBlockManipulator;
$this->methodsByType = $methodsByType;
}

public function getDefinition(): RectorDefinition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class YieldClassMethodToArrayClassMethodRector extends AbstractRector
/**
* @param string[][] $methodsByType
*/
public function __construct(array $methodsByType = [], NodeTransformer $nodeTransformer)
public function __construct(NodeTransformer $nodeTransformer, array $methodsByType = [])
{
$this->methodsByType = $methodsByType;
$this->nodeTransformer = $nodeTransformer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ protected function getRectorClass(): string
}

/**
* @return string[]
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
return [
EventSubscriberInterface::class => ['getSubscribedEvents'],
ParentTestCase::class => ['#(provide|dataProvider)*#'],
'$methodsByType' => [
EventSubscriberInterface::class => ['getSubscribedEvents'],
ParentTestCase::class => ['#(provide|dataProvider)*#'],
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ protected function getRectorClass(): string
}

/**
* @return string[]
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
return [
EventSubscriberInterface::class => ['getSubscribedEvents'],
'$methodsByType' => [
EventSubscriberInterface::class => ['getSubscribedEvents'],
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@

final class ObjectToScalarDocBlockRector extends AbstractObjectToScalarRector
{
/**
* @param string[] $valueObjectsToSimpleTypes
*/
public function __construct(array $valueObjectsToSimpleTypes = [])
{
parent::__construct($valueObjectsToSimpleTypes);
}

public function getDefinition(): RectorDefinition
{
return new RectorDefinition('Turns defined value object to simple types in doc blocks', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ protected function getRectorClass(): string
*/
protected function getRectorConfiguration(): array
{
return [SomeValueObject::class => 'string'];
return [
'$valueObjectsToSimpleTypes' => [
SomeValueObject::class => 'string',
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ protected function getRectorClass(): string
*/
protected function getRectorConfiguration(): array
{
return [SomeValueObject::class => 'string'];
return [
'$valueObjectsToSimpleTypes' => [
SomeValueObject::class => 'string',
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

namespace Rector\Jms\Tests\Rector\Property\JmsInjectAnnotationRector;

use Rector\Jms\Rector\Property\JmsInjectAnnotationRector;
use Rector\Symfony\Tests\FrameworkBundle\AbstractToConstructorInjectionRectorSource\SomeKernelClass;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\PackageBuilder\Parameter\ParameterProvider;

final class JmsInjectAnnotationRectorTest extends AbstractRectorTestCase
{
protected function setUp(): void
{
parent::setUp();

$parameterProvider = self::$container->get(ParameterProvider::class);
$parameterProvider->changeParameter('kernel_class', SomeKernelClass::class);
}

public function test(): void
{
$this->doTestFiles([
Expand All @@ -17,8 +28,8 @@ public function test(): void
]);
}

protected function provideConfig(): string
protected function getRectorClass(): string
{
return __DIR__ . '/config.yaml';
return JmsInjectAnnotationRector::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getRectorClass(): string
}

/**
* @return mixed[]|null
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getRectorClass(): string
}

/**
* @return string[]|null
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getRectorClass(): string
}

/**
* @return mixed[]|null
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getRectorClass(): string
}

/**
* @return mixed[]|null
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getRectorClass(): string
}

/**
* @return mixed[]|null
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getRectorClass(): string
}

/**
* @return mixed[]|null
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ protected function getRectorClass(): string
}

/**
* @return string[][]
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
return [
'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
'OLD_CONSTANT' => 'NEW_CONSTANT',
'$oldToNewConstants' => [
'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
'OLD_CONSTANT' => 'NEW_CONSTANT',
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ protected function getRectorClass(): string
}

/**
* @return mixed[]|null
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
return [
'some_function' => [1, 0],
'$newArgumentPositionsByFunctionName' => [
'some_function' => [1, 0],
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ protected function getRectorClass(): string
protected function getRectorConfiguration(): array
{
return [
AbstractTestCase::class => 'self',
BeLocalClass::class => 'this',
'$typeToPreference' => [
AbstractTestCase::class => 'self',
BeLocalClass::class => 'this',
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ protected function getRectorClass(): string
*/
protected function getRectorConfiguration(): array
{
return ['ReservedObject' => 'SmartObject'];
return [
'$reservedKeywordsToReplacements' => [
'ReservedObject' => 'SmartObject',
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ use Rector\PhpSpecToPHPUnit\Tests\Rector\Class_\PhpSpecToPHPUnitRector\Source\Du

class RatesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Provider|\PHPUnit\Framework\MockObject\MockObject
*/
private $provider;
/**
* @var \Rector\PhpSpecToPHPUnit\Tests\Rector\MethodCall\PhpSpecToPHPUnitRector\Fixture\Rates
*/
private $rates;
/**
* @var Provider|\PHPUnit\Framework\MockObject\MockObject
*/
private $provider;
protected function setUp()
{
$this->provider = $this->createMock(Provider::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ use Rector\PhpSpecToPHPUnit\Tests\Rector\Class_\PhpSpecToPHPUnitRector\Source\Du

class CurrencyTest extends \PHPUnit\Framework\TestCase
{
/**
* @var CurrencyData|\PHPUnit\Framework\MockObject\MockObject
*/
private $data;
/**
* @var \Rector\PhpSpecToPHPUnit\Tests\Rector\Class_\PhpSpecToPHPUnitRector\Fixture\Currency
*/
private $currency;
/**
* @var CurrencyData|\PHPUnit\Framework\MockObject\MockObject
*/
private $data;
protected function setUp()
{
$this->data = $this->createMock(CurrencyData::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ use Rector\PhpSpecToPHPUnit\Tests\Rector\Class_\PhpSpecToPHPUnitRector\Source\Du

class MockPropertiesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var OrderFactory|\PHPUnit\Framework\MockObject\MockObject
*/
private $factory;
/**
* @var \Rector\PhpSpecToPHPUnit\Tests\Rector\MethodCall\PhpSpecToPHPUnitRector\Fixture\MockProperties
*/
private $mockProperties;
/**
* @var OrderFactory|\PHPUnit\Framework\MockObject\MockObject
*/
private $factory;
protected function setUp()
{
$this->factory = $this->createMock(OrderFactory::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

use Rector\Testing\PHPUnit\AbstractRectorTestCase;

/**
* @covers \Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecMocksToPHPUnitMocksRector
* @covers \Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecPromisesToPHPUnitAssertRector
*
* @covers \Rector\PhpSpecToPHPUnit\Rector\ClassMethod\PhpSpecMethodToPHPUnitMethodRector
*
* @covers \Rector\PhpSpecToPHPUnit\Rector\Class_\PhpSpecClassToPHPUnitClassRector
* @covers \Rector\PhpSpecToPHPUnit\Rector\Class_\AddMockPropertiesRector
*/
final class PhpSpecToPHPUnitRectorTest extends AbstractRectorTestCase
{
public function test(): void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
imports:
- { resource: '../../../../../../config/level/framework-migration/phpspec-to-phpunit.yaml' }

parameters:
# for tests only
object_behavior_class: 'Rector\PhpSpecToPHPUnit\Tests\Rector\Class_\PhpSpecToPHPUnitRector\Source\DummyObjectBehavior'

services:
# order matters
Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecMocksToPHPUnitMocksRector: ~
Rector\PhpSpecToPHPUnit\Rector\MethodCall\PhpSpecPromisesToPHPUnitAssertRector: ~

Rector\PhpSpecToPHPUnit\Rector\ClassMethod\PhpSpecMethodToPHPUnitMethodRector: ~

Rector\PhpSpecToPHPUnit\Rector\Class_\AddMockPropertiesRector: ~
Rector\PhpSpecToPHPUnit\Rector\Class_\PhpSpecClassToPHPUnitClassRector: ~

Rector\PhpSpecToPHPUnit\Rector\ClassMethod\MockVariableToPropertyFetchRector: ~
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getRectorClass(): string
}

/**
* @return string[]
* @return mixed[]
*/
protected function getRectorConfiguration(): array
{
Expand Down
Loading

0 comments on commit 3c2ff06

Please sign in to comment.