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

eliashaeussler / version-bumper / 24214091680

09 Apr 2026 09:24PM UTC coverage: 80.34% (-7.7%) from 87.996%
24214091680

Pull #125

github

eliashaeussler
[FEATURE] Introduce actions
Pull Request #125: [FEATURE] Introduce actions

48 of 164 new or added lines in 16 files covered. (29.27%)

1 existing line in 1 file now uncovered.

899 of 1119 relevant lines covered (80.34%)

4.4 hits per line

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

63.64
/src/Config/FileToModify.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\Exception;
27
use EliasHaeussler\VersionBumper\Version;
28
use Symfony\Component\Filesystem;
29

30
use function is_string;
31

32
/**
33
 * FileToModify.
34
 *
35
 * @author Elias Häußler <elias@haeussler.dev>
36
 * @license GPL-3.0-or-later
37
 */
38
final class FileToModify
39
{
40
    /**
41
     * @var list<FilePattern>
42
     */
43
    private array $patterns = [];
44

45
    /**
46
     * @param list<string|FilePattern>    $patterns
47
     * @param list<Version\Action\Action> $postActions
48
     *
49
     * @throws Exception\FilePatternIsInvalid
50
     */
51
    public function __construct(
5✔
52
        private readonly string $path,
53
        array $patterns = [],
54
        private readonly bool $reportUnmatched = false,
55
        private readonly bool $reportMissing = true,
56
        private readonly array $postActions = [],
57
    ) {
58
        foreach ($patterns as $pattern) {
5✔
59
            $this->add($pattern);
1✔
60
        }
61
    }
62

63
    public function path(): string
×
64
    {
65
        return $this->path;
×
66
    }
67

68
    public function fullPath(string $rootPath): string
2✔
69
    {
70
        if (Filesystem\Path::isAbsolute($this->path)) {
2✔
71
            return $this->path;
1✔
72
        }
73

74
        return Filesystem\Path::join($rootPath, $this->path);
1✔
75
    }
76

77
    /**
78
     * @return list<FilePattern>
79
     */
80
    public function patterns(): array
3✔
81
    {
82
        return $this->patterns;
3✔
83
    }
84

85
    /**
86
     * @throws Exception\FilePatternIsInvalid
87
     */
88
    public function add(string|FilePattern $pattern): self
3✔
89
    {
90
        if (is_string($pattern)) {
3✔
91
            $pattern = new FilePattern($pattern);
2✔
92
        }
93

94
        $this->patterns[] = $pattern;
3✔
95

96
        return $this;
3✔
97
    }
98

99
    public function reportUnmatched(): bool
×
100
    {
101
        return $this->reportUnmatched;
×
102
    }
103

104
    public function reportMissing(): bool
×
105
    {
106
        return $this->reportMissing;
×
107
    }
108

109
    /**
110
     * @return list<Version\Action\Action>
111
     */
NEW
112
    public function postActions(): array
×
113
    {
NEW
114
        return $this->postActions;
×
115
    }
116
}
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