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

jojo1981 / json-ast-builder / 17578743546

09 Sep 2025 09:50AM UTC coverage: 35.019%. First build
17578743546

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

161 of 407 new or added lines in 17 files covered. (39.56%)

374 of 1068 relevant lines covered (35.02%)

3.47 hits per line

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

66.67
/src/Ast/ArrayNode.php
1
<?php
2
/*
3
 * This file is part of the jojo1981/json-ast-builder package
4
 *
5
 * Copyright (c) 2019 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\JsonAstBuilder\Ast;
13

14
use Jojo1981\JsonAstBuilder\Visitor\VisitorInterface;
15
use function array_walk;
16

17
/**
18
 * @package Jojo1981\JsonAstBuilder\Ast
19
 */
20
final class ArrayNode implements TypeNodeInterface
21
{
22
    use TokenAwareTrait;
23

24
    /** @var ElementNode[] */
25
    private array $elements = [];
26

27
    /**
28
     * @param ElementNode[] $elements
29
     */
30
    public function __construct(array $elements = [])
31
    {
32
        $this->setElements($elements);
5✔
33
    }
34

35
    /**
36
     * @return ElementNode[]
37
     */
38
    public function getElements(): array
39
    {
40
        return $this->elements;
×
41
    }
42

43
    /**
44
     * @param ElementNode[] $elements
45
     * @return void
46
     */
47
    public function setElements(array $elements): void
48
    {
49
        $this->elements = [];
5✔
50
        array_walk($elements, [$this, 'addElement']);
5✔
51
    }
52

53
    /**
54
     * @param VisitorInterface $visitor
55
     * @return mixed
56
     */
57
    public function accept(VisitorInterface $visitor): mixed
58
    {
NEW
59
        return $visitor->visitArrayNode($this);
×
60
    }
61

62
    /**
63
     * @param ElementNode $element
64
     * @return void
65
     */
66
    private function addElement(ElementNode $element): void
67
    {
68
        $this->elements[] = $element;
5✔
69
    }
70
}
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