Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Feb 13, 2024
1 parent 5c8c208 commit 230dc9f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/Transaction/TupleStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* @internal
*
* @implements IteratorAggregate<object, Tuple>
*/
final class TupleStorage implements IteratorAggregate, Countable
Expand All @@ -27,6 +28,7 @@ public function getIterator(): \Traversable
// When the generator is destroyed, the reference to the iterator is removed from the collection.
$cleaner = new class () {
public array $iterators;

public function __destruct()
{
unset($this->iterators[\spl_object_id($this)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,4 @@
],
Schema::SCHEMA => [],
],

];
8 changes: 4 additions & 4 deletions tests/ORM/Unit/Transaction/TupleStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ public function testAddItemsWhenIterating(): void
}

/** @see TupleStorage::$iterators */
self::assertCount(0, (fn(): array => $this->iterators)->call($storage));
self::assertCount(0, (fn (): array => $this->iterators)->call($storage));

$iterator = $storage->getIterator();
// Start generator
foreach ($iterator as $item) {
break;
}
/** @see TupleStorage::$iterators */
self::assertCount(1, (fn(): array => $this->iterators)->call($storage));
self::assertCount(1, (fn (): array => $this->iterators)->call($storage));

// Cleanup on iterator destruction
unset($iterator);
/** @see TupleStorage::$iterators */
self::assertCount(0, (fn(): array => $this->iterators)->call($storage));
self::assertCount(0, (fn (): array => $this->iterators)->call($storage));

// Cleanup on end of iteration
$iterator = $storage->getIterator();
Expand All @@ -115,7 +115,7 @@ public function testAddItemsWhenIterating(): void
// do nothing
}
/** @see TupleStorage::$iterators */
self::assertCount(0, (fn(): array => $this->iterators)->call($storage));
self::assertCount(0, (fn (): array => $this->iterators)->call($storage));
}

public function testDetachWhenIterating(): void
Expand Down

0 comments on commit 230dc9f

Please sign in to comment.