2020-08-26 12:54:53 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Rector\Renaming\ValueObject;
|
|
|
|
|
2021-02-27 03:13:22 +01:00
|
|
|
use PHPStan\Type\ObjectType;
|
2021-01-27 15:09:08 +01:00
|
|
|
use Rector\Renaming\Contract\RenameClassConstFetchInterface;
|
|
|
|
|
|
|
|
final class RenameClassAndConstFetch implements RenameClassConstFetchInterface
|
2020-08-26 12:54:53 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $oldClass;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $oldConstant;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $newConstant;
|
|
|
|
|
2021-01-27 15:09:08 +01:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $newClass;
|
|
|
|
|
|
|
|
public function __construct(string $oldClass, string $oldConstant, string $newClass, string $newConstant)
|
2020-08-26 12:54:53 +02:00
|
|
|
{
|
|
|
|
$this->oldClass = $oldClass;
|
|
|
|
$this->oldConstant = $oldConstant;
|
|
|
|
$this->newConstant = $newConstant;
|
2021-01-27 15:09:08 +01:00
|
|
|
$this->newClass = $newClass;
|
2020-08-26 12:54:53 +02:00
|
|
|
}
|
|
|
|
|
2021-02-27 03:13:22 +01:00
|
|
|
public function getOldObjectType(): ObjectType
|
2020-08-26 12:54:53 +02:00
|
|
|
{
|
2021-02-27 03:13:22 +01:00
|
|
|
return new ObjectType($this->oldClass);
|
2020-08-26 12:54:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getOldConstant(): string
|
|
|
|
{
|
|
|
|
return $this->oldConstant;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getNewConstant(): string
|
|
|
|
{
|
|
|
|
return $this->newConstant;
|
|
|
|
}
|
2021-01-27 15:09:08 +01:00
|
|
|
|
|
|
|
public function getNewClass(): string
|
|
|
|
{
|
|
|
|
return $this->newClass;
|
|
|
|
}
|
2020-08-26 12:54:53 +02:00
|
|
|
}
|