@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @dataProvider provideFiles |
45 | 45 | */ |
46 | - public function testLoad(string $filename, int $records, int|null $parts): void |
|
46 | + public function testLoad(string $filename, int $records, int | null $parts): void |
|
47 | 47 | { |
48 | 48 | $shp = new ShapeFile(ShapeType::Point); |
49 | 49 | $shp->loadFromFile($filename); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function testCreate(): void |
223 | 223 | { |
224 | - if (! ShapeFile::supportsDbase()) { |
|
224 | + if (!ShapeFile::supportsDbase()) { |
|
225 | 225 | self::markTestSkipped('dbase extension missing'); |
226 | 226 | } |
227 | 227 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function testDelete(): void |
239 | 239 | { |
240 | - if (! ShapeFile::supportsDbase()) { |
|
240 | + if (!ShapeFile::supportsDbase()) { |
|
241 | 241 | self::markTestSkipped('dbase extension missing'); |
242 | 242 | } |
243 | 243 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function testAdd(): void |
261 | 261 | { |
262 | - if (! ShapeFile::supportsDbase()) { |
|
262 | + if (!ShapeFile::supportsDbase()) { |
|
263 | 263 | self::markTestSkipped('dbase extension missing'); |
264 | 264 | } |
265 | 265 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | $items = ['numparts', 'numpoints']; |
344 | 344 | foreach ($items as $item) { |
345 | - if (! isset($record->shpData[$item])) { |
|
345 | + if (!isset($record->shpData[$item])) { |
|
346 | 346 | continue; |
347 | 347 | } |
348 | 348 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | -1, |
410 | 410 | $shp->getIndexFromDBFData('CNTRY_NAME', 'nonexisting'), |
411 | 411 | ); |
412 | - if (! ShapeFile::supportsDbase()) { |
|
412 | + if (!ShapeFile::supportsDbase()) { |
|
413 | 413 | return; |
414 | 414 | } |
415 | 415 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | public function testAllowsNoDbf(): void |
423 | 423 | { |
424 | - if (! ShapeFile::supportsDbase()) { |
|
424 | + if (!ShapeFile::supportsDbase()) { |
|
425 | 425 | self::markTestSkipped(); |
426 | 426 | } |
427 | 427 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | private $dbfFile = false; |
69 | 69 | |
70 | 70 | /** @var mixed[]|null */ |
71 | - private array|null $dbfHeader = null; |
|
71 | + private array | null $dbfHeader = null; |
|
72 | 72 | |
73 | 73 | public string $lastError = ''; |
74 | 74 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'xmax' => 0.0, |
105 | 105 | 'ymax' => 0.0, |
106 | 106 | ], |
107 | - public string|null $fileName = null, |
|
107 | + public string | null $fileName = null, |
|
108 | 108 | ) { |
109 | 109 | } |
110 | 110 | |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | if ($result && ($this->openDBFFile())) { |
132 | - if (! $this->loadHeaders()) { |
|
132 | + if (!$this->loadHeaders()) { |
|
133 | 133 | $this->closeSHPFile(); |
134 | 134 | $this->closeDBFFile(); |
135 | 135 | |
136 | 136 | return false; |
137 | 137 | } |
138 | 138 | |
139 | - if (! $this->loadRecords()) { |
|
139 | + if (!$this->loadRecords()) { |
|
140 | 140 | $this->closeSHPFile(); |
141 | 141 | $this->closeDBFFile(); |
142 | 142 | |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @param string|null $fileName Name of file, otherwise existing is used |
159 | 159 | */ |
160 | - public function saveToFile(string|null $fileName = null): bool |
|
160 | + public function saveToFile(string | null $fileName = null): bool |
|
161 | 161 | { |
162 | 162 | if ($fileName !== null) { |
163 | 163 | $this->fileName = $fileName; |
164 | 164 | } |
165 | 165 | |
166 | - if (! $this->openSHPFile(true) || (! $this->openSHXFile(true)) || (! $this->createDBFFile())) { |
|
166 | + if (!$this->openSHPFile(true) || (!$this->openSHXFile(true)) || (!$this->createDBFFile())) { |
|
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $max = $type . 'max'; |
199 | 199 | |
200 | 200 | if ( |
201 | - ! isset($this->boundingBox[$min]) |
|
201 | + !isset($this->boundingBox[$min]) |
|
202 | 202 | || $this->boundingBox[$min] == 0.0 // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators |
203 | 203 | || ($this->boundingBox[$min] > $data[$min]) |
204 | 204 | ) { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function deleteRecord(int $index): void |
252 | 252 | { |
253 | - if (! isset($this->records[$index])) { |
|
253 | + if (!isset($this->records[$index])) { |
|
254 | 254 | return; |
255 | 255 | } |
256 | 256 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed[]|null see setDBFHeader for more information |
271 | 271 | */ |
272 | - public function getDBFHeader(): array|null |
|
272 | + public function getDBFHeader(): array | null |
|
273 | 273 | { |
274 | 274 | return $this->dbfHeader; |
275 | 275 | } |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | */ |
317 | 317 | private function loadDBFHeader(): array |
318 | 318 | { |
319 | - if (! self::supportsDbase()) { |
|
319 | + if (!self::supportsDbase()) { |
|
320 | 320 | return []; |
321 | 321 | } |
322 | 322 | |
323 | 323 | $dbfName = $this->getFilename('.dbf'); |
324 | - if (! file_exists($dbfName)) { |
|
324 | + if (!file_exists($dbfName)) { |
|
325 | 325 | return []; |
326 | 326 | } |
327 | 327 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | private function deleteRecordFromDBF(int $index): void |
370 | 370 | { |
371 | - if ($this->dbfFile === false || ! @dbase_delete_record($this->dbfFile, $index)) { |
|
371 | + if ($this->dbfFile === false || !@dbase_delete_record($this->dbfFile, $index)) { |
|
372 | 372 | return; |
373 | 373 | } |
374 | 374 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | private function loadRecords(): bool |
479 | 479 | { |
480 | 480 | /* Need to start at offset 100 */ |
481 | - while (! $this->eofSHP()) { |
|
481 | + while (!$this->eofSHP()) { |
|
482 | 482 | $record = new ShapeRecord(ShapeType::Unknown); |
483 | 483 | $record->loadFromFile($this, $this->dbfFile); |
484 | 484 | if ($record->lastError !== '') { |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | { |
532 | 532 | $shpName = $this->getFilename($extension); |
533 | 533 | $result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb')); |
534 | - if (! $result) { |
|
534 | + if (!$result) { |
|
535 | 535 | $this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName)); |
536 | 536 | |
537 | 537 | return false; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | */ |
596 | 596 | private function createDBFFile(): bool |
597 | 597 | { |
598 | - if (! self::supportsDbase() || $this->dbfHeader === null || $this->dbfHeader === []) { |
|
598 | + if (!self::supportsDbase() || $this->dbfHeader === null || $this->dbfHeader === []) { |
|
599 | 599 | $this->dbfFile = false; |
600 | 600 | |
601 | 601 | return true; |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | */ |
625 | 625 | private function openDBFFile(): bool |
626 | 626 | { |
627 | - if (! self::supportsDbase()) { |
|
627 | + if (!self::supportsDbase()) { |
|
628 | 628 | $this->dbfFile = false; |
629 | 629 | |
630 | 630 | return true; |
631 | 631 | } |
632 | 632 | |
633 | 633 | $dbfName = $this->getFilename('.dbf'); |
634 | - if (! is_readable($dbfName)) { |
|
634 | + if (!is_readable($dbfName)) { |
|
635 | 635 | if ($this->allowNoDbf) { |
636 | 636 | return true; |
637 | 637 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @param int<0, max> $bytes |
679 | 679 | */ |
680 | - public function readSHP(int $bytes): string|false |
|
680 | + public function readSHP(int $bytes): string | false |
|
681 | 681 | { |
682 | 682 | if ($this->shpFile === false) { |
683 | 683 | return false; |