Skip to content

Commit

Permalink
Fix negative count (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Apr 19, 2024
1 parent 10da74a commit 4e3e462
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/WithChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function isMixedShape(): bool
return false;
}

/** @phpstan-assert-if-true non-empty-list<\PhpStubs\WordPress\Core\WordPressArg> $this->children */
public function hasChildren(): bool
{
return count($this->children) > 0;
Expand Down
3 changes: 2 additions & 1 deletion src/WordPressTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ public function format(): array
$this->type
);
} else {
if (count($this->children) <= 0 || count($this->children[0]->children) <= 0) {
if (! $this->hasChildren() || ! $this->children[0]->hasChildren()) {
$strings[] = sprintf(
'%s array<int|string, %s>%s',
$this->tag,
$this->type,
$name
);

return $strings;
}

Expand Down

0 comments on commit 4e3e462

Please sign in to comment.