mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
bdfd24339f
2e977bd3aa
deploy to original repository
79 lines
1.7 KiB
PHP
79 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Arguments\ValueObject;
|
|
|
|
use PHPStan\Type\ObjectType;
|
|
use Rector\Arguments\Contract\ReplaceArgumentDefaultValueInterface;
|
|
use Rector\Core\Validation\RectorAssert;
|
|
final class ReplaceArgumentDefaultValue implements ReplaceArgumentDefaultValueInterface
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
public const ANY_VALUE_BEFORE = '*ANY_VALUE_BEFORE*';
|
|
/**
|
|
* @readonly
|
|
* @var string
|
|
*/
|
|
private $class;
|
|
/**
|
|
* @readonly
|
|
* @var string
|
|
*/
|
|
private $method;
|
|
/**
|
|
* @var int<0, max>
|
|
* @readonly
|
|
*/
|
|
private $position;
|
|
/**
|
|
* @var mixed
|
|
*/
|
|
private $valueBefore;
|
|
/**
|
|
* @var mixed
|
|
*/
|
|
private $valueAfter;
|
|
/**
|
|
* @param int<0, max> $position
|
|
* @param mixed $valueBefore
|
|
* @param mixed $valueAfter
|
|
*/
|
|
public function __construct(string $class, string $method, int $position, $valueBefore, $valueAfter)
|
|
{
|
|
$this->class = $class;
|
|
$this->method = $method;
|
|
$this->position = $position;
|
|
$this->valueBefore = $valueBefore;
|
|
$this->valueAfter = $valueAfter;
|
|
RectorAssert::className($class);
|
|
}
|
|
public function getObjectType() : ObjectType
|
|
{
|
|
return new ObjectType($this->class);
|
|
}
|
|
public function getMethod() : string
|
|
{
|
|
return $this->method;
|
|
}
|
|
public function getPosition() : int
|
|
{
|
|
return $this->position;
|
|
}
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getValueBefore()
|
|
{
|
|
return $this->valueBefore;
|
|
}
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getValueAfter()
|
|
{
|
|
return $this->valueAfter;
|
|
}
|
|
}
|