Skip to content

Commit

Permalink
cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaEstes committed Nov 15, 2023
1 parent 3141cca commit 5ef80d7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/SonsOfPHP/Component/Pager/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace SonsOfPHP\Component\Pager;

use SonsOfPHP\Contract\Pager\PagerInterface;
use SonsOfPHP\Contract\Pager\AdapterInterface;
use SonsOfPHP\Contract\Pager\PagerInterface;

/**
* @author Joshua Estes <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ final class CallableAdapterTest extends TestCase
public function testItHasTheCorrectInterface(): void
{
$adapter = new CallableAdapter(
count: function () { return 0; },
slice: function () { return []; },
count: fn() => 0,
slice: fn() => [],
);

$this->assertInstanceOf(AdapterInterface::class, $adapter);
Expand All @@ -34,8 +34,8 @@ public function testItHasTheCorrectInterface(): void
public function testCount(): void
{
$adapter = new CallableAdapter(
count: function () { return 100; },
slice: function () { return []; },
count: fn() => 100,
slice: fn() => [],
);

$this->assertCount(100, $adapter);
Expand All @@ -47,8 +47,8 @@ public function testCount(): void
public function testGetSlice(): void
{
$adapter = new CallableAdapter(
count: function () { return 100; },
slice: function () { return ['unit.test']; },
count: fn() => 100,
slice: fn() => ['unit.test'],
);

$this->assertCount(1, $adapter->getSlice(0, null));
Expand Down
17 changes: 9 additions & 8 deletions src/SonsOfPHP/Component/Pager/Tests/PagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function testCount(): void
{
$pager = new Pager(new ArrayAdapter([]));

$this->assertSame(0, count($pager));
$this->assertCount(0, $pager);
$this->assertSame(0, $pager->count());
}

Expand All @@ -257,7 +257,7 @@ public function testCount(): void
public function testGetIteratorWhenGenerator(): void
{
$pager = new Pager(new CallableAdapter(
count: function () { return 0; },
count: fn() => 0,
slice: function () {
yield new \stdClass();
yield new \stdClass();
Expand All @@ -273,10 +273,11 @@ public function testGetIteratorWhenGenerator(): void
public function testGetIteratorWhenIteratorAggregateIsReturned(): void
{
$pager = new Pager(new CallableAdapter(
count: function () { return 1; },
count: fn() => 1,
slice: function () {
return new class implements \IteratorAggregate {
public function getIterator(): \Traversable {
return new class () implements \IteratorAggregate {
public function getIterator(): \Traversable
{
return new \ArrayIterator([]);
}
};
Expand All @@ -292,8 +293,8 @@ public function getIterator(): \Traversable {
public function testGetIteratorWhenIteratorIsReturned(): void
{
$pager = new Pager(new CallableAdapter(
count: function () { return 1; },
slice: function () { return new \ArrayIterator([]); },
count: fn() => 1,
slice: fn() => new \ArrayIterator([]),
));

$this->assertInstanceOf('ArrayIterator', $pager->getIterator());
Expand All @@ -315,7 +316,7 @@ public function testGetIterator(): void
public function testJsonSerializeWhenResultsAreTraversable(): void
{
$pager = new Pager(new CallableAdapter(
count: function () { return 2; },
count: fn() => 2,
slice: function () {
yield new \stdClass();
yield new \stdClass();
Expand Down

0 comments on commit 5ef80d7

Please sign in to comment.