Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
Failure
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 key
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 invalid
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 message
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Sire;
6
7/** @api */
8final readonly class Failure
9{
10    /** @param list<mixed> $args */
11    public function __construct(
12        public string $key = '',
13        public array $args = [],
14        public ?string $fallback = null,
15    ) {}
16
17    public static function key(string $key, mixed ...$args): self
18    {
19        /** @var list<mixed> $list */
20        $list = $args;
21
22        return new self($key, $list);
23    }
24
25    public static function invalid(?string $fallback = null, mixed ...$args): self
26    {
27        /** @var list<mixed> $list */
28        $list = $args;
29
30        return new self(args: $list, fallback: $fallback);
31    }
32
33    public static function message(string $message): self
34    {
35        return self::invalid(fallback: $message);
36    }
37}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Failure->__construct
12        public string $key = '',
13        public array $args = [],
14        public ?string $fallback = null,
15    ) {}
Failure->invalid
25    public static function invalid(?string $fallback = null, mixed ...$args): self
26    {
27        /** @var list<mixed> $list */
28        $list = $args;
29
30        return new self(args: $list, fallback: $fallback);
31    }
Failure->key
17    public static function key(string $key, mixed ...$args): self
18    {
19        /** @var list<mixed> $list */
20        $list = $args;
21
22        return new self($key, $list);
23    }
Failure->message
33    public static function message(string $message): self
34    {
35        return self::invalid(fallback: $message);
36    }