Skip to content

Commit

Permalink
tests: update diff SA tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Nov 2, 2022
1 parent 28e7663 commit 0af490e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/Contract/Operation/Diffable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ interface Diffable
*
* @see https://loophp-collection.readthedocs.io/en/stable/pages/api.html#diff
*
* @param T ...$values
* @template U
*
* @param U ...$values
*
* @return Collection<TKey, T>
*/
Expand Down
10 changes: 4 additions & 6 deletions tests/static-analysis/diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ function diff_checkMap(CollectionInterface $collection): void
diff_checkMap(Collection::fromIterable(['foo' => 'f', 'bar' => 'b'])->diff(...(static fn (): Generator => yield 'bar' => 'b')()));

// VALID failures -> usage with wrong types
/** @psalm-suppress InvalidArgument @phpstan-ignore-next-line */
/** @psalm-suppress InvalidArgument */
diff_checkList(Collection::fromIterable([1, 2, 3])->diff('a'));
/** @psalm-suppress InvalidArgument @phpstan-ignore-next-line */
/** @psalm-suppress InvalidArgument */
diff_checkList(Collection::fromIterable([1, 2, 3])->diff(1, 'a'));
/** @phpstan-ignore-next-line */
diff_checkList(Collection::fromIterable([1, 2, 3])->diff(...$stringCol));

/** @psalm-suppress InvalidArgument @phpstan-ignore-next-line */
/** @psalm-suppress InvalidArgument */
diff_checkMap(Collection::fromIterable(['foo' => 'f', 'bar' => 'b'])->diff(1));
/** @psalm-suppress InvalidArgument @phpstan-ignore-next-line */
/** @psalm-suppress InvalidArgument */
diff_checkMap(Collection::fromIterable(['foo' => 'f', 'bar' => 'b'])->diff(1, 'f'));
/** @phpstan-ignore-next-line */
diff_checkMap(Collection::fromIterable(['foo' => 'f', 'bar' => 'b'])->diff(...$intCol));

0 comments on commit 0af490e

Please sign in to comment.