Skip to content

tests: add full PHPStan typing tests#19

Merged
delacry merged 1 commit into
noctud:0.1.xfrom
nikophil:add-type-tests
Jul 25, 2026
Merged

tests: add full PHPStan typing tests#19
delacry merged 1 commit into
noctud:0.1.xfrom
nikophil:add-type-tests

Conversation

@nikophil

@nikophil nikophil commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Here is a proposal for a full "test type suite" that covers all the code

I tried to limit the number of files, hence the test/Type/Collection which casts to Collection the subject of the tests:

/** @var Collection<int> $c */
$c = listOf([1, 2, 3]);

I also tried to only cover stuff which is useful, and deals with generics notation

don't hesitate if you feel like some tests are not useful or redundant

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/List/ListInterface.php
Comment thread tests/Type/Collection/TransformTypeTest.php
@delacry

delacry commented Jul 18, 2026

Copy link
Copy Markdown
Member

Thanks! This was really needed, I'll review it in detail probably next week.

@delacry
delacry merged commit 1def5aa into noctud:0.1.x Jul 25, 2026
6 checks passed
delacry added a commit that referenced this pull request Jul 25, 2026
Update the API reference for narrowing that landed in #15, #17, #18,
#19, #21 and #22: flatten(), filterNotNull(),
Map::filterValuesNotNull(), countWhere(), Collection::sum() and
Map::toArray().

Compact types are inlined in the signature (countWhere(): int<0, max>);
conditional ones are described in prose instead, matching how sum() and
intersect() are already documented.

Also fix the flatten() assertion in TransformTypeTest, which still
expected Collection<mixed> and has failed on 0.1.x since #21.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants