Skip to content

Commit

Permalink
Introduced fixture interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Jun 17, 2024
1 parent 28ff635 commit f4b8e49
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/lib/Rule/Internal/RemoveInterfaceWithMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
namespace Ibexa\Rector\Rule\Internal;

use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\Rector\AbstractRector;
Expand Down Expand Up @@ -97,7 +96,6 @@ public function refactor(Node $node): ?int

/**
* @param class-string[] $configuration
* @return void
*/
public function configure(array $configuration): void
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture;

interface SomeInterface
{
/**
* @return string[]
*/
public function someMethod(): array;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php /** @noinspection ALL */

use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand;
use Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture\SomeInterface;
use Symfony\Component\Console\Command\Command;

class SomeClass implements BackwardCompatibleCommand
class SomeClass implements SomeInterface
{
public function firstMethod(): void
{

}

public function getDeprecatedAliases(): array
public function someMethod(): array
{
return ['ezplatform:some_old:command_with_interface'];
}
Expand All @@ -25,7 +25,7 @@ class SomeClass implements BackwardCompatibleCommand
-----
<?php /** @noinspection ALL */

use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand;
use Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture\SomeInterface;
use Symfony\Component\Console\Command\Command;

class SomeClass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php /** @noinspection ALL */

use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand;
use Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture\SomeInterface;

class SomeClass implements BackwardCompatibleCommand
class SomeClass implements SomeInterface
{
public function getDeprecatedAliases(): array
public function someMethod(): array
{
return ['ezplatform:some_old:command_with_interface'];
}
Expand All @@ -14,7 +14,7 @@ class SomeClass implements BackwardCompatibleCommand
-----
<?php /** @noinspection ALL */

use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand;
use Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture\SomeInterface;

class SomeClass
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php /** @noinspection ALL */

use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand;
use Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture\SomeInterface;
use OtherInterface;

class SomeClass implements BackwardCompatibleCommand, OtherInterface
class SomeClass implements SomeInterface, OtherInterface
{
public function firstMethod()
{

}

public function getDeprecatedAliases(): array
public function someMethod(): array
{
return ['ezplatform:some_old:command_with_interface'];
}
Expand All @@ -20,7 +20,7 @@ class SomeClass implements BackwardCompatibleCommand, OtherInterface
-----
<?php /** @noinspection ALL */

use Ibexa\Bundle\Core\Command\BackwardCompatibleCommand;
use Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture\SomeInterface;
use OtherInterface;

class SomeClass implements OtherInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
declare(strict_types=1);

use Ibexa\Rector\Rule\Internal\RemoveInterfaceWithMethods;
use Ibexa\Rector\Tests\Rule\Internal\RemoveInterfaceWithMethods\Fixture\SomeInterface;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(
RemoveInterfaceWithMethods::class,
['Ibexa\Bundle\Core\Command\BackwardCompatibleCommand']
[SomeInterface::class]
);
};

0 comments on commit f4b8e49

Please sign in to comment.