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

DoclerLabs / api-client-generator / 7259428899

19 Dec 2023 08:47AM UTC coverage: 89.733% (-0.3%) from 90.043%
7259428899

push

github

web-flow
Merge pull request #102 from DoclerLabs/generator-php-8

generator php 8

355 of 381 new or added lines in 40 files covered. (93.18%)

6 existing lines in 4 files now uncovered.

2657 of 2961 relevant lines covered (89.73%)

3.35 hits per line

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

81.25
/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
    public function isConstructorPropertyPromotionSupported(): bool
64
    {
65
        return $this->isVersionGreaterThanOrEqualTo80();
1✔
66
    }
67

68
    public function isMatchSupported(): bool
69
    {
NEW
70
        return $this->isVersionGreaterThanOrEqualTo80();
×
71
    }
72

73
    public function isNullSafeSupported(): bool
74
    {
NEW
75
        return $this->isVersionGreaterThanOrEqualTo80();
×
76
    }
77

78
    public function isMixedTypehintSupported(): bool
79
    {
NEW
80
        return $this->isVersionGreaterThanOrEqualTo80();
×
81
    }
82

83
    private function isVersionGreaterThanOrEqualTo71(): bool
84
    {
85
        return $this->phpVersion >= self::VERSION_PHP71;
4✔
86
    }
87

88
    private function isVersionGreaterThanOrEqualTo74(): bool
89
    {
90
        return $this->phpVersion >= self::VERSION_PHP74;
2✔
91
    }
92

93
    private function isVersionGreaterThanOrEqualTo80(): bool
94
    {
95
        return $this->phpVersion >= self::VERSION_PHP80;
1✔
96
    }
97
}
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