Skip to content

Commit

Permalink
OffsetAccessType - describe uses toPhpDocNode and phpdoc-parser printer
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 17, 2023
1 parent 30f60c1 commit 347fdbf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Type/OffsetAccessType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

use PHPStan\PhpDocParser\Ast\Type\OffsetAccessTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\PhpDocParser\Printer\Printer;
use PHPStan\Type\Generic\TemplateTypeVariance;
use PHPStan\Type\Traits\LateResolvableTypeTrait;
use PHPStan\Type\Traits\NonGeneralizableTypeTrait;
use function array_merge;
use function sprintf;

/** @api */
final class OffsetAccessType implements CompoundType, LateResolvableType
Expand Down Expand Up @@ -59,11 +59,9 @@ public function equals(Type $type): bool

public function describe(VerbosityLevel $level): string
{
return sprintf(
'%s[%s]',
$this->type->describe($level),
$this->offset->describe($level),
);
$printer = new Printer();

return $printer->print($this->toPhpDocNode());
}

public function isResolvable(): bool
Expand Down

0 comments on commit 347fdbf

Please sign in to comment.