Skip to content

Commit

Permalink
Revert non-empty-array specification for Assert::uniqueValues
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm authored and ondrejmirtes committed Mar 30, 2024
1 parent 0307f23 commit c1739d0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
25 changes: 0 additions & 25 deletions src/Type/WebMozartAssert/AssertTypeSpecifyingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,6 @@ private function getExpressionResolvers(): array
)
);
},
'uniqueValues' => static function (Scope $scope, Arg $value): array {
return self::createIsNonEmptyArrayAndSomethingExprPair('uniqueValues', [$value]);
},
];

foreach (['contains', 'startsWith', 'endsWith'] as $name) {
Expand Down Expand Up @@ -1005,28 +1002,6 @@ private static function createIsNonEmptyStringAndSomethingExprPair(string $name,
return [$expr, $rootExpr];
}

/**
* @param Arg[] $args
* @return array{Expr, Expr}
*/
private static function createIsNonEmptyArrayAndSomethingExprPair(string $name, array $args): array
{
$expr = new GreaterOrEqual(
new FuncCall(
new Name('count'),
[$args[0]]
),
new LNumber(1)
);

$rootExpr = new BooleanAnd(
$expr,
new FuncCall(new Name('FAUX_FUNCTION_ ' . $name), $args)
);

return [$expr, $rootExpr];
}

private function specifyRootExprIfSet(?Expr $rootExpr, SpecifiedTypes $specifiedTypes): SpecifiedTypes
{
if ($rootExpr === null) {
Expand Down
6 changes: 0 additions & 6 deletions tests/Type/WebMozartAssert/data/type.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,6 @@ public function isArrayAccessible($a, $b): void
Assert::nullOrIsArrayAccessible($b);
assertType('array|ArrayAccess|null', $b);
}

public function uniqueValues(array $a): void
{
Assert::uniqueValues($a);
assertType('non-empty-array', $a);
}
}

class Foo {}
Expand Down

0 comments on commit c1739d0

Please sign in to comment.