Skip to content

Commit 80da020

Browse files
committed
Add type to $recordNumber
Signed-off-by: Kamil Tekiela <[email protected]>
1 parent fc55e05 commit 80da020

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

phpstan-baseline.neon

+1-16
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,7 @@ parameters:
2222

2323
-
2424
message: "#^Cannot cast mixed to int\\.$#"
25-
count: 1
26-
path: src/ShapeRecord.php
27-
28-
-
29-
message: "#^Parameter \\#2 \\$record_number of function dbase_get_record_with_names expects int, int\\|null given\\.$#"
30-
count: 1
31-
path: src/ShapeRecord.php
32-
33-
-
34-
message: "#^Parameter \\#3 \\$record_number of function dbase_replace_record expects int, int\\|null given\\.$#"
35-
count: 1
36-
path: src/ShapeRecord.php
37-
38-
-
39-
message: "#^Property PhpMyAdmin\\\\ShapeFile\\\\ShapeRecord\\:\\:\\$recordNumber \\(int\\|null\\) does not accept mixed\\.$#"
40-
count: 1
25+
count: 2
4126
path: src/ShapeRecord.php
4227

4328
-

src/ShapeRecord.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ class ShapeRecord
5353

5454
private int $read = 0;
5555

56-
/** @var int|null */
57-
public $recordNumber = null;
56+
public int $recordNumber = 0;
5857

5958
public int $shapeType;
6059

@@ -198,11 +197,13 @@ private function loadData(string $type, int $count): mixed
198197
private function loadHeaders(): void
199198
{
200199
$this->shapeType = -1;
201-
$this->recordNumber = $this->loadData('N', 4);
202-
if ($this->recordNumber === false) {
200+
$recordNumber = $this->loadData('N', 4);
201+
if ($recordNumber === false) {
203202
return;
204203
}
205204

205+
$this->recordNumber = (int) $recordNumber;
206+
206207
// We read the length of the record
207208
$this->size = $this->loadData('N', 4);
208209
if ($this->size === false) {

0 commit comments

Comments
 (0)