Passed
Push — master ( 2377b8...7d8bb8 )
by Maurício
04:21 queued 15s
created
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.
src/ShapeRecord.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     /** @var resource */
42 42
     private $shpFile;
43 43
 
44
-    private ShapeFile|null $shapeFile = null;
44
+    private ShapeFile | null $shapeFile = null;
45 45
 
46 46
     private int $size = 0;
47 47
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             $this->reportInvalidShapeTypeError();
105 105
         }
106 106
 
107
-        if (! ShapeFile::supportsDbase() || $dbfFile === false) {
107
+        if (!ShapeFile::supportsDbase() || $dbfFile === false) {
108 108
             return;
109 109
         }
110 110
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             default => $this->reportInvalidShapeTypeError(),
142 142
         };
143 143
 
144
-        if (! ShapeFile::supportsDbase() || $dbfFile === false) {
144
+        if (!ShapeFile::supportsDbase() || $dbfFile === false) {
145 145
             return;
146 146
         }
147 147
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
     private function loadMultiPointMZRecord(string $type): void
332 332
     {
333 333
         /* The m dimension is optional, depends on bounding box data */
334
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
334
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
335 335
             return;
336 336
         }
337 337
 
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
             }
422 422
 
423 423
             if (
424
-                ! isset($this->shpData['parts'][$part]['points'])
425
-                || ! is_array($this->shpData['parts'][$part]['points'])
424
+                !isset($this->shpData['parts'][$part]['points'])
425
+                || !is_array($this->shpData['parts'][$part]['points'])
426 426
             ) {
427 427
                 $this->shpData['parts'][$part] = ['points' => []];
428 428
             }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     private function loadPolyLineMZRecord(string $type): void
435 435
     {
436 436
         /* The m dimension is optional, depends on bounding box data */
437
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
437
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
438 438
             return;
439 439
         }
440 440
 
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
     {
556 556
         // Adjusts bounding box based on point
557 557
         foreach (['x', 'y', 'z', 'm'] as $direction) {
558
-            if (! isset($point[$direction])) {
558
+            if (!isset($point[$direction])) {
559 559
                 continue;
560 560
             }
561 561
 
562 562
             $min = $direction . 'min';
563 563
             $max = $direction . 'max';
564
-            if (! isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
564
+            if (!isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
565 565
                 $this->shpData[$min] = $point[$direction];
566 566
             }
567 567
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
     /**
719 719
      * Returns length of content.
720 720
      */
721
-    public function getContentLength(): int|null
721
+    public function getContentLength(): int | null
722 722
     {
723 723
         // The content length for a record is the length of the record contents section measured in 16-bit words.
724 724
         // one coordinate makes 4 16-bit words (64 bit double)
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
 
797 797
         unset($this->dbfData['deleted']);
798 798
         if ($this->recordNumber <= dbase_numrecords($dbfFile)) {
799
-            if (! dbase_replace_record($dbfFile, array_values($this->dbfData), $this->recordNumber)) {
799
+            if (!dbase_replace_record($dbfFile, array_values($this->dbfData), $this->recordNumber)) {
800 800
                 $this->setError("I wasn't possible to update the information in the DBF file.");
801 801
             }
802
-        } elseif (! dbase_add_record($dbfFile, array_values($this->dbfData))) {
802
+        } elseif (!dbase_add_record($dbfFile, array_values($this->dbfData))) {
803 803
             $this->setError("I wasn't possible to add the information to the DBF file.");
804 804
         }
805 805
     }
Please login to merge, or discard this patch.
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
         self::assertEquals(
44 44
             $expected,
Please login to merge, or discard this patch.
tests/ShapeFileTest.php 1 patch
Spacing   +7 added lines, -7 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
             self::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
             self::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
             self::markTestSkipped('dbase extension missing');
264 264
         }
265 265
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/ShapeFile.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.