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

jojo1981 / json-path-ast-builder / 17581676976

09 Sep 2025 11:51AM UTC coverage: 23.69%. First build
17581676976

push

github

web-flow
Merge pull request #2 from jojo1981/feature/upgrade-php-versions

Fix: Make compatible with PHP versions: ^8.0|^8.1|^8.2|^8.3|^8.4

55 of 207 new or added lines in 5 files covered. (26.57%)

434 of 1832 relevant lines covered (23.69%)

1.14 hits per line

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

0.0
/src/Value/NodeTypeValue.php
1
<?php
2
/*
3
 * This file is part of the jojo1981/json-path-ast-builder package
4
 *
5
 * Copyright (c) 2020 Joost Nijhuis <jnijhuis81@gmail.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed in the root of the source code
9
 */
10
declare(strict_types=1);
11

12
namespace Jojo1981\JsonPathAstBuilder\Value;
13

14
use Jojo1981\JsonPathAstBuilder\Value\Exception\ValueException;
15

16
/**
17
 * @package Jojo1981\JsonPathAstBuilder\Value
18
 */
19
class NodeTypeValue extends AbstractEnumValue
20
{
21
    /** @var string */
22
    public const NODE_TYPE_OBJECT = 'object';
23

24
    /** @var string */
25
    public const NODE_TYPE_ARRAY = 'array';
26

27
    /** @var string */
28
    public const NODE_TYPE_STRING = 'string';
29

30
    /** @var string */
31
    public const NODE_TYPE_NUMBER = 'number';
32

33
    /** @var string */
34
    public const NODE_TYPE_BOOLEAN = 'boolean';
35

36
    /** @var string */
37
    public const NODE_TYPE_NULL = 'null';
38

39
    /**
40
     * @return string[]
41
     */
42
    protected function getEnumValues(): array
43
    {
NEW
44
        return self::getValidValues();
×
45
    }
46

47
    /**
48
     * @return bool
49
     */
50
    public function isObject(): bool
51
    {
52
        return static::NODE_TYPE_OBJECT === $this->getValue();
×
53
    }
54

55
    /**
56
     * @return bool
57
     */
58
    public function isArray(): bool
59
    {
60
        return static::NODE_TYPE_ARRAY === $this->getValue();
×
61
    }
62

63
    /**
64
     * @return bool
65
     */
66
    public function isString(): bool
67
    {
68
        return static::NODE_TYPE_STRING === $this->getValue();
×
69
    }
70

71

72
    /**
73
     * @return bool
74
     */
75
    public function isNumber(): bool
76
    {
77
        return static::NODE_TYPE_NUMBER === $this->getValue();
×
78
    }
79

80
    /**
81
     * @return bool
82
     */
83
    public function isBoolean(): bool
84
    {
85
        return static::NODE_TYPE_NUMBER === $this->getValue();
×
86
    }
87

88
    /**
89
     * @return bool
90
     */
91
    public function isNull(): bool
92
    {
93
        return static::NODE_TYPE_NULL === $this->getValue();
×
94
    }
95

96
    /**
97
     * @throws ValueException
98
     * @return NodeTypeValue
99
     */
100
    public static function object(): NodeTypeValue
101
    {
102
        return new static(static::NODE_TYPE_OBJECT);
×
103
    }
104

105
    /**
106
     * @throws ValueException
107
     * @return NodeTypeValue
108
     */
109
    public static function array(): NodeTypeValue
110
    {
111
        return new static(static::NODE_TYPE_ARRAY);
×
112
    }
113

114
    /**
115
     * @throws ValueException
116
     * @return NodeTypeValue
117
     */
118
    public static function string(): NodeTypeValue
119
    {
120
        return new static(static::NODE_TYPE_STRING);
×
121
    }
122

123
    /**
124
     * @throws ValueException
125
     * @return NodeTypeValue
126
     */
127
    public static function number(): NodeTypeValue
128
    {
129
        return new static(static::NODE_TYPE_NUMBER);
×
130
    }
131

132
    /**
133
     * @throws ValueException
134
     * @return NodeTypeValue
135
     */
136
    public static function boolean(): NodeTypeValue
137
    {
138
        return new static(static::NODE_TYPE_BOOLEAN);
×
139
    }
140

141
    /**
142
     * @throws ValueException
143
     * @return NodeTypeValue
144
     */
145
    public static function null(): NodeTypeValue
146
    {
147
        return new static(static::NODE_TYPE_NULL);
×
148
    }
149

150
    /**
151
     * @return string[]
152
     */
153
    public static function getValidValues(): array
154
    {
155
        return [
×
156
            static::NODE_TYPE_OBJECT,
×
157
            static::NODE_TYPE_ARRAY,
×
158
            static::NODE_TYPE_STRING,
×
159
            static::NODE_TYPE_NUMBER,
×
160
            static::NODE_TYPE_BOOLEAN,
×
161
            static::NODE_TYPE_NULL
×
162
        ];
×
163
    }
164
}
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