Skip to content

Commit a429d00

Browse files
author
Kirill Nesmeyanov
committed
Fix psalm errors
1 parent 5701d67 commit a429d00

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

src/DocBlock/StandardTagFactory.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,16 @@ public function create(string $tag): TagInterface
8383
try {
8484
return $factory->create($body);
8585
} catch (InvalidTagVariableNameException $e) {
86+
$type = $e->getType();
8687
$body = Description::fromNonTagged(
8788
body: \substr($body, $e->getTypeOffset()),
8889
);
8990

90-
if ($e->getType() === null) {
91+
if ($type === null) {
9192
return new InvalidTag($name, $body);
9293
}
9394

94-
return new InvalidTypedTag($name, $e->getType(), $body);
95+
return new InvalidTypedTag($name, $type, $body);
9596
} catch (\InvalidArgumentException) {
9697
return new InvalidTag($name, Description::fromNonTagged($body));
9798
}
@@ -118,7 +119,7 @@ private function getFactory(string $tag): ?TagFactoryInterface
118119
}
119120

120121
/**
121-
* @return list<non-empty-lowercase-string>
122+
* @return array<array-key, non-empty-lowercase-string>
122123
*/
123124
private function getTagMappings(string $tag): array
124125
{
@@ -128,17 +129,20 @@ private function getTagMappings(string $tag): array
128129

129130
$lower = \strtolower($tag);
130131

131-
return $this->mappings[$lower] ??= [...$this->getTagVariants($lower)];
132+
return $this->mappings[$lower] ??= \array_values([
133+
...$this->getTagVariants($lower),
134+
]);
132135
}
133136

134137
/**
135138
* @param lowercase-string $tag
136139
* @return iterable<array-key, non-empty-lowercase-string>
140+
* @psalm-suppress MoreSpecificReturnType
137141
*/
138142
private function getTagVariants(string $tag): iterable
139143
{
140144
if ($tag === '') {
141-
return;
145+
return [];
142146
}
143147

144148
yield $tag;

src/DocBlock/Tag/CommonTagFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* @template TTag of Tag
12-
* @template-extends TypedTagFactory<TTag>
12+
* @template-extends TagFactory<TTag>
1313
*/
1414
final class CommonTagFactory extends TagFactory
1515
{

src/DocBlock/TagProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ trait TagProvider
1919

2020
/**
2121
* @param iterable<array-key, TagInterface> $tags
22+
* @psalm-suppress InaccessibleProperty
2223
*/
2324
protected function initializeTags(iterable $tags): void
2425
{

0 commit comments

Comments
 (0)