Skip to content

Commit a14623d

Browse files
committed
Fix psalm errors
1 parent 55a60e1 commit a14623d

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

Diff for: src/DocBlock.php

-4
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,11 @@ public function getTags(): array
6161

6262
public function offsetExists(mixed $offset): bool
6363
{
64-
assert(\is_int($offset));
65-
6664
return isset($this->tags[$offset]);
6765
}
6866

6967
public function offsetGet(mixed $offset): ?TagInterface
7068
{
71-
assert(\is_int($offset));
72-
7369
return $this->tags[$offset] ?? null;
7470
}
7571

Diff for: src/Parser/Description/RegexDescriptionParser.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public function parse(string $description): DescriptionInterface
4343

4444
return match (\count($components)) {
4545
0 => new Description(),
46-
1 => $components[0],
46+
1 => match (true) {
47+
$components[0] instanceof Description => $components[0],
48+
default => new TaggedDescription($components),
49+
},
4750
default => new TaggedDescription($components),
4851
};
4952
}

Diff for: src/Tag/Description/TaggedDescription.php

-4
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,11 @@ public function count(): int
6060

6161
public function offsetExists(mixed $offset): bool
6262
{
63-
assert(\is_int($offset));
64-
6563
return isset($this->tags[$offset]);
6664
}
6765

6866
public function offsetGet(mixed $offset): TagInterface|DescriptionInterface|null
6967
{
70-
assert(\is_int($offset));
71-
7268
return $this->components[$offset] ?? null;
7369
}
7470

Diff for: src/Tag/Description/TaggedDescriptionInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* containing an arbitrary set of nested tags ({@see TagInterface}) and,
1313
* like a parent {@see DescriptionInterface}, can be represented as a string.
1414
*
15-
* @template-implements \Traversable<int<0, max>, DescriptionInterface|TagInterface>
15+
* @template-extends \Traversable<int<0, max>, DescriptionInterface|TagInterface>
1616
*/
1717
interface TaggedDescriptionInterface extends
1818
TagsProviderInterface,

0 commit comments

Comments
 (0)