mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Adds type hinting
This commit is contained in:
@ -12,9 +12,12 @@ use Pest\Expectation;
|
||||
trait Expectable
|
||||
{
|
||||
/**
|
||||
* @template TValue
|
||||
*
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param TValue $value
|
||||
* @return Expectation<TValue>
|
||||
*/
|
||||
public function expect($value): Expectation
|
||||
{
|
||||
|
||||
@ -10,14 +10,14 @@ namespace Pest\Concerns;
|
||||
trait RetrievesValues
|
||||
{
|
||||
/**
|
||||
* @template TValue
|
||||
* @template TRetrievableValue
|
||||
*
|
||||
* Safely retrieve the value at the given key from an object or array.
|
||||
*
|
||||
* @param array<string, TValue>|object $value
|
||||
* @param TValue|null $default
|
||||
* @param array<string, TRetrievableValue>|object $value
|
||||
* @param TRetrievableValue|null $default
|
||||
*
|
||||
* @return TValue|null
|
||||
* @return TRetrievableValue|null
|
||||
*/
|
||||
private function retrieve(string $key, $value, $default = null)
|
||||
{
|
||||
|
||||
@ -16,6 +16,8 @@ use SebastianBergmann\Exporter\Exporter;
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @template TValue
|
||||
*
|
||||
* @property Expectation $not Creates the opposite expectation.
|
||||
* @property Each $each Creates an expectation on each element on the traversable value.
|
||||
*/
|
||||
@ -47,7 +49,7 @@ final class Expectation
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param TValue $value
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
@ -57,7 +59,8 @@ final class Expectation
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param TValue $value
|
||||
* @return Expectation<TValue>
|
||||
*/
|
||||
public function and($value): Expectation
|
||||
{
|
||||
@ -722,7 +725,7 @@ final class Expectation
|
||||
*
|
||||
* @param array<int, mixed> $parameters
|
||||
*
|
||||
* @return mixed
|
||||
* @return HigherOrderExpectation|mixed
|
||||
*/
|
||||
public function __call(string $method, array $parameters)
|
||||
{
|
||||
|
||||
@ -66,7 +66,7 @@ final class HigherOrderExpectation
|
||||
/**
|
||||
* Dynamically calls methods on the class with the given arguments.
|
||||
*
|
||||
* @param array<int|string, mixed> $arguments
|
||||
* @param array $arguments
|
||||
*/
|
||||
public function __call(string $name, array $arguments): self
|
||||
{
|
||||
@ -115,7 +115,7 @@ final class HigherOrderExpectation
|
||||
/**
|
||||
* Performs the given assertion with the current expectation.
|
||||
*
|
||||
* @param array<int|string, mixed> $arguments
|
||||
* @param array $arguments
|
||||
*/
|
||||
private function performAssertion(string $name, array $arguments): self
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user