Skip to content

Commit

Permalink
Mark closure arguments as always-provided (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
bronek89 authored Oct 6, 2022
1 parent 6e55673 commit dc4adbe
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ foreach ($array as $key => $value) {
```php
<?php
/**
* @phpstan-param callable(TValue, TKey $key=):void $callback
* @phpstan-param callable(TValue, TKey $key):void $callback
* @phpstan-return AssocValue<TKey, TValue>
*/
public function each(callable $callback): AssocValue;
Expand Down Expand Up @@ -1391,7 +1391,7 @@ public function filterEmpty(): AssocValue;
<?php
/**
* @template TNewValue
* @param callable(TValue,TKey $key=):TNewValue $transformer
* @param callable(TValue,TKey $key):TNewValue $transformer
* @phpstan-return AssocValue<TKey, TNewValue>
*/
public function map(callable $transformer): AssocValue;
Expand Down Expand Up @@ -1532,7 +1532,7 @@ public function values(): ArrayValue;
<?php
/**
* @template TNewKey of int|string
* @phpstan-param callable(TKey $key, TValue $value=): TNewKey $transformer
* @phpstan-param callable(TKey $key, TValue $value): TNewKey $transformer
* @phpstan-return AssocValue<TNewKey, TValue>
*/
public function mapKeys(callable $transformer): AssocValue;
Expand Down Expand Up @@ -3916,7 +3916,7 @@ array (
<?php
/**
* @template TNewValue
* @param callable(TValue,TKey $key=):TNewValue $transformer
* @param callable(TValue,TKey $key):TNewValue $transformer
* @phpstan-return IterableValue<TKey, TNewValue>
*/
public function map(callable $transformer): IterableValue;
Expand Down
6 changes: 3 additions & 3 deletions src/AssocArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($items)

/**
* @template TNewValue
* @phpstan-param callable(TValue $value, TKey $key=):TNewValue $transformer
* @phpstan-param callable(TValue $value, TKey $key):TNewValue $transformer
* @phpstan-return AssocArray<TKey, TNewValue>
*/
public function map(callable $transformer): AssocArray
Expand All @@ -67,7 +67,7 @@ public function keys(): ArrayValue

/**
* @template TNewKey of int|string
* @param callable(TKey $key, TValue $value=): TNewKey $transformer
* @param callable(TKey $key, TValue $value): TNewKey $transformer
* @phpstan-return AssocArray<TNewKey, TValue>
*/
public function mapKeys(callable $transformer): AssocArray
Expand Down Expand Up @@ -127,7 +127,7 @@ public function sortKeys(callable $comparator): AssocArray
}

/**
* @phpstan-param callable(TValue $value, TKey $key=):void $callback
* @phpstan-param callable(TValue $value, TKey $key):void $callback
* @phpstan-return AssocArray<TKey, TValue>
*/
public function each(callable $callback): AssocArray
Expand Down
6 changes: 3 additions & 3 deletions src/AssocValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
interface AssocValue extends Value, Collection, IteratorAggregate, ArrayAccess, Associable
{
/**
* @phpstan-param callable(TValue, TKey $key=):void $callback
* @phpstan-param callable(TValue, TKey $key):void $callback
* @phpstan-return AssocValue<TKey, TValue>
*/
public function each(callable $callback): AssocValue;
Expand All @@ -41,7 +41,7 @@ public function filterEmpty(): AssocValue;

/**
* @template TNewValue
* @param callable(TValue,TKey $key=):TNewValue $transformer
* @param callable(TValue,TKey $key):TNewValue $transformer
* @phpstan-return AssocValue<TKey, TNewValue>
*/
public function map(callable $transformer): AssocValue;
Expand Down Expand Up @@ -107,7 +107,7 @@ public function values(): ArrayValue;

/**
* @template TNewKey of int|string
* @phpstan-param callable(TKey $key, TValue $value=): TNewKey $transformer
* @phpstan-param callable(TKey $key, TValue $value): TNewKey $transformer
* @phpstan-return AssocValue<TNewKey, TValue>
*/
public function mapKeys(callable $transformer): AssocValue;
Expand Down
4 changes: 2 additions & 2 deletions src/Associable/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ final class Map implements Associable
{
/** @var Associable<TKey,TValue> */
private Associable $associable;
/** @var callable(TValue $value, TKey $key=):TNewValue */
/** @var callable(TValue $value, TKey $key):TNewValue */
private $transformer;

/**
* @param Associable<TKey,TValue> $associable
* @param callable(TValue $value, TKey $key=):TNewValue $transformer
* @param callable(TValue $value, TKey $key):TNewValue $transformer
*/
public function __construct(Associable $associable, callable $transformer)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Associable/MapKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ final class MapKeys implements Associable
{
/** @var Associable<TKey,TValue> */
private Associable $associable;
/** @var callable(TKey $key, TValue $value=):TNewKey */
/** @var callable(TKey $key, TValue $value):TNewKey */
private $transformer;

/**
* @param Associable<TKey,TValue> $associable
* @param callable(TKey $key, TValue $value=):TNewKey $transformer
* @param callable(TKey $key, TValue $value):TNewKey $transformer
*/
public function __construct(Associable $associable, callable $transformer)
{
Expand Down
2 changes: 1 addition & 1 deletion src/InfiniteIterableValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function filterEmpty(): InfiniteIterableValue

/**
* @template TNewValue
* @param callable(TValue,TKey $key=):TNewValue $transformer
* @param callable(TValue,TKey $key):TNewValue $transformer
* @phpstan-return InfiniteIterableValue<TKey, TNewValue>
*/
public function map(callable $transformer): InfiniteIterableValue
Expand Down
2 changes: 1 addition & 1 deletion src/IterableValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function filterEmpty(): IterableValue;

/**
* @template TNewValue
* @param callable(TValue,TKey $key=):TNewValue $transformer
* @param callable(TValue,TKey $key):TNewValue $transformer
* @phpstan-return IterableValue<TKey, TNewValue>
*/
public function map(callable $transformer): IterableValue;
Expand Down

0 comments on commit dc4adbe

Please sign in to comment.