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

brick / math / 21759044472

06 Feb 2026 04:52PM UTC coverage: 98.516% (-0.7%) from 99.177%
21759044472

push

github

BenMorel
Improve NoInverseException message

1 of 1 new or added line in 1 file covered. (100.0%)

109 existing lines in 4 files now uncovered.

1328 of 1348 relevant lines covered (98.52%)

2303.56 hits per line

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

68.42
/src/Exception/InvalidArgumentException.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Brick\Math\Exception;
6

7
use Brick\Math\Internal\Constants;
8

9
use function sprintf;
10

11
/**
12
 * Exception thrown when an invalid argument is provided.
13
 */
14
final class InvalidArgumentException extends \InvalidArgumentException implements MathException
15
{
16
    /**
17
     * @pure
18
     */
19
    public static function baseOutOfRange(int $base): InvalidArgumentException
20
    {
21
        return new self(sprintf('Base %d is out of range [2, 36].', $base));
30✔
22
    }
23

24
    /**
25
     * @pure
26
     */
27
    public static function exponentOutOfRange(int $exponent, int $min, int $max): InvalidArgumentException
28
    {
29
        return new self(sprintf(
12✔
30
            'Exponent %d is out of range [%d, %d].',
12✔
31
            $exponent,
12✔
32
            $min,
12✔
33
            $max,
12✔
34
        ));
12✔
35
    }
36

37
    /**
38
     * @pure
39
     */
40
    public static function negativeScale(): InvalidArgumentException
41
    {
42
        return new self('Scale must not be negative.');
6✔
43
    }
44

45
    /**
46
     * @pure
47
     */
48
    public static function negativeBitIndex(): InvalidArgumentException
49
    {
50
        return new self('The bit index cannot be negative.');
3✔
51
    }
52

53
    /**
54
     * @pure
55
     */
56
    public static function negativeBitCount(): InvalidArgumentException
57
    {
58
        return new self('The bit count must not be negative.');
3✔
59
    }
60

61
    /**
62
     * @pure
63
     */
64
    public static function alphabetTooShort(): InvalidArgumentException
65
    {
66
        return new self('The alphabet must contain at least 2 characters.');
12✔
67
    }
68

69
    /**
70
     * @pure
71
     */
72
    public static function duplicateCharsInAlphabet(): InvalidArgumentException
73
    {
74
        return new self('The alphabet must not contain duplicate characters.');
18✔
75
    }
76

77
    /**
78
     * @pure
79
     */
80
    public static function minGreaterThanMax(): InvalidArgumentException
81
    {
82
        return new self('Minimum value must be less than or equal to maximum value.');
12✔
83
    }
84

85
    /**
86
     * @pure
87
     */
88
    public static function bitShiftOutOfRange(int $bits): InvalidArgumentException
89
    {
UNCOV
90
        return new self(sprintf(
×
UNCOV
91
            'Bit shift %d is out of range [%d, %d].',
×
UNCOV
92
            $bits,
×
UNCOV
93
            -Constants::MAX_BIT_SHIFT,
×
UNCOV
94
            Constants::MAX_BIT_SHIFT,
×
UNCOV
95
        ));
×
96
    }
97
}
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