mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
1cdd8d4e52
09499098eb
[TypeDeclaration] Register ParamAnnotationIncorrectNullableRector to type-declaration config set (#2071)
45 lines
909 B
PHP
45 lines
909 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Php80\ValueObject;
|
|
|
|
final class AnnotationToAttribute
|
|
{
|
|
/**
|
|
* @var class-string|string
|
|
* @readonly
|
|
*/
|
|
private $tag;
|
|
/**
|
|
* @var class-string|null
|
|
* @readonly
|
|
*/
|
|
private $attributeClass;
|
|
/**
|
|
* @param class-string|string $tag
|
|
* @param class-string|null $attributeClass
|
|
*/
|
|
public function __construct(string $tag, ?string $attributeClass = null)
|
|
{
|
|
$this->tag = $tag;
|
|
$this->attributeClass = $attributeClass;
|
|
}
|
|
/**
|
|
* @return class-string|string
|
|
*/
|
|
public function getTag() : string
|
|
{
|
|
return $this->tag;
|
|
}
|
|
/**
|
|
* @return class-string
|
|
*/
|
|
public function getAttributeClass() : string
|
|
{
|
|
if ($this->attributeClass === null) {
|
|
return $this->tag;
|
|
}
|
|
return $this->attributeClass;
|
|
}
|
|
}
|