File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -202,13 +202,13 @@ public function getDisabledItemText(string $text) : string
202
202
*/
203
203
private function generateColoursSetCode () : void
204
204
{
205
- if (!is_numeric ($ this ->fg )) {
205
+ if (!ctype_digit ($ this ->fg )) {
206
206
$ fgCode = self ::$ availableForegroundColors [$ this ->fg ];
207
207
} else {
208
208
$ fgCode = sprintf ("38;5;%s " , $ this ->fg );
209
209
}
210
210
211
- if (!is_numeric ($ this ->bg )) {
211
+ if (!ctype_digit ($ this ->bg )) {
212
212
$ bgCode = self ::$ availableBackgroundColors [$ this ->bg ];
213
213
} else {
214
214
$ bgCode = sprintf ("48;5;%s " , $ this ->bg );
Original file line number Diff line number Diff line change @@ -308,7 +308,7 @@ public static function map256To8(int $colourCode) : string
308
308
*/
309
309
public static function validateColour (Terminal $ terminal , string $ colour , string $ fallback = null ) : string
310
310
{
311
- if (!is_numeric ($ colour )) {
311
+ if (!ctype_digit ($ colour )) {
312
312
return static ::validateColourName ($ colour );
313
313
}
314
314
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ public function testSetBgThrowsExceptionWhenColourCodeIsNotInRange() : void
145
145
146
146
$ builder = new CliMenuBuilder ;
147
147
$ builder ->setTerminal ($ terminal );
148
- $ builder ->setBackgroundColour (- 5 , 'white ' );
148
+ $ builder ->setBackgroundColour (257 , 'white ' );
149
149
}
150
150
151
151
public function testDisableDefaultItems () : void
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ public function testSetBgThrowsExceptionWhenColourCodeIsNotInRange() : void
164
164
$ this ->expectExceptionMessage ('Invalid colour code ' );
165
165
166
166
$ style = $ this ->getMenuStyle (256 );
167
- $ style ->setBg (- 5 , 'white ' );
167
+ $ style ->setBg (257 , 'white ' );
168
168
}
169
169
170
170
public function testGetMarkerReturnsTheCorrectMarkers () : void
You can’t perform that action at this time.
0 commit comments