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

eliashaeussler / version-bumper / 24529462145

16 Apr 2026 07:22PM UTC coverage: 88.084% (+0.09%) from 87.996%
24529462145

push

github

web-flow
Merge pull request #125 from eliashaeussler/feature/actions

[FEATURE] Introduce actions

242 of 289 new or added lines in 20 files covered. (83.74%)

2 existing lines in 2 files now uncovered.

1094 of 1242 relevant lines covered (88.08%)

4.98 hits per line

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

63.89
/src/Config/VersionBumperConfig.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "eliashaeussler/version-bumper".
7
 *
8
 * Copyright (C) 2024-2026 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\VersionBumper\Config;
25

26
use EliasHaeussler\VersionBumper\Version;
27
use ReflectionObject;
28

29
use function array_merge;
30
use function is_array;
31

32
/**
33
 * VersionBumperConfig.
34
 *
35
 * @author Elias Häußler <elias@haeussler.dev>
36
 * @license GPL-3.0-or-later
37
 */
38
final class VersionBumperConfig
39
{
40
    /**
41
     * @param list<Preset\Preset>         $presets
42
     * @param list<FileToModify>          $filesToModify
43
     * @param list<VersionRangeIndicator> $versionRangeIndicators
44
     */
45
    public function __construct(
4✔
46
        private readonly array $presets = [],
47
        private readonly array $filesToModify = [],
48
        private ?string $rootPath = null,
49
        private readonly ReleaseOptions $releaseOptions = new ReleaseOptions(),
50
        private readonly array $versionRangeIndicators = [],
51
    ) {}
4✔
52

53
    /**
54
     * @return list<Preset\Preset>
55
     */
56
    public function presets(): array
×
57
    {
58
        return $this->presets;
×
59
    }
60

61
    /**
62
     * @return list<FileToModify>
63
     */
64
    public function filesToModify(): array
×
65
    {
66
        return $this->filesToModify;
×
67
    }
68

69
    public function hasActions(Version\Action\ActionType $type): bool
1✔
70
    {
71
        foreach ($this->filesToModify as $fileToModify) {
1✔
72
            if ([] !== $fileToModify->getActionsByType($type)) {
1✔
73
                return true;
1✔
74
            }
75
        }
76

77
        return false;
1✔
78
    }
79

UNCOV
80
    public function rootPath(): ?string
×
81
    {
82
        return $this->rootPath;
×
83
    }
84

85
    public function setRootPath(string $rootPath): self
×
86
    {
87
        $this->rootPath = $rootPath;
×
88

89
        return $this;
×
90
    }
91

92
    public function releaseOptions(): ReleaseOptions
×
93
    {
94
        return $this->releaseOptions;
×
95
    }
96

97
    /**
98
     * @return list<VersionRangeIndicator>
99
     */
100
    public function versionRangeIndicators(): array
×
101
    {
102
        return $this->versionRangeIndicators;
×
103
    }
104

105
    /**
106
     * @impure
107
     *
108
     * @internal
109
     */
110
    public function merge(self $other): self
3✔
111
    {
112
        $shell = new self();
3✔
113
        $reflection = new ReflectionObject($other);
3✔
114
        $parameters = $reflection->getConstructor()?->getParameters() ?? [];
3✔
115
        $properties = [];
3✔
116

117
        foreach ($parameters as $parameter) {
3✔
118
            $property = $reflection->getProperty($parameter->getName());
3✔
119
            $thisValue = $property->getValue($this);
3✔
120
            $otherValue = $property->getValue($other);
3✔
121

122
            /* @phpstan-ignore notEqual.notAllowed (Loose comparison is intended as we compare objects) */
123
            if ($property->getValue($shell) != $otherValue) {
3✔
124
                $thisValue = is_array($thisValue) && is_array($otherValue)
2✔
125
                    ? array_merge($thisValue, $otherValue)
1✔
126
                    : $otherValue
1✔
127
                ;
2✔
128
            }
129

130
            $properties[] = $thisValue;
3✔
131
        }
132

133
        /* @phpstan-ignore argument.type */
134
        return new self(...$properties);
3✔
135
    }
136
}
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