Skip to content

Commit

Permalink
Fix ConstExprArrayItemNode::__toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 20, 2022
1 parent 57918d9 commit 61800f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Ast/ConstExpr/ConstExprArrayItemNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace PHPStan\PhpDocParser\Ast\ConstExpr;

use PHPStan\PhpDocParser\Ast\NodeAttributes;
use function sprintf;

class ConstExprArrayItemNode implements ConstExprNode
{
Expand All @@ -25,11 +26,11 @@ public function __construct(?ConstExprNode $key, ConstExprNode $value)
public function __toString(): string
{
if ($this->key !== null) {
return "{$this->key} => {$this->value}";
return sprintf('%s => %s', $this->key, $this->value);

}

return "{$this->value}";
return (string) $this->value;
}

}

0 comments on commit 61800f7

Please sign in to comment.