Skip to content

Commit

Permalink
Code style and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Apr 11, 2023
1 parent 8a67fad commit 5b094ca
Show file tree
Hide file tree
Showing 22 changed files with 54 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:

env:
PHP_VERSION: '8.1'
PHP_CS_FIXER_VERSION: v3.13.0
PHP_CS_FIXER_VERSION: v3.16.0

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"ergebnis/composer-normalize": "^2.8",
"friendsofphp/php-cs-fixer": "^3",
"infection/infection": ">=0.10.5",
"league/pipeline": "^1.0 || ^0.3",
"league/pipeline": "^0.3 || ^1.0",
"phan/phan": ">=1.1",
"php-coveralls/php-coveralls": "^2.4.1",
"phpstan/phpstan": ">=0.10",
Expand Down
16 changes: 8 additions & 8 deletions src/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@

namespace Pipeline;

use ArrayIterator;
use CallbackFilterIterator;
use Countable;
use EmptyIterator;
use Generator;
use Iterator;
use IteratorAggregate;
use Traversable;
use function array_chunk;
use function array_filter;
use function array_flip;
Expand All @@ -28,24 +36,16 @@
use function array_shift;
use function array_slice;
use function array_values;
use ArrayIterator;
use function assert;
use CallbackFilterIterator;
use function count;
use Countable;
use EmptyIterator;
use Generator;
use function is_array;
use function is_iterable;
use function is_string;
use Iterator;
use function iterator_to_array;
use IteratorAggregate;
use function max;
use function min;
use function mt_getrandmax;
use function mt_rand;
use Traversable;

/**
* Concrete pipeline with sensible default callbacks.
Expand Down
4 changes: 2 additions & 2 deletions tests/AppendPrependTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
namespace Tests\Pipeline;

use ArrayIterator;
use PHPUnit\Framework\TestCase;
use function count;
use function is_numeric;
use function key;
use const PHP_VERSION_ID;
use PHPUnit\Framework\TestCase;
use function Pipeline\take;
use function reset;
use const PHP_VERSION_ID;

/**
* @covers \Pipeline\Standard
Expand Down
2 changes: 1 addition & 1 deletion tests/ArraysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

namespace Tests\Pipeline;

use function iterator_to_array;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use ReflectionObject;
use function iterator_to_array;

/**
* @covers \Pipeline\Standard
Expand Down
2 changes: 1 addition & 1 deletion tests/Benchmarks/BenchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

namespace Tests\Pipeline\Benchmarks;

use PHPUnit\Framework\TestCase;
use function array_map;
use function array_sum;
use PHPUnit\Framework\TestCase;
use function Pipeline\fromArray;
use function random_int;

Expand Down
2 changes: 1 addition & 1 deletion tests/CastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

use Generator;
use PHPUnit\Framework\TestCase;
use function Pipeline\map;
use Pipeline\Standard;
use function Pipeline\map;
use function Pipeline\take;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/ChunkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
use ArrayIterator;
use IteratorIterator;
use PHPUnit\Framework\TestCase;
use function Pipeline\fromArray;
use Pipeline\Standard;
use function Pipeline\fromArray;
use function Pipeline\take;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/CountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

use ArrayIterator;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function Pipeline\fromArray;
use function Pipeline\map;
use Pipeline\Standard;
use function Pipeline\take;

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/EagerWithArraysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

use Generator;
use PHPUnit\Framework\TestCase;
use function Pipeline\fromArray;
use Pipeline\Standard;
use function Pipeline\take;
use ReflectionClass;
use function Pipeline\fromArray;
use function Pipeline\take;

/**
* @covers \Pipeline\Standard
Expand Down
4 changes: 2 additions & 2 deletions tests/EdgeCasesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

use ArrayIterator;
use Iterator;
use function iterator_to_array;
use IteratorIterator;
use NoRewindIterator;
use PHPUnit\Framework\TestCase;
use function Pipeline\map;
use Pipeline\Standard;
use function iterator_to_array;
use function Pipeline\map;
use function range;

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/ErrorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
namespace Tests\Pipeline;

use ArgumentCountError;
use function class_exists;
use function is_callable;
use PHPUnit\Framework\Error\Warning;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use TypeError;
use function class_exists;
use function is_callable;

/**
* @covers \Pipeline\Standard
Expand Down
2 changes: 1 addition & 1 deletion tests/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

namespace Tests\Pipeline;

use PHPUnit\Framework\TestCase;
use function ob_end_clean;
use function ob_start;
use PHPUnit\Framework\TestCase;

/**
* @coversNothing
Expand Down
8 changes: 4 additions & 4 deletions tests/FlipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@

namespace Tests\Pipeline;

use ArrayIterator;
use IteratorIterator;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function array_flip;
use function array_reverse;
use ArrayIterator;
use function call_user_func;
use function chr;
use function count;
use IteratorIterator;
use PHPUnit\Framework\TestCase;
use function Pipeline\map;
use Pipeline\Standard;
use function Pipeline\take;
use function shuffle;

Expand Down
6 changes: 3 additions & 3 deletions tests/FunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

namespace Tests\Pipeline;

use function array_map;
use ArrayIterator;
use function iterator_to_array;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function array_map;
use function iterator_to_array;
use function Pipeline\fromArray;
use function Pipeline\fromValues;
use function Pipeline\map;
use Pipeline\Standard;
use function Pipeline\take;
use function Pipeline\zip;
use function range;
Expand Down
2 changes: 1 addition & 1 deletion tests/IterableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

namespace Tests\Pipeline;

use function iterator_to_array;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function iterator_to_array;

/**
* @covers \Pipeline\Standard
Expand Down
2 changes: 1 addition & 1 deletion tests/LeaguePipelineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
namespace Tests\Pipeline;

use ArrayIterator;
use function iterator_to_array;
use PHPUnit\Framework\TestCase;
use function iterator_to_array;

/**
* @coversNothing
Expand Down
8 changes: 4 additions & 4 deletions tests/MinMaxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@

namespace Tests\Pipeline;

use ArrayIterator;
use IteratorIterator;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function array_merge;
use function array_reverse;
use ArrayIterator;
use function call_user_func;
use function count;
use IteratorIterator;
use function max;
use function min;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function Pipeline\take;
use function range;
use function shuffle;
Expand Down
6 changes: 3 additions & 3 deletions tests/ReservoirTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

namespace Tests\Pipeline;

use function abs;
use ArrayIterator;
use IteratorIterator;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function abs;
use function mt_rand;
use function mt_srand;
use function ord;
use PHPUnit\Framework\TestCase;
use function Pipeline\map;
use Pipeline\Standard;
use function Pipeline\take;
use function range;
use function sin;
Expand Down
10 changes: 5 additions & 5 deletions tests/SliceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@

namespace Tests\Pipeline;

use function array_merge;
use function array_slice;
use function array_values;
use ArrayIterator;
use Closure;
use Generator;
use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use RuntimeException;
use function array_merge;
use function array_slice;
use function array_values;
use function Pipeline\fromArray;
use function Pipeline\map;
use Pipeline\Standard;
use function Pipeline\take;
use function range;
use RuntimeException;

/**
* @covers \Pipeline\Standard
Expand Down
6 changes: 3 additions & 3 deletions tests/StandardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@

use ArrayIterator;
use BadMethodCallException;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use ReflectionClass;
use function call_user_func;
use function iterator_count;
use function iterator_to_array;
use function max;
use PHPUnit\Framework\TestCase;
use function Pipeline\fromArray;
use function Pipeline\map;
use Pipeline\Standard;
use function range;
use ReflectionClass;

/**
* @covers \Pipeline\Standard
Expand Down
15 changes: 6 additions & 9 deletions tests/ZipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

namespace Tests\Pipeline;

use function array_map;
use ArrayIterator;
use function max;
use PHPUnit\Framework\TestCase;
use Pipeline\Standard;
use function array_map;
use function max;
use function Pipeline\fromArray;
use function Pipeline\map;
use Pipeline\Standard;
use function Pipeline\take;
use function Pipeline\zip;
use function range;
Expand Down Expand Up @@ -106,8 +106,7 @@ public function testZipUnequalLengths(): void
{
$actual = take(['a', 'b', 'c'])
->zip([1, 2], [3])
->toArray()
;
->toArray();

$this->assertSame([
['a', 1, 3],
Expand All @@ -120,8 +119,7 @@ public function testZipUnevenLengths(): void
{
$actual = take(['a', 'b', 'c'])
->zip([1], [2, 3])
->toArray()
;
->toArray();

$this->assertSame([
['a', 1, 2],
Expand All @@ -134,8 +132,7 @@ public function testZipOverShortIndex(): void
{
$actual = take(['a', 'b', 'c'])
->zip(range(1, 10), range(10, 100, 10))
->toArray()
;
->toArray();

$this->assertSame([
['a', 1, 10],
Expand Down

0 comments on commit 5b094ca

Please sign in to comment.