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

tylernathanreed / jira-client-php / 13857440588

14 Mar 2025 01:18PM UTC coverage: 70.825% (-0.06%) from 70.885%
13857440588

push

github

tylernathanreed
~ Fixed nested objects in test examples

9 of 9 new or added lines in 1 file covered. (100.0%)

524 existing lines in 407 files now uncovered.

4826 of 6814 relevant lines covered (70.82%)

8.59 hits per line

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

86.67
/src/Dto.php
1
<?php
2

3
namespace Jira\Client;
4

5
use JsonSerializable;
6
use ReflectionClass;
7
use ReflectionProperty;
8

9
abstract readonly class Dto implements JsonSerializable
10
{
11
    /** @return array<string,mixed> */
12
    public function toArray(): array
145✔
13
    {
14
        $properties = [];
145✔
15

16
        foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
145✔
17
            $properties[$property->getName()] = $property->getValue($this);
145✔
18
        }
19

20
        return static::arrayify($properties);
145✔
21
    }
22

23
    /** @return array<string,mixed> */
UNCOV
24
    public function jsonSerialize(): array
×
25
    {
26
        return $this->toArray();
×
27
    }
28

29
    /**
30
     * @phpstan-template TKey of int|string
31
     * @phpstan-template TValue of mixed
32
     * @phpstan-template TScalar of string|int|float|bool|null
33
     *
34
     * @param Dto|array<TKey,TValue>|TScalar $value
35
     * @return ($value is Dto ? array<string,mixed> : ($value is array ? array<TKey,TValue> : TScalar))
36
     */
37
    protected static function arrayify(Dto|array|string|int|float|bool|null $value): array|string|int|float|bool|null
145✔
38
    {
39
        if ($value instanceof Dto) {
145✔
40
            return static::arrayify($value->toArray());
42✔
41
        }
42

43
        if (is_array($value)) {
145✔
44
            // @phpstan-ignore argument.type
45
            return array_map(function (Dto|array|string|int|float|bool|null $v): array|string|int|float|bool|null {
145✔
46
                // @phpstan-ignore argument.templateType
47
                return static::arrayify($v);
145✔
48
            }, $value);
145✔
49
        }
50

51
        return $value;
145✔
52
    }
53
}
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