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

azjezz / psl / 17432557268

03 Sep 2025 11:52AM UTC coverage: 98.446% (-0.07%) from 98.513%
17432557268

push

github

web-flow
chore: migrate from `psalm` to `mago` (#527)

232 of 241 new or added lines in 81 files covered. (96.27%)

14 existing lines in 12 files now uncovered.

5510 of 5597 relevant lines covered (98.45%)

52.23 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

© 2025 Coveralls, Inc