Commit 4672dc9a authored by catch's avatar catch
Browse files

Issue #3456311 by jonathanshaw, mxh: Make LazyPluginCollection::getIterator...

Issue #3456311 by jonathanshaw, mxh: Make LazyPluginCollection::getIterator more flexible, return a Traversable
parent a3e346ee
Loading
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -1051,12 +1051,6 @@
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Component/Plugin/LazyPluginCollection.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Component\\\\Plugin\\\\LazyPluginCollection\\:\\:getIterator\\(\\) return type with generic class ArrayIterator does not specify its types\\: TKey, TValue$#',
	'identifier' => 'missingType.generics',
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Component/Plugin/LazyPluginCollection.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Component\\\\Plugin\\\\LazyPluginCollection\\:\\:initializePlugin\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+5 −1
Original line number Diff line number Diff line
@@ -142,7 +142,11 @@ public function removeInstanceId($instance_id) {
    $this->remove($instance_id);
  }

  public function getIterator(): \ArrayIterator {
  /**
   * @return \Traversable<string, mixed>
   *   A traversable generator.
   */
  public function getIterator(): \Traversable {
    $instances = [];
    foreach ($this->getInstanceIds() as $instance_id) {
      $instances[$instance_id] = $this->get($instance_id);