mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: types on arch expectations
This commit is contained in:
@ -290,15 +290,11 @@ final class Expectation
|
|||||||
return new HigherOrderExpectation($this, call_user_func_array($this->value->$method(...), $parameters));
|
return new HigherOrderExpectation($this, call_user_func_array($this->value->$method(...), $parameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = ExpectationPipeline::for($this->getExpectationClosure($method))
|
ExpectationPipeline::for($this->getExpectationClosure($method))
|
||||||
->send(...$parameters)
|
->send(...$parameters)
|
||||||
->through($this->pipes($method, $this, Expectation::class))
|
->through($this->pipes($method, $this, Expectation::class))
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
if ($result !== null) {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +359,7 @@ final class Expectation
|
|||||||
* Asserts that the layer depends (not exclusively) on the given layers.
|
* Asserts that the layer depends (not exclusively) on the given layers.
|
||||||
*
|
*
|
||||||
* @param array<int, string>|string $targets
|
* @param array<int, string>|string $targets
|
||||||
* @return ArchExpectation<TValue>
|
* @return ArchExpectation<string>
|
||||||
*/
|
*/
|
||||||
public function toDependOn(array|string $targets): ArchExpectation
|
public function toDependOn(array|string $targets): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -374,7 +370,7 @@ final class Expectation
|
|||||||
* Asserts that the layer only depends on the given layers.
|
* Asserts that the layer only depends on the given layers.
|
||||||
*
|
*
|
||||||
* @param array<int, string>|string $targets
|
* @param array<int, string>|string $targets
|
||||||
* @return ArchExpectation<TValue>
|
* @return ArchExpectation<string>
|
||||||
*/
|
*/
|
||||||
public function toOnlyDependOn(array|string $targets): ArchExpectation
|
public function toOnlyDependOn(array|string $targets): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -384,8 +380,7 @@ final class Expectation
|
|||||||
/**
|
/**
|
||||||
* Asserts that the layer is not allowed to depend on any other layer.
|
* Asserts that the layer is not allowed to depend on any other layer.
|
||||||
*
|
*
|
||||||
* @param array<int, string>|string $targets
|
* @return ArchExpectation<string>
|
||||||
* @return ArchExpectation<TValue>
|
|
||||||
*/
|
*/
|
||||||
public function toDependOnNothing(): ArchExpectation
|
public function toDependOnNothing(): ArchExpectation
|
||||||
{
|
{
|
||||||
|
|||||||
@ -60,7 +60,7 @@ final class OppositeExpectation
|
|||||||
* Asserts that the layer does not depend on the given layers.
|
* Asserts that the layer does not depend on the given layers.
|
||||||
*
|
*
|
||||||
* @param array<int, string>|string $targets
|
* @param array<int, string>|string $targets
|
||||||
* @return ArchExpectation<TValue>
|
* @return ArchExpectation<string>
|
||||||
*/
|
*/
|
||||||
public function toDependOn(array|string $targets): ArchExpectation
|
public function toDependOn(array|string $targets): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ final class OppositeExpectation
|
|||||||
* Asserts that the layer does not only depends on the given layers.
|
* Asserts that the layer does not only depends on the given layers.
|
||||||
*
|
*
|
||||||
* @param array<int, string>|string $targets
|
* @param array<int, string>|string $targets
|
||||||
* @return ArchExpectation<TValue>
|
* @return ArchExpectation<string>
|
||||||
*/
|
*/
|
||||||
public function toOnlyDependOn(array|string $targets): ArchExpectation
|
public function toOnlyDependOn(array|string $targets): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ final class OppositeExpectation
|
|||||||
/**
|
/**
|
||||||
* Asserts that the layer is depends on at least one layer.
|
* Asserts that the layer is depends on at least one layer.
|
||||||
*
|
*
|
||||||
* @return ArchExpectation<TValue>
|
* @return ArchExpectation<string>
|
||||||
*/
|
*/
|
||||||
public function toDependOnNothing(): ArchExpectation
|
public function toDependOnNothing(): ArchExpectation
|
||||||
{
|
{
|
||||||
@ -131,10 +131,12 @@ final class OppositeExpectation
|
|||||||
/**
|
/**
|
||||||
* Creates a new expectation failed exception with a nice readable message.
|
* Creates a new expectation failed exception with a nice readable message.
|
||||||
*
|
*
|
||||||
* @param array<int, mixed> $arguments
|
* @param array<int, mixed>|string $arguments
|
||||||
*/
|
*/
|
||||||
public function throwExpectationFailedException(string $name, array $arguments = []): never
|
public function throwExpectationFailedException(string $name, array|string $arguments = []): never
|
||||||
{
|
{
|
||||||
|
$arguments = is_array($arguments) ? $arguments : [$arguments];
|
||||||
|
|
||||||
$exporter = new Exporter();
|
$exporter = new Exporter();
|
||||||
|
|
||||||
$toString = fn ($argument): string => $exporter->shortenedExport($argument);
|
$toString = fn ($argument): string => $exporter->shortenedExport($argument);
|
||||||
|
|||||||
@ -8,10 +8,6 @@ use BadMethodCallException;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Error;
|
use Error;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Pest\Arch\ArchExpectation;
|
|
||||||
use Pest\Arch\Expectations\ToDependOn;
|
|
||||||
use Pest\Arch\Expectations\ToDependOnNothing;
|
|
||||||
use Pest\Arch\Expectations\ToOnlyDependOn;
|
|
||||||
use Pest\Exceptions\InvalidExpectationValue;
|
use Pest\Exceptions\InvalidExpectationValue;
|
||||||
use Pest\Matchers\Any;
|
use Pest\Matchers\Any;
|
||||||
use Pest\Support\Arr;
|
use Pest\Support\Arr;
|
||||||
|
|||||||
@ -158,11 +158,10 @@ final class DatasetsRepository
|
|||||||
$datasets[$index] = iterator_to_array($datasets[$index], false);
|
$datasets[$index] = iterator_to_array($datasets[$index], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
foreach ($datasets[$index] as $key => $values) {
|
foreach ($datasets[$index] as $key => $values) {
|
||||||
$values = is_array($values) ? $values : [$values];
|
$values = is_array($values) ? $values : [$values];
|
||||||
$processedDataset[] = [
|
$processedDataset[] = [
|
||||||
'label' => self::getDatasetDescription($key, $values), // @phpstan-ignore-line
|
'label' => self::getDatasetDescription($key, $values),
|
||||||
'values' => $values,
|
'values' => $values,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user