loophp / iterators Goto Github PK
View Code? Open in Web Editor NEWThe missing PHP iterators.
License: MIT License
The missing PHP iterators.
License: MIT License
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
composer.json
php >= 8.1
drupol/php-conventions ^5
phpbench/phpbench ^1.2
phpstan/phpstan-strict-rules ^1.0
phpunit/php-code-coverage ^10
phpunit/phpunit ^10
.github/workflows/benchmarks.yml
shivammathur/setup-php v2
actions/cache v3
actions/checkout v4
actions/checkout v4
.github/workflows/code-style.yml
actions/checkout v4
shivammathur/setup-php v2
ramsey/composer-install v2
.github/workflows/prettier.yml
actions/checkout v4
.github/workflows/prune.yaml
actions/stale v8
.github/workflows/release.yaml
actions/checkout v4
mindsers/changelog-reader-action v2
actions/create-release v1.1.4
.github/workflows/static-analysis.yml
actions/checkout v4
shivammathur/setup-php v2
ramsey/composer-install v2
.github/workflows/tests.yml
actions/checkout v4
WyriHaximus/github-action-composer-php-versions-in-range v1
actions/checkout v4
shivammathur/setup-php v2
ramsey/composer-install v2
This test shows the expected behavior and it fails on the last assert, since the actual result is 3 instead of 6.
final class SimpleCachingIteratorTest extends TestCase
{
public function testSimpleCachingIteratorInnerTraversals(): void
{
$iter = new SimpleCachingIteratorAggregate(new ArrayIterator([1, 2, 3, 4, 5, 6]));
$total = 0;
foreach ($iter as $key => $item) {
if ($key === 2) {
$firstTotal = $this->traverseAll($iter);
self::assertSame(6, $firstTotal);
}
++$total;
}
self::assertSame(6, $total);
}
private function traverseAll(iterable $iter): int
{
$total = 0;
foreach ($iter as $item) {
++$total;
}
return $total;
}
}
It is expected that one may iterate through iterator until the end regardless of whether inner iterations happen or not,
Test fails on final self::assertSame(6, $total);
, because outer loop iterated only over 3 items instead of 6.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.