Completed
Push — master ( ab4a80...f7d512 )
by Maurício
16s queued 14s
created
tests/UtilTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      *
39 39
      * @dataProvider data
40 40
      */
41
-    public function testLoadData(string $type, string|false $data, mixed $expected): void
41
+    public function testLoadData(string $type, string | false $data, mixed $expected): void
42 42
     {
43 43
         $this->assertEquals(
44 44
             $expected,
Please login to merge, or discard this patch.
src/ShapeFile.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     private $dbfFile = false;
64 64
 
65 65
     /** @var mixed[]|null */
66
-    private array|null $dbfHeader = null;
66
+    private array | null $dbfHeader = null;
67 67
 
68 68
     public string $lastError = '';
69 69
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             'xmax' => 0.0,
98 98
             'ymax' => 0.0,
99 99
         ],
100
-        public string|null $fileName = null,
100
+        public string | null $fileName = null,
101 101
     ) {
102 102
     }
103 103
 
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         if ($result && ($this->openDBFFile())) {
120
-            if (! $this->loadHeaders()) {
120
+            if (!$this->loadHeaders()) {
121 121
                 $this->closeSHPFile();
122 122
                 $this->closeDBFFile();
123 123
 
124 124
                 return false;
125 125
             }
126 126
 
127
-            if (! $this->loadRecords()) {
127
+            if (!$this->loadRecords()) {
128 128
                 $this->closeSHPFile();
129 129
                 $this->closeDBFFile();
130 130
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
      *
146 146
      * @param string|null $fileName Name of file, otherwise existing is used
147 147
      */
148
-    public function saveToFile(string|null $fileName = null): bool
148
+    public function saveToFile(string | null $fileName = null): bool
149 149
     {
150 150
         if ($fileName !== null) {
151 151
             $this->fileName = $fileName;
152 152
         }
153 153
 
154
-        if (! $this->openSHPFile(true) || (! $this->openSHXFile(true)) || (! $this->createDBFFile())) {
154
+        if (!$this->openSHPFile(true) || (!$this->openSHXFile(true)) || (!$this->createDBFFile())) {
155 155
             return false;
156 156
         }
157 157
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $max = $type . 'max';
187 187
 
188 188
         if (
189
-            ! isset($this->boundingBox[$min])
189
+            !isset($this->boundingBox[$min])
190 190
             || $this->boundingBox[$min] == 0.0 // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators
191 191
             || ($this->boundingBox[$min] > $data[$min])
192 192
         ) {
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function deleteRecord(int $index): void
240 240
     {
241
-        if (! isset($this->records[$index])) {
241
+        if (!isset($this->records[$index])) {
242 242
             return;
243 243
         }
244 244
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      *
258 258
      * @return mixed[]|null see setDBFHeader for more information
259 259
      */
260
-    public function getDBFHeader(): array|null
260
+    public function getDBFHeader(): array | null
261 261
     {
262 262
         return $this->dbfHeader;
263 263
     }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      */
348 348
     private function deleteRecordFromDBF(int $index): void
349 349
     {
350
-        if ($this->dbfFile === false || ! @dbase_delete_record($this->dbfFile, $index)) {
350
+        if ($this->dbfFile === false || !@dbase_delete_record($this->dbfFile, $index)) {
351 351
             return;
352 352
         }
353 353
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     private function loadRecords(): bool
456 456
     {
457 457
         /* Need to start at offset 100 */
458
-        while (! $this->eofSHP()) {
458
+        while (!$this->eofSHP()) {
459 459
             $record = new ShapeRecord(-1);
460 460
             $record->loadFromFile($this, $this->dbfFile);
461 461
             if ($record->lastError !== '') {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
     {
509 509
         $shpName = $this->getFilename($extension);
510 510
         $result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb'));
511
-        if (! $result) {
511
+        if (!$result) {
512 512
             $this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName));
513 513
 
514 514
             return false;
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      */
573 573
     private function createDBFFile(): bool
574 574
     {
575
-        if (! self::supportsDbase() || $this->dbfHeader === null || $this->dbfHeader === []) {
575
+        if (!self::supportsDbase() || $this->dbfHeader === null || $this->dbfHeader === []) {
576 576
             $this->dbfFile = false;
577 577
 
578 578
             return true;
@@ -601,14 +601,14 @@  discard block
 block discarded – undo
601 601
      */
602 602
     private function openDBFFile(): bool
603 603
     {
604
-        if (! self::supportsDbase()) {
604
+        if (!self::supportsDbase()) {
605 605
             $this->dbfFile = false;
606 606
 
607 607
             return true;
608 608
         }
609 609
 
610 610
         $dbfName = $this->getFilename('.dbf');
611
-        if (! is_readable($dbfName)) {
611
+        if (!is_readable($dbfName)) {
612 612
             $this->setError(sprintf('It wasn\'t possible to find the DBase file "%s"', $dbfName));
613 613
 
614 614
             return false;
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
      *
651 651
      * @param int<0, max> $bytes
652 652
      */
653
-    public function readSHP(int $bytes): string|false
653
+    public function readSHP(int $bytes): string | false
654 654
     {
655 655
         if ($this->shpFile === false) {
656 656
             return false;
Please login to merge, or discard this patch.
src/ShapeRecord.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     /** @var resource */
43 43
     private $shpFile;
44 44
 
45
-    private ShapeFile|null $shapeFile = null;
45
+    private ShapeFile | null $shapeFile = null;
46 46
 
47 47
     private int $size = 0;
48 48
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $this->setError(sprintf('Failed to parse record, read=%d, size=%d', $this->read, $this->size));
106 106
         }
107 107
 
108
-        if (! ShapeFile::supportsDbase() || $dbfFile === false) {
108
+        if (!ShapeFile::supportsDbase() || $dbfFile === false) {
109 109
             return;
110 110
         }
111 111
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             default => $this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType)),
143 143
         };
144 144
 
145
-        if (! ShapeFile::supportsDbase() || $dbfFile === false) {
145
+        if (!ShapeFile::supportsDbase() || $dbfFile === false) {
146 146
             return;
147 147
         }
148 148
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     private function loadMultiPointMZRecord(string $type): void
333 333
     {
334 334
         /* The m dimension is optional, depends on bounding box data */
335
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
335
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
336 336
             return;
337 337
         }
338 338
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
             }
423 423
 
424 424
             if (
425
-                ! isset($this->shpData['parts'][$part]['points'])
426
-                || ! is_array($this->shpData['parts'][$part]['points'])
425
+                !isset($this->shpData['parts'][$part]['points'])
426
+                || !is_array($this->shpData['parts'][$part]['points'])
427 427
             ) {
428 428
                 $this->shpData['parts'][$part] = ['points' => []];
429 429
             }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
     private function loadPolyLineMZRecord(string $type): void
436 436
     {
437 437
         /* The m dimension is optional, depends on bounding box data */
438
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
438
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
439 439
             return;
440 440
         }
441 441
 
@@ -556,13 +556,13 @@  discard block
 block discarded – undo
556 556
     {
557 557
         // Adjusts bounding box based on point
558 558
         foreach (['x', 'y', 'z', 'm'] as $direction) {
559
-            if (! isset($point[$direction])) {
559
+            if (!isset($point[$direction])) {
560 560
                 continue;
561 561
             }
562 562
 
563 563
             $min = $direction . 'min';
564 564
             $max = $direction . 'max';
565
-            if (! isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
565
+            if (!isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
566 566
                 $this->shpData[$min] = $point[$direction];
567 567
             }
568 568
 
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
     /**
720 720
      * Returns length of content.
721 721
      */
722
-    public function getContentLength(): int|null
722
+    public function getContentLength(): int | null
723 723
     {
724 724
         // The content length for a record is the length of the record contents section measured in 16-bit words.
725 725
         // one coordinate makes 4 16-bit words (64 bit double)
@@ -797,10 +797,10 @@  discard block
 block discarded – undo
797 797
 
798 798
         unset($this->dbfData['deleted']);
799 799
         if ($this->recordNumber <= dbase_numrecords($dbfFile)) {
800
-            if (! dbase_replace_record($dbfFile, array_values($this->dbfData), $this->recordNumber)) {
800
+            if (!dbase_replace_record($dbfFile, array_values($this->dbfData), $this->recordNumber)) {
801 801
                 $this->setError("I wasn't possible to update the information in the DBF file.");
802 802
             }
803
-        } elseif (! dbase_add_record($dbfFile, array_values($this->dbfData))) {
803
+        } elseif (!dbase_add_record($dbfFile, array_values($this->dbfData))) {
804 804
             $this->setError("I wasn't possible to add the information to the DBF file.");
805 805
         }
806 806
     }
Please login to merge, or discard this patch.
tests/ShapeFileTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
221 221
      */
222 222
     public function testCreate(): void
223 223
     {
224
-        if (! ShapeFile::supportsDbase()) {
224
+        if (!ShapeFile::supportsDbase()) {
225 225
             $this->markTestSkipped('dbase extension missing');
226 226
         }
227 227
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function testDelete(): void
239 239
     {
240
-        if (! ShapeFile::supportsDbase()) {
240
+        if (!ShapeFile::supportsDbase()) {
241 241
             $this->markTestSkipped('dbase extension missing');
242 242
         }
243 243
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      */
260 260
     public function testAdd(): void
261 261
     {
262
-        if (! ShapeFile::supportsDbase()) {
262
+        if (!ShapeFile::supportsDbase()) {
263 263
             $this->markTestSkipped('dbase extension missing');
264 264
         }
265 265
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
         $items = ['numparts', 'numpoints'];
342 342
         foreach ($items as $item) {
343
-            if (! isset($record->shpData[$item])) {
343
+            if (!isset($record->shpData[$item])) {
344 344
                 continue;
345 345
             }
346 346
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             -1,
408 408
             $shp->getIndexFromDBFData('CNTRY_NAME', 'nonexisting'),
409 409
         );
410
-        if (! ShapeFile::supportsDbase()) {
410
+        if (!ShapeFile::supportsDbase()) {
411 411
             return;
412 412
         }
413 413
 
Please login to merge, or discard this patch.
src/Util.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 class Util
34 34
 {
35
-    private static bool|null $littleEndian = null;
35
+    private static bool | null $littleEndian = null;
36 36
 
37 37
     /**
38 38
      * Reads data.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param string       $type type for unpack()
41 41
      * @param string|false $data Data to process
42 42
      */
43
-    public static function loadData(string $type, string|false $data): mixed
43
+    public static function loadData(string $type, string | false $data): mixed
44 44
     {
45 45
         if ($data === false || $data === '') {
46 46
             return false;
Please login to merge, or discard this patch.