mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
refactor: PHP 8 features
This commit is contained in:
@ -6,8 +6,6 @@ namespace Pest\Support;
|
||||
|
||||
use Closure;
|
||||
use Pest\Expectation;
|
||||
use Pest\PendingObjects\TestCall;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@ -15,13 +13,11 @@ use PHPUnit\Framework\TestCase;
|
||||
final class HigherOrderCallables
|
||||
{
|
||||
/**
|
||||
* @var object
|
||||
* Creates a new Higher Order Callables instances.
|
||||
*/
|
||||
private $target;
|
||||
|
||||
public function __construct(object $target)
|
||||
public function __construct(private object $target)
|
||||
{
|
||||
$this->target = $target;
|
||||
// ..
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,7 +29,7 @@ final class HigherOrderCallables
|
||||
*
|
||||
* @return Expectation<TValue>
|
||||
*/
|
||||
public function expect($value)
|
||||
public function expect(mixed $value): Expectation
|
||||
{
|
||||
return new Expectation($value instanceof Closure ? Reflection::bindCallableWithData($value) : $value);
|
||||
}
|
||||
@ -47,17 +43,15 @@ final class HigherOrderCallables
|
||||
*
|
||||
* @return Expectation<TValue>
|
||||
*/
|
||||
public function and($value)
|
||||
public function and(mixed $value)
|
||||
{
|
||||
return $this->expect($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tap into the test case to perform an action and return the test case.
|
||||
*
|
||||
* @return TestCall|TestCase|object
|
||||
*/
|
||||
public function tap(callable $callable)
|
||||
public function tap(callable $callable): object
|
||||
{
|
||||
Reflection::bindCallableWithData($callable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user