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

DoclerLabs / api-client-generator / 7199090358

13 Dec 2023 05:49PM UTC coverage: 89.612% (-0.4%) from 90.043%
7199090358

Pull #102

github

vsouz4
changelog
Pull Request #102: generator php 8

355 of 385 new or added lines in 40 files covered. (92.21%)

6 existing lines in 4 files now uncovered.

2657 of 2965 relevant lines covered (89.61%)

3.34 hits per line

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

65.0
/src/Ast/PhpVersion.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace DoclerLabs\ApiClientGenerator\Ast;
6

7
use UnexpectedValueException;
8

9
class PhpVersion
10
{
11
    public const VERSION_PHP70 = 7.0;
12

13
    public const VERSION_PHP71 = 7.1;
14

15
    public const VERSION_PHP72 = 7.2;
16

17
    public const VERSION_PHP73 = 7.3;
18

19
    public const VERSION_PHP74 = 7.4;
20

21
    public const VERSION_PHP80 = 8.0;
22

23
    private const SUPPORTED_VERSIONS = [
24
        self::VERSION_PHP70,
25
        self::VERSION_PHP71,
26
        self::VERSION_PHP72,
27
        self::VERSION_PHP73,
28
        self::VERSION_PHP74,
29
        self::VERSION_PHP80,
30
    ];
31

32
    public function __construct(private float $phpVersion)
33
    {
34
        if (!in_array($phpVersion, self::SUPPORTED_VERSIONS, true)) {
7✔
35
            $versions = json_encode(self::SUPPORTED_VERSIONS, JSON_THROW_ON_ERROR);
1✔
36

37
            throw new UnexpectedValueException(
1✔
38
                'Unsupported php version ' . $phpVersion . '. Should be one of ' . $versions
1✔
39
            );
40
        }
41
    }
6✔
42

43
    public function isClassConstantVisibilitySupported(): bool
44
    {
45
        return $this->isVersionGreaterThanOrEqualTo71();
2✔
46
    }
47

48
    public function isNullableTypeHintSupported(): bool
49
    {
50
        return $this->isVersionGreaterThanOrEqualTo71();
2✔
51
    }
52

53
    public function isVoidReturnTypeSupported(): bool
54
    {
55
        return $this->isVersionGreaterThanOrEqualTo71();
2✔
56
    }
57

58
    public function isPropertyTypeHintSupported(): bool
59
    {
60
        return $this->isVersionGreaterThanOrEqualTo74();
2✔
61
    }
62

63
    // @TODO check if being used otherwise remove
64
    public function isNamedArgumentSupported(): bool
65
    {
NEW
66
        return $this->isVersionGreaterThanOrEqualTo80();
×
67
    }
68

69
    // @TODO check if being used otherwise remove
70
    public function isAttributesSupported(): bool
71
    {
NEW
72
        return $this->isVersionGreaterThanOrEqualTo80();
×
73
    }
74

75
    // @TODO check if being used otherwise remove
76
    public function isConstructorPropertyPromotionSupported(): bool
77
    {
78
        return $this->isVersionGreaterThanOrEqualTo80();
1✔
79
    }
80

81
    // @TODO check if being used otherwise remove
82
    public function isUnionTypesSupported(): bool
83
    {
NEW
84
        return $this->isVersionGreaterThanOrEqualTo80();
×
85
    }
86

87
    // @TODO check if being used otherwise remove
88
    public function isMatchSupported(): bool
89
    {
NEW
90
        return $this->isVersionGreaterThanOrEqualTo80();
×
91
    }
92

93
    // @TODO check if being used otherwise remove
94
    public function isNullSafeSupported(): bool
95
    {
NEW
96
        return $this->isVersionGreaterThanOrEqualTo80();
×
97
    }
98

99
    // @TODO check if being used otherwise remove
100
    public function isCatchWithoutVariableSupported(): bool
101
    {
NEW
102
        return $this->isVersionGreaterThanOrEqualTo80();
×
103
    }
104

105
    // @TODO check if being used otherwise remove
106
    public function isMixedTypehintSupported(): bool
107
    {
NEW
108
        return $this->isVersionGreaterThanOrEqualTo80();
×
109
    }
110

111
    private function isVersionGreaterThanOrEqualTo71(): bool
112
    {
113
        return $this->phpVersion >= (float)self::VERSION_PHP71;
4✔
114
    }
115

116
    private function isVersionGreaterThanOrEqualTo74(): bool
117
    {
118
        return $this->phpVersion >= (float)self::VERSION_PHP74;
2✔
119
    }
120

121
    private function isVersionGreaterThanOrEqualTo80(): bool
122
    {
123
        return $this->phpVersion >= (float)self::VERSION_PHP80;
1✔
124
    }
125
}
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