rector/rules/Renaming/ValueObject/RenameClassAndConstFetch.php

54 lines
1.3 KiB
PHP
Raw Normal View History

<?php
declare (strict_types=1);
2022-06-06 16:43:29 +00:00
namespace RectorPrefix20220606\Rector\Renaming\ValueObject;
2022-06-06 16:43:29 +00:00
use RectorPrefix20220606\PHPStan\Type\ObjectType;
use RectorPrefix20220606\Rector\Renaming\Contract\RenameClassConstFetchInterface;
final class RenameClassAndConstFetch implements RenameClassConstFetchInterface
{
/**
* @readonly
* @var string
*/
private $oldClass;
/**
* @readonly
* @var string
*/
private $oldConstant;
/**
* @readonly
* @var string
*/
private $newClass;
/**
* @readonly
* @var string
*/
private $newConstant;
public function __construct(string $oldClass, string $oldConstant, string $newClass, string $newConstant)
{
$this->oldClass = $oldClass;
$this->oldConstant = $oldConstant;
$this->newClass = $newClass;
$this->newConstant = $newConstant;
}
2022-06-06 16:43:29 +00:00
public function getOldObjectType() : ObjectType
{
2022-06-06 16:43:29 +00:00
return new ObjectType($this->oldClass);
}
public function getOldConstant() : string
{
return $this->oldConstant;
}
public function getNewConstant() : string
{
return $this->newConstant;
}
public function getNewClass() : string
{
return $this->newClass;
}
}