Passed
Pull Request — master (#38)
by
unknown
02:30
created
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   +16 added lines, -16 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
     }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
      */
360 360
     private function deleteRecordFromDBF(int $index): void
361 361
     {
362
-        if ($this->dbfFile === false || ! @dbase_delete_record($this->dbfFile, $index)) {
362
+        if ($this->dbfFile === false || !@dbase_delete_record($this->dbfFile, $index)) {
363 363
             return;
364 364
         }
365 365
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     private function loadRecords(): bool
472 472
     {
473 473
         /* Need to start at offset 100 */
474
-        while (! $this->eofSHP()) {
474
+        while (!$this->eofSHP()) {
475 475
             $record = new ShapeRecord(ShapeType::Unknown);
476 476
             $record->loadFromFile($this, $this->dbfFile);
477 477
             if ($record->lastError !== '') {
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
     {
525 525
         $shpName = $this->getFilename($extension);
526 526
         $result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb'));
527
-        if (! $result) {
527
+        if (!$result) {
528 528
             $this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName));
529 529
 
530 530
             return false;
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
      */
589 589
     private function createDBFFile(): bool
590 590
     {
591
-        if (! self::supportsDbase() || $this->dbfHeader === null || $this->dbfHeader === []) {
591
+        if (!self::supportsDbase() || $this->dbfHeader === null || $this->dbfHeader === []) {
592 592
             $this->dbfFile = false;
593 593
 
594 594
             return true;
@@ -617,14 +617,14 @@  discard block
 block discarded – undo
617 617
      */
618 618
     private function openDBFFile(): bool
619 619
     {
620
-        if (! self::supportsDbase()) {
620
+        if (!self::supportsDbase()) {
621 621
             $this->dbfFile = false;
622 622
 
623 623
             return true;
624 624
         }
625 625
 
626 626
         $dbfName = $this->getFilename('.dbf');
627
-        if (! is_readable($dbfName)) {
627
+        if (!is_readable($dbfName)) {
628 628
             if ($this->allowNoDbf) {
629 629
                 return true;
630 630
             }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
      *
671 671
      * @param int<0, max> $bytes
672 672
      */
673
-    public function readSHP(int $bytes): string|false
673
+    public function readSHP(int $bytes): string | false
674 674
     {
675 675
         if ($this->shpFile === false) {
676 676
             return false;
Please login to merge, or discard this patch.