rector/packages/BetterPhpDocParser/PhpDoc/ArrayItemNode.php
Tomas Votruba 3313a231b7 Updated Rector to commit bb609b28e327ca1fb7827b6bc548013d19a2cf4e
bb609b28e3 [Core] Always reset stopTraversal to false on next Rector visit (#4182)
2023-06-11 14:17:34 +00:00

39 lines
905 B
PHP

<?php
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\PhpDoc;
use PHPStan\PhpDocParser\Ast\NodeAttributes;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
use Stringable;
final class ArrayItemNode implements PhpDocTagValueNode
{
public $value;
public $key = null;
use NodeAttributes;
/**
* @param mixed $value
* @param mixed $key
*/
public function __construct($value, $key = null)
{
$this->value = $value;
$this->key = $key;
}
public function __toString() : string
{
$value = '';
if ($this->key !== null) {
$value .= $this->key . '=';
}
if (\is_array($this->value)) {
foreach ($this->value as $singleValue) {
$value .= $singleValue;
}
} else {
$value .= $this->value;
}
return $value;
}
}