• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

azjezz / psl / 22520865518

28 Feb 2026 12:36PM UTC coverage: 97.768% (+0.2%) from 97.532%
22520865518

Pull #586

github

azjezz
more tests

Signed-off-by: azjezz <azjezz@protonmail.com>
Pull Request #586: add more tests

16 of 16 new or added lines in 4 files covered. (100.0%)

20 existing lines in 13 files now uncovered.

7492 of 7663 relevant lines covered (97.77%)

43.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/Psl/Type/Internal/ArrayKeyType.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Psl\Type\Internal;
6

7
use function is_int;
8
use function is_string;
9

10
/**
11
 * @extends UnionType<string, int>
12
 *
13
 * @internal
14
 */
15
final readonly class ArrayKeyType extends UnionType
16
{
17
    /**
18
     * @psalm-mutation-free
19
     */
20
    public function __construct()
21
    {
UNCOV
22
        parent::__construct(new StringType(), new IntType());
×
23
    }
24

25
    #[\Override]
26
    public function matches(mixed $value): bool
27
    {
28
        return is_string($value) || is_int($value);
75✔
29
    }
30

31
    #[\Override]
32
    public function assert(mixed $value): mixed
33
    {
34
        // happy path performance optimization:
35
        if (is_string($value) || is_int($value)) {
80✔
36
            return $value;
54✔
37
        }
38

39
        return parent::assert($value);
26✔
40
    }
41

42
    #[\Override]
43
    public function coerce(mixed $value): mixed
44
    {
45
        // happy path performance optimization:
46
        if (is_string($value) || is_int($value)) {
32✔
47
            return $value;
18✔
48
        }
49

50
        return parent::coerce($value);
16✔
51
    }
52

53
    #[\Override]
54
    public function toString(): string
55
    {
56
        return 'array-key';
63✔
57
    }
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc