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

NexusPHP / cs-config / 16074653118

04 Jul 2025 01:15PM UTC coverage: 99.245% (-0.1%) from 99.349%
16074653118

push

github

paulbalandan
Support allowUnsupportedPhpVersion option in fixer

7 of 8 new or added lines in 2 files covered. (87.5%)

920 of 927 relevant lines covered (99.24%)

74.75 hits per line

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

30.0
/src/Ruleset/AbstractRuleset.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Nexus CS Config.
7
 *
8
 * (c) 2020 John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace Nexus\CsConfig\Ruleset;
15

16
abstract class AbstractRuleset implements ConfigurableAllowedUnsupportedPhpVersionRulesetInterface
17
{
18
    /**
19
     * Name of the ruleset.
20
     */
21
    protected string $name = '';
22

23
    /**
24
     * Rules for the ruleset.
25
     *
26
     * @var array<string, array<string, bool|list<string>|string>|bool>
27
     */
28
    protected array $rules = [];
29

30
    /**
31
     * Minimum PHP version.
32
     *
33
     * @var int<70400, 90000>
34
     */
35
    protected int $requiredPHPVersion = 7_04_00;
36

37
    /**
38
     * Have this ruleset turn on `$isRiskyAllowed` flag?
39
     */
40
    protected bool $autoActivateIsRiskyAllowed = false;
41

42
    /**
43
     * Allow unsupported PHP versions.
44
     */
45
    protected bool $isUnsupportedPhpVersionAllowed = \PHP_VERSION_ID > 8_03_99;
46

47
    final public function getName(): string
48
    {
49
        if ('' !== $this->name) {
64✔
50
            return $this->name;
64✔
51
        }
52

53
        if (str_contains(static::class, '\\')) {
×
54
            $class = str_replace('\\', '/', static::class);
×
55

56
            return basename($class);
×
57
        }
58

59
        return static::class;
×
60
    }
61

62
    final public function getRules(): array
63
    {
64
        return $this->rules;
48✔
65
    }
66

67
    final public function getRequiredPHPVersion(): int
68
    {
69
        return $this->requiredPHPVersion;
×
70
    }
71

72
    final public function willAutoActivateIsRiskyAllowed(): bool
73
    {
74
        return $this->autoActivateIsRiskyAllowed;
×
75
    }
76

77
    final public function isUnsupportedPhpVersionAllowed(): bool
78
    {
NEW
79
        return $this->isUnsupportedPhpVersionAllowed;
×
80
    }
81
}
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