Skip to content

Commit

Permalink
Update AppendIterator stub
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jul 18, 2022
1 parent 74228e6 commit 9a6ebbb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stubs/iterable.stub
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
}

/**
* @template TKey of array-key
* @template TKey
* @template TValue
* @template TIterator as Iterator<TKey, TValue>
*
Expand All @@ -291,7 +291,7 @@ class AppendIterator extends IteratorIterator {
public function append(Iterator $iterator) {}

/**
* @return ArrayIterator<TKey, TValue>
* @return ArrayIterator<array-key, TValue>
*/
public function getArrayIterator() {}

Expand Down
9 changes: 9 additions & 0 deletions tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2489,4 +2489,13 @@ public function testBug6291(): void
$this->analyse([__DIR__ . '/data/bug-6291.php'], []);
}

public function testBug1517(): void
{
$this->checkThisOnly = false;
$this->checkNullables = true;
$this->checkUnionTypes = true;
$this->checkExplicitMixed = true;
$this->analyse([__DIR__ . '/data/bug-1517.php'], []);
}

}
16 changes: 16 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-1517.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types = 1);

$gen1 = static function () {
yield true => true;
};

$gen2 = static function () {
yield false => false;
};

$ait = new AppendIterator();

$ait->append($gen1());
$ait->append($gen2());

0 comments on commit 9a6ebbb

Please sign in to comment.