-
-
Notifications
You must be signed in to change notification settings - Fork 336
/
ReplaceStringWithClassConstant.php
52 lines (43 loc) · 1.08 KB
/
ReplaceStringWithClassConstant.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
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
namespace Rector\Privatization\ValueObject;
use PHPStan\Type\ObjectType;
use Rector\Core\Validation\RectorAssert;
final class ReplaceStringWithClassConstant
{
/**
* @param class-string $classWithConstants
*/
public function __construct(
private readonly string $class,
private readonly string $method,
private readonly int $argPosition,
private readonly string $classWithConstants,
private readonly bool $caseInsensitive = false
) {
RectorAssert::className($class);
}
public function getObjectType(): ObjectType
{
return new ObjectType($this->class);
}
public function getMethod(): string
{
return $this->method;
}
/**
* @return class-string
*/
public function getClassWithConstants(): string
{
return $this->classWithConstants;
}
public function getArgPosition(): int
{
return $this->argPosition;
}
public function isCaseInsensitive(): bool
{
return $this->caseInsensitive;
}
}