Skip to content

Commit

Permalink
Update PHPCS comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Sep 3, 2020
1 parent cbe3fc5 commit 72a13e4
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/Operation/Compose.php
Expand Up @@ -12,14 +12,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class Compose extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure((callable(Iterator<TKey, T>):Generator<TKey, T>)...): Closure(Iterator<TKey, T>): Generator<TKey, T>
*/
// phpcs:enable
public function __invoke(): Closure
{
return
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/Filter.php
Expand Up @@ -13,14 +13,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class Filter extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure((callable(T, TKey, Iterator<TKey, T>): bool)...): Closure(Iterator<TKey, T>): Generator<TKey, T>
*/
// phpcs:enable
public function __invoke(): Closure
{
return
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/FoldLeft.php
Expand Up @@ -12,14 +12,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class FoldLeft extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure(callable(T|null, T, TKey, Iterator<TKey, T>): T): Closure(T|null): Closure(Iterator<TKey, T>): T|null
*/
// phpcs:enable
public function __invoke(): Closure
{
return
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/FoldRight.php
Expand Up @@ -12,14 +12,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class FoldRight extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure(callable(T|null, T, TKey, Iterator<TKey, T>): T): Closure(T|null): Closure(Iterator<TKey, T>): T|null
*/
// phpcs:enable
public function __invoke(): Closure
{
return
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/Iterate.php
Expand Up @@ -12,14 +12,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class Iterate extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure(callable(T...):(array<TKey, T>)): Closure(T...): Closure(Iterator<TKey, T>=): Generator<int, T|false, mixed, void>
*/
// phpcs:enable
public function __invoke(): Closure
{
return
Expand Down
5 changes: 3 additions & 2 deletions src/Operation/Map.php
Expand Up @@ -12,6 +12,9 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
* phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
*/
final class Map extends AbstractOperation
{
Expand Down Expand Up @@ -55,11 +58,9 @@ static function ($carry, callable $callback) use ($key) {
};
};

// phpcs:disable
foreach ($iterator as $key => $value) {
yield $key => array_reduce($callbacks, $callbackFactory($key), $value);
}
// phpcs:enable
};
};
}
Expand Down
9 changes: 3 additions & 6 deletions src/Operation/Pluck.php
Expand Up @@ -21,6 +21,9 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
* phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
*/
final class Pluck extends AbstractOperation
{
Expand Down Expand Up @@ -55,7 +58,6 @@ static function ($default) use ($key): Closure {
*/
static function (Iterator $iterator) use ($key, $default): Generator {
$pick =
// phpcs:disable
/**
* @psalm-param Iterator<TKey, T> $iterator
* @psalm-param T|iterable<TKey, T> $target
Expand All @@ -68,7 +70,6 @@ static function (Iterator $iterator) use ($key, $default): Generator {
* @param mixed|null $default
*/
static function (Iterator $iterator, $target, array $key, $default = null) use (&$pick) {
// phpcs:enable
while (null !== $segment = array_shift($key)) {
if ('*' === $segment) {
if (false === is_iterable($target)) {
Expand All @@ -88,7 +89,6 @@ static function (Iterator $iterator, $target, array $key, $default = null) use (
return in_array('*', $key, true) ? $collapse : $result;
}

// phpcs:disable
if ((true === is_array($target)) && (true === array_key_exists($segment, $target))) {
/** @psalm-var T $target */
$target = $target[$segment];
Expand All @@ -105,19 +105,16 @@ static function (Iterator $iterator, $target, array $key, $default = null) use (
/** @psalm-var T $target */
$target = $default;
}
// phpcs:enable
}

return $target;
};

$key = true === is_scalar($key) ? explode('.', trim((string) $key, '.')) : $key;

// phpcs:disable
foreach ($iterator as $value) {
yield $pick($iterator, $value, $key, $default);
}
// phpcs:enable
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/Reduce.php
Expand Up @@ -12,14 +12,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class Reduce extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure(callable(T|null, T, TKey, Iterator<TKey, T>): T): Closure(T|null): Closure(Iterator<TKey, T>): Generator<TKey, T>
*/
// phpcs:enable
public function __invoke(): Closure
{
return
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/Reduction.php
Expand Up @@ -12,14 +12,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class Reduction extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure(callable(T|null, T, TKey):(T|null)): Closure(T|null): Closure(Iterator<TKey, T>): Generator<TKey, T>
*/
// phpcs:enable
public function __invoke(): Closure
{
return
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/Scale.php
Expand Up @@ -14,14 +14,14 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
*/
final class Scale extends AbstractOperation
{
// phpcs:disable
/**
* @psalm-return Closure(float): Closure(float): Closure(float): Closure(float): Closure(float): Closure(Iterator<TKey, float|int>): Generator<TKey, float|int>
*/
// phpcs:enable
public function __invoke(): Closure
{
return static function (float $lowerBound): Closure {
Expand Down
6 changes: 4 additions & 2 deletions src/Operation/Until.php
Expand Up @@ -12,6 +12,9 @@
* @psalm-template TKey
* @psalm-template TKey of array-key
* @psalm-template T
*
* phpcs:disable Generic.Files.LineLength.TooLong
* phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
*/
final class Until extends AbstractOperation
{
Expand Down Expand Up @@ -62,7 +65,7 @@ static function (bool $carry, callable $callable) use ($key, $value): bool {
};
};
};
// phpcs:disable

foreach ($iterator as $key => $value) {
yield $key => $value;

Expand All @@ -76,7 +79,6 @@ static function (bool $carry, callable $callable) use ($key, $value): bool {
break;
}
}
// phpcs:enable
};
};
}
Expand Down

0 comments on commit 72a13e4

Please sign in to comment.