Improved generics for higher order

This commit is contained in:
luke
2021-11-27 19:20:29 +00:00
parent beb14ce5f4
commit d65cc9be84

View File

@ -7,9 +7,9 @@ namespace Pest;
/** /**
* @internal * @internal
* *
* @template TEachValue * @template TValue
* *
* @mixin Expectation<TEachValue> * @mixin Expectation<TValue>
*/ */
final class Each final class Each
{ {
@ -18,7 +18,7 @@ final class Each
/** /**
* Creates an expectation on each item of the iterable "value". * Creates an expectation on each item of the iterable "value".
* *
* @param Expectation<TEachValue> $original * @param Expectation<TValue> $original
*/ */
public function __construct(private Expectation $original) public function __construct(private Expectation $original)
{ {
@ -27,11 +27,11 @@ final class Each
/** /**
* Creates a new expectation. * Creates a new expectation.
* *
* @template TValue * @template TAndValue
* *
* @param TValue $value * @param TAndValue $value
* *
* @return Expectation<TValue> * @return Expectation<TAndValue>
*/ */
public function and(mixed $value): Expectation public function and(mixed $value): Expectation
{ {
@ -41,7 +41,7 @@ final class Each
/** /**
* Creates the opposite expectation for the value. * Creates the opposite expectation for the value.
* *
* @return self<TEachValue> * @return self<TValue>
*/ */
public function not(): Each public function not(): Each
{ {
@ -55,7 +55,7 @@ final class Each
* *
* @param array<int|string, mixed> $arguments * @param array<int|string, mixed> $arguments
* *
* @return self<TEachValue> * @return self<TValue>
*/ */
public function __call(string $name, array $arguments): Each public function __call(string $name, array $arguments): Each
{ {
@ -72,7 +72,7 @@ final class Each
/** /**
* Dynamically calls methods on the class without any arguments on each item. * Dynamically calls methods on the class without any arguments on each item.
* *
* @return self<TEachValue> * @return self<TValue>
*/ */
public function __get(string $name): Each public function __get(string $name): Each
{ {