2021-01-12 14:41:47 +01:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2021-01-12 14:41:47 +01:00
|
|
|
namespace Rector\Privatization\ValueObject;
|
|
|
|
|
2021-03-07 20:37:48 +01:00
|
|
|
use PHPStan\Type\ObjectType;
|
2021-01-12 14:41:47 +01:00
|
|
|
final class ReplaceStringWithClassConstant
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $class;
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $method;
|
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $argPosition;
|
2021-05-10 23:39:21 +00:00
|
|
|
/**
|
2021-08-22 21:22:18 +00:00
|
|
|
* @var class-string
|
2021-05-10 23:39:21 +00:00
|
|
|
*/
|
|
|
|
private $classWithConstants;
|
2021-01-12 14:41:47 +01:00
|
|
|
/**
|
|
|
|
* @param class-string $classWithConstants
|
|
|
|
*/
|
|
|
|
public function __construct(string $class, string $method, int $argPosition, string $classWithConstants)
|
|
|
|
{
|
|
|
|
$this->class = $class;
|
|
|
|
$this->method = $method;
|
|
|
|
$this->argPosition = $argPosition;
|
2021-05-10 23:39:21 +00:00
|
|
|
$this->classWithConstants = $classWithConstants;
|
2021-01-12 14:41:47 +01:00
|
|
|
}
|
2021-05-10 22:23:08 +00:00
|
|
|
public function getObjectType() : \PHPStan\Type\ObjectType
|
2021-01-12 14:41:47 +01:00
|
|
|
{
|
2021-05-10 22:23:08 +00:00
|
|
|
return new \PHPStan\Type\ObjectType($this->class);
|
2021-01-12 14:41:47 +01:00
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getMethod() : string
|
2021-01-12 14:41:47 +01:00
|
|
|
{
|
|
|
|
return $this->method;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return class-string
|
|
|
|
*/
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getClassWithConstants() : string
|
2021-01-12 14:41:47 +01:00
|
|
|
{
|
|
|
|
return $this->classWithConstants;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getArgPosition() : int
|
2021-01-12 14:41:47 +01:00
|
|
|
{
|
|
|
|
return $this->argPosition;
|
|
|
|
}
|
|
|
|
}
|