Skip to content

Commit 86552ea

Browse files
minor #19036 add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support (Haehnchen)
This PR was merged into the 2.7 branch. Discussion ---------- add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support | Q | A | ------------- | --- | Branch | 2.7 | Bug fix | no | New feature | no | BC breaks | no | Deprecations | no | Tests pass | yes | License | MIT In additional to #16965 PhpStorm supports `IteratorAggregate::getIterator` now. see https://blog.jetbrains.com/phpstorm/2016/06/phpstorm-2016-2-eap-162-844/ example ``` $collection = new \Symfony\Component\Routing\RouteCollection(); foreach ($collection as $route) { $route->getHost(); } ``` Commits ------- ede3556 add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support
2 parents eccc535 + ede3556 commit 86552ea

File tree

9 files changed

+19
-7
lines changed

9 files changed

+19
-7
lines changed

src/Symfony/Component/Console/Helper/HelperSet.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
*/
2121
class HelperSet implements \IteratorAggregate
2222
{
23+
/**
24+
* @var Helper[]
25+
*/
2326
private $helpers = array();
2427
private $command;
2528

@@ -109,6 +112,9 @@ public function getCommand()
109112
return $this->command;
110113
}
111114

115+
/**
116+
* @return Helper[]
117+
*/
112118
public function getIterator()
113119
{
114120
return new \ArrayIterator($this->helpers);

src/Symfony/Component/Finder/Finder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ public function in($dirs)
646646
*
647647
* This method implements the IteratorAggregate interface.
648648
*
649-
* @return \Iterator An iterator
649+
* @return \Iterator|SplFileInfo[] An iterator
650650
*
651651
* @throws \LogicException if the in() method has not been called
652652
*/

src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function __construct($label, array $choices = array())
4747

4848
/**
4949
* {@inheritdoc}
50+
*
51+
* @return ChoiceGroupView[]|ChoiceView[]
5052
*/
5153
public function getIterator()
5254
{

src/Symfony/Component/Form/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ public function offsetUnset($name)
10221022
/**
10231023
* Returns the iterator for this group.
10241024
*
1025-
* @return \Traversable
1025+
* @return \Traversable|FormInterface[]
10261026
*/
10271027
public function getIterator()
10281028
{

src/Symfony/Component/Form/FormBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ public function getForm()
231231

232232
/**
233233
* {@inheritdoc}
234+
*
235+
* @return FormBuilderInterface[]
234236
*/
235237
public function getIterator()
236238
{

src/Symfony/Component/Form/FormView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function offsetUnset($name)
143143
/**
144144
* Returns an iterator to iterate over children (implements \IteratorAggregate).
145145
*
146-
* @return \ArrayIterator The iterator
146+
* @return \ArrayIterator|FormView[] The iterator
147147
*/
148148
public function getIterator()
149149
{

src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DumperCollection implements \IteratorAggregate
2626
private $parent;
2727

2828
/**
29-
* @var (DumperCollection|DumperRoute)[]
29+
* @var DumperCollection[]|DumperRoute[]
3030
*/
3131
private $children = array();
3232

@@ -38,7 +38,7 @@ class DumperCollection implements \IteratorAggregate
3838
/**
3939
* Returns the children routes and collections.
4040
*
41-
* @return (DumperCollection|DumperRoute)[] Array of DumperCollection|DumperRoute
41+
* @return DumperCollection[]|DumperRoute[] Array of DumperCollection|DumperRoute
4242
*/
4343
public function all()
4444
{
@@ -76,7 +76,7 @@ public function setAll(array $children)
7676
/**
7777
* Returns an iterator over the children.
7878
*
79-
* @return \Iterator The iterator
79+
* @return \Iterator|DumperCollection[]|DumperRoute[] The iterator
8080
*/
8181
public function getIterator()
8282
{

src/Symfony/Component/Routing/RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __clone()
4949
*
5050
* @see all()
5151
*
52-
* @return \ArrayIterator An \ArrayIterator object for iterating over routes
52+
* @return \ArrayIterator|Route[] An \ArrayIterator object for iterating over routes
5353
*/
5454
public function getIterator()
5555
{

src/Symfony/Component/Validator/ConstraintViolationList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public function remove($offset)
107107

108108
/**
109109
* {@inheritdoc}
110+
*
111+
* @return \ArrayIterator|ConstraintViolationInterface[]
110112
*/
111113
public function getIterator()
112114
{

0 commit comments

Comments
 (0)