2020-08-26 12:54:53 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2020-08-26 12:54:53 +02:00
|
|
|
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;
|
2021-05-10 22:10:16 +00:00
|
|
|
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-05-10 22:10:16 +00:00
|
|
|
public function getOldObjectType() : ObjectType
|
2020-08-26 12:54:53 +02:00
|
|
|
{
|
2021-05-10 22:10:16 +00:00
|
|
|
return new ObjectType($this->oldClass);
|
2020-08-26 12:54:53 +02:00
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getOldConstant() : string
|
2020-08-26 12:54:53 +02:00
|
|
|
{
|
|
|
|
return $this->oldConstant;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getNewConstant() : string
|
2020-08-26 12:54:53 +02:00
|
|
|
{
|
|
|
|
return $this->newConstant;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getNewClass() : string
|
2021-01-27 15:09:08 +01:00
|
|
|
{
|
|
|
|
return $this->newClass;
|
|
|
|
}
|
2020-08-26 12:54:53 +02:00
|
|
|
}
|