Skip to content

chore: more specific return type for chunk() method #1956

chore: more specific return type for chunk() method

chore: more specific return type for chunk() method #1956

Triggered via pull request November 26, 2024 12:05
Status Failure
Total duration 1m 11s
Artifacts

static-analysis.yml

on: pull_request
Matrix: Static Analysis
Fit to window
Zoom out
Zoom in

Annotations

19 errors and 1 warning
Static Analysis (ubuntu-latest, 8.1): tests/static-analysis/chunk.php#L19
Parameter #1 $collection of function chunk_checkList expects loophp\collection\Contract\Collection<int, array<int, int>>, loophp\collection\Contract\Collection<int, non-empty-array<int, int>> given.
Static Analysis (ubuntu-latest, 8.1): tests/static-analysis/chunk.php#L20
Parameter #1 $collection of function chunk_checkList expects loophp\collection\Contract\Collection<int, array<int, int>>, loophp\collection\Contract\Collection<int, non-empty-array<int, int>> given.
Static Analysis (ubuntu-latest, 8.1): tests/static-analysis/chunk.php#L24
Parameter #1 $collection of function chunk_checkMap expects loophp\collection\Contract\Collection<int, array<int, string>>, loophp\collection\Contract\Collection<int, non-empty-array<int, string>> given.
Static Analysis (ubuntu-latest, 8.1): tests/static-analysis/chunk.php#L26
Parameter #1 $collection of function chunk_checkMap expects loophp\collection\Contract\Collection<int, array<int, string>>, loophp\collection\Contract\Collection<int, non-empty-array<int, string>> given.
InvalidReturnStatement: src/Collection.php#L97
src/Collection.php:97:16: InvalidReturnStatement: The inferred type 'loophp\collection\Collection<int, list<mixed>>' does not match the declared return type 'loophp\collection\Contract\Collection<int, non-empty-list<T:loophp\collection\Collection as mixed>>' for loophp\collection\Collection::chunk (see https://psalm.dev/128)
InvalidReturnType: src/Collection.php#L881
src/Collection.php:881:29: InvalidReturnType: The declared return type 'loophp\collection\Contract\Collection<int, array<TKey:loophp\collection\Collection as mixed, T:loophp\collection\Collection as mixed>>' for loophp\collection\Collection::wrap is incorrect, got 'loophp\collection\Collection<int, array<array-key, mixed>>' (see https://psalm.dev/011)
InvalidArgument: tests/static-analysis/chunk.php#L19
tests/static-analysis/chunk.php:19:17: InvalidArgument: Argument 1 of chunk_checkList expects loophp\collection\Contract\Collection<int, list<int>>, but loophp\collection\Contract\Collection<int, non-empty-list<int>> provided (see https://psalm.dev/004)
InvalidArgument: tests/static-analysis/chunk.php#L20
tests/static-analysis/chunk.php:20:17: InvalidArgument: Argument 1 of chunk_checkList expects loophp\collection\Contract\Collection<int, list<int>>, but loophp\collection\Contract\Collection<int, non-empty-list<int>> provided (see https://psalm.dev/004)
Static Analysis (ubuntu-latest, 8.1)
Process completed with exit code 1.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L102
Method loophp\collection\Collection::coalesce() should return loophp\collection\Contract\Collection<TKey, T> but returns loophp\collection\Collection<mixed, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L107
Method loophp\collection\Collection::collapse() should return loophp\collection\Contract\Collection<TKey, T> but returns loophp\collection\Collection<mixed, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L164
Method loophp\collection\Collection::cycle() should return loophp\collection\Contract\Collection<TKey, T> but returns loophp\collection\Collection<mixed, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L311
Method loophp\collection\Collection::flip() should return loophp\collection\Contract\Collection<T, TKey> but returns loophp\collection\Collection<mixed, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L341
Method loophp\collection\Collection::frequency() should return loophp\collection\Contract\Collection<int, T> but returns loophp\collection\Collection<int, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L467
Method loophp\collection\Collection::init() should return loophp\collection\Contract\Collection<TKey, T> but returns loophp\collection\Collection<mixed, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L515
Method loophp\collection\Collection::keys() should return loophp\collection\Contract\Collection<int, TKey> but returns loophp\collection\Collection<int, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L570
Method loophp\collection\Collection::normalize() should return loophp\collection\Contract\Collection<int, T> but returns loophp\collection\Collection<int, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L595
Method loophp\collection\Collection::pair() should return loophp\collection\Contract\Collection<T, T|null> but returns loophp\collection\Collection<mixed, mixed>.
Static Analysis (ubuntu-latest, 8.1): src/Collection.php#L666
Method loophp\collection\Collection::reverse() should return loophp\collection\Contract\Collection<TKey, T> but returns loophp\collection\Collection<mixed, mixed>.
Static Analysis (ubuntu-latest, 8.1)
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/cache@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/