mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: toBeFinal
This commit is contained in:
@ -7,6 +7,7 @@ namespace Pest;
|
||||
use BadMethodCallException;
|
||||
use Closure;
|
||||
use Pest\Arch\Contracts\ArchExpectation;
|
||||
use Pest\Arch\Expectations\ToBeFinal;
|
||||
use Pest\Arch\Expectations\ToBeUsedIn;
|
||||
use Pest\Arch\Expectations\ToBeUsedInNothing;
|
||||
use Pest\Arch\Expectations\ToOnlyBeUsedIn;
|
||||
@ -372,14 +373,20 @@ final class Expectation
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target use the "declare(strict_types=1)" declaration.
|
||||
*
|
||||
* @param array<int, string>|string $targets
|
||||
*/
|
||||
public function toUseStrictTypes(): ArchExpectation
|
||||
{
|
||||
return ToUseStrictTypes::make($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target is final.
|
||||
*/
|
||||
public function toBeFinal(): ArchExpectation
|
||||
{
|
||||
return ToBeFinal::make($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target "only" use on the given dependencies.
|
||||
*
|
||||
|
||||
@ -7,6 +7,7 @@ namespace Pest\Expectations;
|
||||
use Pest\Arch\Contracts\ArchExpectation;
|
||||
use Pest\Arch\Exceptions\ArchExpectationFailedException;
|
||||
use Pest\Arch\Expectations\NotToUseStrictTypes;
|
||||
use Pest\Arch\Expectations\ToBeFinal;
|
||||
use Pest\Arch\Expectations\ToBeUsedIn;
|
||||
use Pest\Arch\Expectations\ToBeUsedInNothing;
|
||||
use Pest\Arch\Expectations\ToUse;
|
||||
@ -83,6 +84,14 @@ final class OppositeExpectation
|
||||
return ToUseStrictTypes::make($this->original, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given expectation target is final.
|
||||
*/
|
||||
public function toBeFinal(): ArchExpectation
|
||||
{
|
||||
return ToBeFinal::make($this->original, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string>|string $targets
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user