Skip to content

Commit d6a474c

Browse files
committed
Add generic types to traversable implementations
1 parent d97e5e1 commit d6a474c

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

Adapter/CollectionInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515

1616
/**
1717
* @author Charles Sarrazin <charles@sarraz.in>
18+
*
19+
* @extends \ArrayAccess<int, Entry>
20+
* @extends \IteratorAggregate<int, Entry>
1821
*/
1922
interface CollectionInterface extends \Countable, \IteratorAggregate, \ArrayAccess
2023
{
2124
/**
22-
* @return Entry[]
25+
* @return array<int, Entry>
2326
*/
2427
public function toArray();
2528
}

Adapter/ExtLdap/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function count()
6363
}
6464

6565
/**
66-
* @return \Traversable
66+
* @return \Traversable<int, Entry>
6767
*/
6868
#[\ReturnTypeWillChange]
6969
public function getIterator()
@@ -101,7 +101,7 @@ public function offsetExists($offset)
101101
}
102102

103103
/**
104-
* @return mixed
104+
* @return Entry|null
105105
*/
106106
#[\ReturnTypeWillChange]
107107
public function offsetGet($offset)

Adapter/ExtLdap/EntryManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private function getConnectionResource()
140140
}
141141

142142
/**
143-
* @param iterable|UpdateOperation[] $operations An array or iterable of UpdateOperation instances
143+
* @param iterable<int, UpdateOperation> $operations An array or iterable of UpdateOperation instances
144144
*
145145
* @throws UpdateOperationException in case of an error
146146
*/

Adapter/QueryInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Ldap\Adapter;
1313

14-
use Symfony\Component\Ldap\Entry;
1514
use Symfony\Component\Ldap\Exception\LdapException;
1615
use Symfony\Component\Ldap\Exception\NotBoundException;
1716

@@ -33,7 +32,7 @@ interface QueryInterface
3332
/**
3433
* Executes a query and returns the list of Ldap entries.
3534
*
36-
* @return CollectionInterface|Entry[]
35+
* @return CollectionInterface
3736
*
3837
* @throws NotBoundException
3938
* @throws LdapException

Tests/Adapter/ExtLdap/LdapManagerTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Ldap\Tests\Adapter\ExtLdap;
1313

14+
use Symfony\Component\Ldap\Adapter\CollectionInterface;
1415
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
1516
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
1617
use Symfony\Component\Ldap\Adapter\ExtLdap\UpdateOperation;
@@ -160,10 +161,7 @@ public function testLdapUnboundUpdate()
160161
$em->update(new Entry(''));
161162
}
162163

163-
/**
164-
* @return Collection|Entry[]
165-
*/
166-
private function executeSearchQuery($expectedResults = 1)
164+
private function executeSearchQuery($expectedResults = 1): CollectionInterface
167165
{
168166
$results = $this
169167
->adapter

0 commit comments

Comments
 (0)