2022-10-15 22:31:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare (strict_types=1);
|
|
|
|
namespace Rector\Php80\ValueObject;
|
|
|
|
|
2024-01-02 02:40:38 +00:00
|
|
|
use Rector\Validation\RectorAssert;
|
2022-10-15 22:31:48 +00:00
|
|
|
final class AnnotationPropertyToAttributeClass
|
|
|
|
{
|
|
|
|
/**
|
2023-06-11 23:01:39 +00:00
|
|
|
* @readonly
|
2022-10-15 22:31:48 +00:00
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $attributeClass;
|
2023-06-11 23:01:39 +00:00
|
|
|
/**
|
|
|
|
* @readonly
|
2024-04-03 06:21:54 +00:00
|
|
|
* @var int|string|null
|
2023-06-11 23:01:39 +00:00
|
|
|
*/
|
2022-10-15 22:31:48 +00:00
|
|
|
private $annotationProperty = null;
|
|
|
|
/**
|
2023-06-11 23:01:39 +00:00
|
|
|
* @readonly
|
2022-10-15 22:31:48 +00:00
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
private $doesNeedNewImport = \false;
|
|
|
|
/**
|
|
|
|
* @param string|int|null $annotationProperty
|
|
|
|
*/
|
|
|
|
public function __construct(string $attributeClass, $annotationProperty = null, bool $doesNeedNewImport = \false)
|
|
|
|
{
|
|
|
|
$this->attributeClass = $attributeClass;
|
|
|
|
$this->annotationProperty = $annotationProperty;
|
|
|
|
$this->doesNeedNewImport = $doesNeedNewImport;
|
|
|
|
RectorAssert::className($attributeClass);
|
|
|
|
}
|
|
|
|
/**
|
2024-04-03 06:21:54 +00:00
|
|
|
* @return int|string|null
|
2022-10-15 22:31:48 +00:00
|
|
|
*/
|
|
|
|
public function getAnnotationProperty()
|
|
|
|
{
|
|
|
|
return $this->annotationProperty;
|
|
|
|
}
|
|
|
|
public function getAttributeClass() : string
|
|
|
|
{
|
|
|
|
return $this->attributeClass;
|
|
|
|
}
|
|
|
|
public function doesNeedNewImport() : bool
|
|
|
|
{
|
|
|
|
return $this->doesNeedNewImport;
|
|
|
|
}
|
|
|
|
}
|