2020-08-25 21:25:00 +00:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2021-02-20 23:21:19 +00:00
|
|
|
namespace Rector\Arguments\ValueObject;
|
2020-08-25 21:25:00 +00:00
|
|
|
|
2021-02-27 02:13:22 +00:00
|
|
|
use PHPStan\Type\ObjectType;
|
2020-09-12 21:19:08 +00:00
|
|
|
final class ArgumentAdder
|
2020-08-25 21:25:00 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $class;
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $method;
|
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $position;
|
|
|
|
/**
|
|
|
|
* @var string|null
|
|
|
|
*/
|
2021-05-11 10:40:34 +00:00
|
|
|
private $argumentName = null;
|
|
|
|
private $argumentDefaultValue = null;
|
2020-08-25 21:25:00 +00:00
|
|
|
/**
|
|
|
|
* @var string|null
|
|
|
|
*/
|
2021-05-11 10:40:34 +00:00
|
|
|
private $argumentType = null;
|
2020-08-25 21:25:00 +00:00
|
|
|
/**
|
|
|
|
* @var string|null
|
|
|
|
*/
|
2021-05-11 10:40:34 +00:00
|
|
|
private $scope = null;
|
2020-08-25 21:25:00 +00:00
|
|
|
/**
|
|
|
|
* @param mixed|null $argumentDefaultValue
|
|
|
|
*/
|
2021-05-09 20:15:43 +00:00
|
|
|
public function __construct(string $class, string $method, int $position, ?string $argumentName = null, $argumentDefaultValue = null, ?string $argumentType = null, ?string $scope = null)
|
|
|
|
{
|
2020-08-25 21:25:00 +00:00
|
|
|
$this->class = $class;
|
|
|
|
$this->method = $method;
|
|
|
|
$this->position = $position;
|
|
|
|
$this->argumentName = $argumentName;
|
|
|
|
$this->argumentDefaultValue = $argumentDefaultValue;
|
|
|
|
$this->argumentType = $argumentType;
|
|
|
|
$this->scope = $scope;
|
|
|
|
}
|
2021-05-10 22:23:08 +00:00
|
|
|
public function getObjectType() : \PHPStan\Type\ObjectType
|
2020-08-25 21:25:00 +00:00
|
|
|
{
|
2021-05-10 22:23:08 +00:00
|
|
|
return new \PHPStan\Type\ObjectType($this->class);
|
2020-08-25 21:25:00 +00:00
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getMethod() : string
|
2020-08-25 21:25:00 +00:00
|
|
|
{
|
|
|
|
return $this->method;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getPosition() : int
|
2020-08-25 21:25:00 +00:00
|
|
|
{
|
|
|
|
return $this->position;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getArgumentName() : ?string
|
2020-08-25 21:25:00 +00:00
|
|
|
{
|
|
|
|
return $this->argumentName;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return mixed|null
|
|
|
|
*/
|
|
|
|
public function getArgumentDefaultValue()
|
|
|
|
{
|
|
|
|
return $this->argumentDefaultValue;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getArgumentType() : ?string
|
2020-08-25 21:25:00 +00:00
|
|
|
{
|
|
|
|
return $this->argumentType;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getScope() : ?string
|
2020-08-25 21:25:00 +00:00
|
|
|
{
|
|
|
|
return $this->scope;
|
|
|
|
}
|
|
|
|
}
|