Skip to content

Commit 0119a1a

Browse files
authored
fix: phpstan (#3022)
1 parent 2549a99 commit 0119a1a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ parameters:
1010

1111
ignoreErrors:
1212
- '#Unsafe usage of new static\(\).#'
13+
- '#Negated boolean expression is always false.#'
1314

1415
excludePaths:
1516
- src/helper.php

src/Utilities/Request.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ public function getBaseRequest(): BaseRequest
254254
*/
255255
public function start(): int
256256
{
257-
return intval($this->request->input('start', 0));
257+
$start = $this->request->input('start', 0);
258+
259+
return is_numeric($start) ? intval($start) : 0;
258260
}
259261

260262
/**
@@ -264,7 +266,9 @@ public function start(): int
264266
*/
265267
public function length(): int
266268
{
267-
return intval($this->request->input('length', 10));
269+
$length = $this->request->input('length', 10);
270+
271+
return is_numeric($length) ? intval($length) : 10;
268272
}
269273

270274
/**
@@ -274,6 +278,8 @@ public function length(): int
274278
*/
275279
public function draw(): int
276280
{
277-
return intval($this->request->input('draw', 0));
281+
$draw = $this->request->input('draw', 0);
282+
283+
return is_numeric($draw) ? intval($draw) : 0;
278284
}
279285
}

0 commit comments

Comments
 (0)