forked from rectorphp/rector-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RenameClassConstFetch.php
40 lines (33 loc) · 961 Bytes
/
RenameClassConstFetch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace Rector\Renaming\ValueObject;
use PHPStan\Type\ObjectType;
use Rector\Core\Validation\RectorAssert;
use Rector\Renaming\Contract\RenameClassConstFetchInterface;
final class RenameClassConstFetch implements RenameClassConstFetchInterface
{
/**
* @param class-string $oldClass
*/
public function __construct(
private readonly string $oldClass,
private readonly string $oldConstant,
private readonly string $newConstant
) {
RectorAssert::className($oldClass);
RectorAssert::constantName($oldConstant);
RectorAssert::constantName($newConstant);
}
public function getOldObjectType(): ObjectType
{
return new ObjectType($this->oldClass);
}
public function getOldConstant(): string
{
return $this->oldConstant;
}
public function getNewConstant(): string
{
return $this->newConstant;
}
}