2020-08-25 21:05:58 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2022-06-06 17:12:56 +00:00
|
|
|
namespace Rector\Removing\ValueObject;
|
2020-08-25 21:05:58 +02:00
|
|
|
|
2022-06-06 17:12:56 +00:00
|
|
|
use PHPStan\Type\ObjectType;
|
|
|
|
use Rector\Core\Validation\RectorAssert;
|
2020-09-12 23:19:08 +02:00
|
|
|
final class ArgumentRemover
|
2020-08-25 21:05:58 +02:00
|
|
|
{
|
|
|
|
/**
|
2023-06-11 23:01:39 +00:00
|
|
|
* @readonly
|
2022-08-06 15:23:35 +00:00
|
|
|
* @var string
|
2020-08-25 21:05:58 +02:00
|
|
|
*/
|
|
|
|
private $class;
|
|
|
|
/**
|
2023-06-11 23:01:39 +00:00
|
|
|
* @readonly
|
2020-08-25 21:05:58 +02:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $method;
|
|
|
|
/**
|
2023-06-11 23:01:39 +00:00
|
|
|
* @readonly
|
2020-08-25 21:05:58 +02:00
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $position;
|
2023-06-11 23:01:39 +00:00
|
|
|
/**
|
|
|
|
* @readonly
|
|
|
|
* @var mixed
|
|
|
|
*/
|
2020-08-25 21:05:58 +02:00
|
|
|
private $value;
|
|
|
|
/**
|
|
|
|
* @param mixed $value
|
|
|
|
*/
|
|
|
|
public function __construct(string $class, string $method, int $position, $value)
|
|
|
|
{
|
|
|
|
$this->class = $class;
|
|
|
|
$this->method = $method;
|
|
|
|
$this->position = $position;
|
|
|
|
$this->value = $value;
|
2022-06-07 08:22:29 +00:00
|
|
|
RectorAssert::className($class);
|
2020-08-25 21:05:58 +02:00
|
|
|
}
|
2022-06-07 08:22:29 +00:00
|
|
|
public function getObjectType() : ObjectType
|
2020-08-25 21:05:58 +02:00
|
|
|
{
|
2022-06-07 08:22:29 +00:00
|
|
|
return new ObjectType($this->class);
|
2020-08-25 21:05:58 +02:00
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getMethod() : string
|
2020-08-25 21:05:58 +02:00
|
|
|
{
|
|
|
|
return $this->method;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getPosition() : int
|
2020-08-25 21:05:58 +02:00
|
|
|
{
|
|
|
|
return $this->position;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getValue()
|
|
|
|
{
|
|
|
|
return $this->value;
|
|
|
|
}
|
|
|
|
}
|