Skip to content

Commit 9c6f941

Browse files
committed
Remove iterator support from docblock and description
1 parent b4b244f commit 9c6f941

File tree

5 files changed

+3
-41
lines changed

5 files changed

+3
-41
lines changed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
}
1818
},
1919
"require-dev": {
20-
"type-lang/parser": "^1.0",
2120
"friendsofphp/php-cs-fixer": "^3.42",
2221
"phpunit/phpunit": "^10.5",
2322
"rector/rector": "^1.0",
23+
"type-lang/parser": "^1.0",
2424
"vimeo/psalm": "^5.18"
2525
},
2626
"autoload-dev": {

Diff for: src/DocBlock.php

-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
* This class represents structure containing a description and a set of tags
1616
* that describe an arbitrary DocBlock Comment in the code.
1717
*
18-
* @template-implements \IteratorAggregate<int<0, max>, TagInterface>
1918
* @template-implements \ArrayAccess<int<0, max>, TagInterface|null>
2019
*/
2120
final class DocBlock implements
2221
OptionalDescriptionProviderInterface,
2322
TagsProviderInterface,
24-
\IteratorAggregate,
2523
\ArrayAccess
2624
{
2725
use TagsProvider;

Diff for: src/Tag/Description.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
namespace TypeLang\PHPDoc\Tag;
66

77
/**
8-
* @template-implements \IteratorAggregate<int<0, max>, TagInterface>
98
* @template-implements \ArrayAccess<int<0, max>, TagInterface|null>
109
*/
11-
class Description implements DescriptionInterface, \IteratorAggregate, \ArrayAccess
10+
class Description implements DescriptionInterface, \ArrayAccess
1211
{
1312
use TagsProvider;
1413

Diff for: src/Tag/TagsProvider.php

-26
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
/**
88
* @mixin TagsProviderInterface
9-
* @mixin \IteratorAggregate
109
* @mixin \ArrayAccess
1110
*
1211
* @psalm-require-implements TagsProviderInterface
13-
* @psalm-require-implements \IteratorAggregate
1412
* @psalm-require-implements \ArrayAccess
1513
*
1614
* @internal This is an internal library trait, please do not use it in your code.
@@ -81,28 +79,4 @@ public function offsetUnset(mixed $offset): void
8179

8280
throw new \BadMethodCallException(self::class . ' objects are immutable');
8381
}
84-
85-
/**
86-
* @return \Traversable<int<0, max>, TagInterface>
87-
*/
88-
public function getIterator(): \Traversable
89-
{
90-
foreach ($this->tags as $tag) {
91-
yield $tag;
92-
93-
$description = $tag->getDescription();
94-
95-
if ($description instanceof TagsProviderInterface) {
96-
yield from $description;
97-
}
98-
}
99-
}
100-
101-
/**
102-
* @return int<0, max>
103-
*/
104-
public function count(): int
105-
{
106-
return \count($this->tags);
107-
}
10882
}

Diff for: src/Tag/TagsProviderInterface.php

+1-10
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
namespace TypeLang\PHPDoc\Tag;
66

77
/**
8-
* @template-extends \Traversable<int<0, max>, TagInterface>
9-
*
108
* @internal This is an internal library interface, please do not use it in your code.
119
* @psalm-internal TypeLang\PHPDoc\Tag
1210
*/
13-
interface TagsProviderInterface extends \Traversable, \Countable
11+
interface TagsProviderInterface
1412
{
1513
/**
1614
* Returns the tags for this object.
@@ -20,11 +18,4 @@ interface TagsProviderInterface extends \Traversable, \Countable
2018
* @return iterable<array-key, TagInterface>
2119
*/
2220
public function getTags(): iterable;
23-
24-
/**
25-
* @psalm-immutable Each call to the method must return the same value.
26-
*
27-
* @return int<0, max>
28-
*/
29-
public function count(): int;
3021
}

0 commit comments

Comments
 (0)