rector/rules/Php80/ValueObject/AnnotationToAttribute.php
Tomas Votruba 1cdd8d4e52 Updated Rector to commit 09499098eb819d6560b52fdb1420b6fbcd32d104
09499098eb [TypeDeclaration] Register ParamAnnotationIncorrectNullableRector to type-declaration config set (#2071)
2022-04-14 14:58:58 +00:00

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;
}
}