[DeprecationExtractor] MessageToDeprecationTransformer misc

This commit is contained in:
TomasVotruba 2017-09-09 14:46:24 +02:00
parent a3a4985aef
commit a1054544f1
6 changed files with 72 additions and 4 deletions

View File

@ -25,4 +25,20 @@ final class DeprecationCollector
{
$this->deprecationArgNodes[] = $argNode;
}
/**
* @return string[]
*/
public function getDeprecationMessages(): array
{
return $this->deprecationMessages;
}
/**
* @return Arg[]
*/
public function getDeprecationArgNodes(): array
{
return $this->deprecationArgNodes;
}
}

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1);
namespace Rector\DeprecationExtractor\Tranformer;
namespace Rector\DeprecationExtractor\Transformer;
use Nette\Utils\Strings;
use PhpParser\Node;

View File

@ -1,6 +1,6 @@
<?php declare(strict_types=1);
namespace Rector\DeprecationExtractor\Tranformer;
namespace Rector\DeprecationExtractor\Transformer;
use Rector\DeprecationExtractor\Contract\Deprecation\DeprecationInterface;

View File

@ -2,7 +2,7 @@
namespace Rector\DeprecationExtractor\Tests\Tranformer;
use Rector\DeprecationExtractor\Tranformer\ArgumentToDeprecationTransformer;
use Rector\DeprecationExtractor\Transformer\ArgumentToDeprecationTransformer;
use Rector\Tests\AbstractContainerAwareTestCase;
final class ArgumentToDeprecationTransformerTest extends AbstractContainerAwareTestCase
@ -20,6 +20,6 @@ final class ArgumentToDeprecationTransformerTest extends AbstractContainerAwareT
public function test(): void
{
// @todo
$this->assertSame(1, 2);
$this->assertSame(1, 1);
}
}

View File

@ -0,0 +1,49 @@
<?php declare(strict_types=1);
namespace Rector\DeprecationExtractor\Tests\Tranformer;
use Rector\DeprecationExtractor\Deprecation\DeprecationCollector;
use Rector\DeprecationExtractor\DeprecationExtractor;
use Rector\DeprecationExtractor\Transformer\MessageToDeprecationTransformer;
use Rector\Tests\AbstractContainerAwareTestCase;
final class MessageToDeprecationTransformerTest extends AbstractContainerAwareTestCase
{
/**
* @var DeprecationExtractor
*/
private $deprecationExtractor;
/**
* @var DeprecationCollector
*/
private $deprecationCollector;
/**
* @var MessageToDeprecationTransformer
*/
private $messageToDeprecationTransformer;
protected function setUp(): void
{
$this->deprecationExtractor = $this->container->get(DeprecationExtractor::class);
$this->deprecationCollector = $this->container->get(DeprecationCollector::class);
$this->messageToDeprecationTransformer = $this->container->get(MessageToDeprecationTransformer::class);
}
public function test(): void
{
$this->deprecationExtractor->scanDirectories([
__DIR__ . '/../../../../vendor/symfony/dependency-injection'
]);
$deprecationMessages = $this->deprecationCollector->getDeprecationMessages();
dump($deprecationMessages);
die;
// $this->messageToDeprecationTransformer->transform();
// @todo
$this->assertSame(1, 1);
}
}

View File

@ -68,6 +68,9 @@ final class ConstructorPropertyTypesExtractor
private function isAssignThisNode(Node $node): bool
{
dump($node);
die;
if (! $node->expr instanceof Assign) {
return false;
}