Code Monkey home page Code Monkey logo

iterators's People

Contributors

azjezz avatar dependabot[bot] avatar drupol avatar jdreesen avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

iterators's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

composer
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-actions
.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

  • Check this box to trigger a request for Renovate to run again on this repository

SimpleCachingIteratorAggregate doesn't handle nested traversals

Steps required to reproduce the problem

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;
    }
}

Expected Result

It is expected that one may iterate through iterator until the end regardless of whether inner iterations happen or not,

Actual Result

Test fails on final self::assertSame(6, $total);, because outer loop iterated only over 3 items instead of 6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.