Completed
Pull Request — master (#1)
by Marco
02:10
created
src/Roave/ComposerGpgVerify/Package/GitPackage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Roave\ComposerGpgVerify\Package;
6 6
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                 . implode(
58 58
                     "\n\n",
59 59
                     array_map(
60
-                        function (GitSignatureCheck $check) : string {
60
+                        function(GitSignatureCheck $check) : string {
61 61
                             return $check->asHumanReadableString();
62 62
                         },
63 63
                         $this->passedChecks()
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             . implode(
71 71
                 "\n\n",
72 72
                 array_map(
73
-                    function (GitSignatureCheck $check) : string {
73
+                    function(GitSignatureCheck $check) : string {
74 74
                         return $check->asHumanReadableString();
75 75
                     },
76 76
                     $this->failedChecks()
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         return array_values(array_filter(
87 87
             $this->checks,
88
-            function (GitSignatureCheck $check) {
88
+            function(GitSignatureCheck $check) {
89 89
                 return $check->canBeTrusted();
90 90
             }
91 91
         ));
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
     {
99 99
         return array_values(array_filter(
100 100
             $this->checks,
101
-            function (GitSignatureCheck $check) {
102
-                return ! $check->canBeTrusted();
101
+            function(GitSignatureCheck $check) {
102
+                return !$check->canBeTrusted();
103 103
             }
104 104
         ));
105 105
     }
Please login to merge, or discard this patch.
src/Roave/ComposerGpgVerify/Package/Git/GitSignatureCheck.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Roave\ComposerGpgVerify\Package\Git;
6 6
 
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 
69 69
     private function __construct(
70 70
         string $packageName,
71
-        ?string $commitHash,
72
-        ?string $tagName,
71
+        ? string $commitHash,
72
+        ? string $tagName,
73 73
         string $command,
74 74
         int $exitCode,
75 75
         string $output,
76 76
         bool $isSigned,
77 77
         bool $isVerified,
78
-        ?string $signatureAuthor,
79
-        ?string $signatureKey
78
+        ? string $signatureAuthor,
79
+        ? string $signatureKey
80 80
     ) {
81 81
         $this->packageName     = $packageName; // @TODO get rid of this, or add it to the error messages
82 82
         $this->commitHash      = $commitHash;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         string $output
98 98
     ) : self {
99 99
         $signatureKey = self::extractKeyIdentifier($output);
100
-        $signed       = $signatureKey && ! $exitCode;
100
+        $signed       = $signatureKey && !$exitCode;
101 101
 
102 102
         return new self(
103 103
             $package->getName(),
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         string $output
121 121
     ) : self {
122 122
         $signatureKey = self::extractKeyIdentifier($output);
123
-        $signed       = $signatureKey && ! $exitCode;
123
+        $signed       = $signatureKey && !$exitCode;
124 124
 
125 125
         return new self(
126 126
             $package->getName(),
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
             "\n",
143 143
             [
144 144
                 (($this->isSigned || $this->signatureKey) ? '[SIGNED]' : '[NOT SIGNED]')
145
-                . ' ' . ($this->isVerified ? '[VERIFIED]' : '[NOT VERIFIED]')
146
-                . ' ' . ($this->commitHash ? 'Commit #' . $this->commitHash : '')
147
-                . ' ' . ($this->tagName ? 'Tag ' . $this->tagName : '')
148
-                . ' ' . ($this->signatureAuthor ? 'By "' . $this->signatureAuthor . '"' : '')
149
-                . ' ' . ($this->signatureKey ? '(Key ' . $this->signatureKey . ')' : ''),
150
-                'Command: ' . $this->command,
151
-                'Exit code: ' . $this->exitCode,
152
-                'Output: ' . $this->output,
145
+                . ' '.($this->isVerified ? '[VERIFIED]' : '[NOT VERIFIED]')
146
+                . ' '.($this->commitHash ? 'Commit #'.$this->commitHash : '')
147
+                . ' '.($this->tagName ? 'Tag '.$this->tagName : '')
148
+                . ' '.($this->signatureAuthor ? 'By "'.$this->signatureAuthor.'"' : '')
149
+                . ' '.($this->signatureKey ? '(Key '.$this->signatureKey.')' : ''),
150
+                'Command: '.$this->command,
151
+                'Exit code: '.$this->exitCode,
152
+                'Output: '.$this->output,
153 153
             ]
154 154
         );
155 155
     }
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
         return $this->isVerified;
160 160
     }
161 161
 
162
-    private static function extractCommitHash(string $output) : ?string
162
+    private static function extractCommitHash(string $output) : ? string
163 163
     {
164 164
         $keys = array_filter(array_map(
165
-            function (string $outputRow) {
165
+            function(string $outputRow) {
166 166
                 preg_match('/^(tree|object) ([a-fA-F0-9]{40})$/i', $outputRow, $matches);
167 167
 
168 168
                 return $matches[2] ?? false;
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
         return reset($keys) ?: null;
174 174
     }
175 175
 
176
-    private static function extractTagName(string $output) : ?string
176
+    private static function extractTagName(string $output) : ? string
177 177
     {
178 178
         $keys = array_filter(array_map(
179
-            function (string $outputRow) {
179
+            function(string $outputRow) {
180 180
                 preg_match('/^tag (.+)$/i', $outputRow, $matches);
181 181
 
182 182
                 return $matches[1] ?? false;
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
         return reset($keys) ?: null;
188 188
     }
189 189
 
190
-    private static function extractKeyIdentifier(string $output) : ?string
190
+    private static function extractKeyIdentifier(string $output) : ? string
191 191
     {
192 192
         $keys = array_filter(array_map(
193
-            function (string $outputRow) {
193
+            function(string $outputRow) {
194 194
                 preg_match('/gpg:.*using .* key ([a-fA-F0-9]+)/i', $outputRow, $matches);
195 195
 
196 196
                 return $matches[1] ?? false;
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
         return reset($keys) ?: null;
202 202
     }
203 203
 
204
-    private static function extractSignatureAuthor(string $output) : ?string
204
+    private static function extractSignatureAuthor(string $output) : ? string
205 205
     {
206 206
         $keys = array_filter(array_map(
207
-            function (string $outputRow) {
207
+            function(string $outputRow) {
208 208
                 preg_match('/gpg: Good signature from "(.+)" \\[.*\\]/i', $outputRow, $matches);
209 209
 
210 210
                 return $matches[1] ?? false;
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 
218 218
     private static function signatureValidationHasNoWarnings(string $output) : bool
219 219
     {
220
-        return ! array_filter(
220
+        return !array_filter(
221 221
             explode("\n", $output),
222
-            function (string $outputRow) {
222
+            function(string $outputRow) {
223 223
                 return false !== strpos($outputRow, 'gpg: WARNING: ');
224 224
             }
225 225
         );
Please login to merge, or discard this patch.
src/Roave/ComposerGpgVerify/Package/PackageVerification.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Roave\ComposerGpgVerify\Package;
6 6
 
Please login to merge, or discard this patch.
test/RoaveTest/ComposerGpgVerify/Package/UnknownPackageFormatTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace RoaveTest\ComposerGpgVerify\Package;
6 6
 
Please login to merge, or discard this patch.
test/RoaveTest/ComposerGpgVerify/Package/Git/GitSignatureCheckTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace RoaveTest\ComposerGpgVerify\Package\Git;
6 6
 
Please login to merge, or discard this patch.
test/RoaveTest/ComposerGpgVerify/VerifyTest.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace RoaveTest\ComposerGpgVerify;
6 6
 
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
             ->installationManager
103 103
             ->expects(self::any())
104 104
             ->method('getInstallPath')
105
-            ->willReturnCallback(function (PackageInterface $package) : string {
105
+            ->willReturnCallback(function(PackageInterface $package) : string {
106 106
                 return array_search($package, $this->installedPackages, true);
107 107
             });
108 108
         $this
109 109
             ->localRepository
110 110
             ->expects(self::any())
111 111
             ->method('getPackages')
112
-            ->willReturnCallback(function () {
112
+            ->willReturnCallback(function() {
113 113
                 return array_values($this->installedPackages);
114 114
             });
115 115
     }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         $this->configureCorrectComposerSetup();
168 168
 
169
-        putenv('GNUPGHOME=' . $gpgHomeDirectory);
169
+        putenv('GNUPGHOME='.$gpgHomeDirectory);
170 170
 
171 171
         Verify::verify($this->event);
172 172
     }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
         $this->configureCorrectComposerSetup();
192 192
 
193
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
193
+        putenv('GNUPGHOME='.$personalGpgDirectory);
194 194
 
195 195
         $this->assertWillFailPackageVerification();
196 196
     }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         $this->configureCorrectComposerSetup();
217 217
 
218
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
218
+        putenv('GNUPGHOME='.$personalGpgDirectory);
219 219
         putenv('LANGUAGE=de_DE');
220 220
 
221 221
         try {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
         $this->configureCorrectComposerSetup();
250 250
 
251
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
251
+        putenv('GNUPGHOME='.$personalGpgDirectory);
252 252
 
253 253
         Verify::verify($this->event);
254 254
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         $this->configureCorrectComposerSetup();
274 274
 
275
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
275
+        putenv('GNUPGHOME='.$personalGpgDirectory);
276 276
 
277 277
         $this->assertWillFailPackageVerification();
278 278
     }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
         $this->configureCorrectComposerSetup();
298 298
 
299
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
299
+        putenv('GNUPGHOME='.$personalGpgDirectory);
300 300
 
301 301
         Verify::verify($this->event);
302 302
     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
         $this->configureCorrectComposerSetup();
317 317
 
318
-        putenv('GNUPGHOME=' . $gpgHomeDirectory);
318
+        putenv('GNUPGHOME='.$gpgHomeDirectory);
319 319
 
320 320
         Verify::verify($this->event);
321 321
     }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
         $this->configureCorrectComposerSetup();
335 335
 
336
-        putenv('GNUPGHOME=' . $this->makeGpgHomeDirectory());
336
+        putenv('GNUPGHOME='.$this->makeGpgHomeDirectory());
337 337
 
338 338
         $this->assertWillFailPackageVerification();
339 339
     }
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
         $this->configureCorrectComposerSetup();
357 357
 
358
-        putenv('GNUPGHOME=' . $this->makeGpgHomeDirectory());
358
+        putenv('GNUPGHOME='.$this->makeGpgHomeDirectory());
359 359
 
360 360
         $this->assertWillFailPackageVerification();
361 361
     }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
         $this->configureCorrectComposerSetup();
376 376
 
377
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
377
+        putenv('GNUPGHOME='.$personalGpgDirectory);
378 378
 
379 379
         $this->assertWillFailPackageVerification();
380 380
     }
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
         $this->configureCorrectComposerSetup();
398 398
 
399
-        putenv('GNUPGHOME=' . $gpgHome);
399
+        putenv('GNUPGHOME='.$gpgHome);
400 400
 
401 401
         $this->assertWillFailPackageVerification();
402 402
     }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
         $this->configureCorrectComposerSetup();
420 420
 
421
-        putenv('GNUPGHOME=' . $gpgHome);
421
+        putenv('GNUPGHOME='.$gpgHome);
422 422
 
423 423
         $this->assertWillFailPackageVerification();
424 424
     }
@@ -438,14 +438,14 @@  discard block
 block discarded – undo
438 438
 
439 439
         $this->configureCorrectComposerSetup();
440 440
 
441
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
441
+        putenv('GNUPGHOME='.$personalGpgDirectory);
442 442
 
443 443
         $this->assertWillFailPackageVerification();
444 444
     }
445 445
 
446 446
     private function makeVendorDirectory() : string
447 447
     {
448
-        $vendorDirectory = sys_get_temp_dir() . '/' . uniqid('vendor', true);
448
+        $vendorDirectory = sys_get_temp_dir().'/'.uniqid('vendor', true);
449 449
 
450 450
         self::assertTrue(mkdir($vendorDirectory));
451 451
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
         string $email,
499 499
         string $name
500 500
     ) : string {
501
-        $dependencyRepository = $vendorDirectory . '/' . $packageName;
501
+        $dependencyRepository = $vendorDirectory.'/'.$packageName;
502 502
 
503 503
         self::assertTrue(mkdir($dependencyRepository, 0777, true));
504 504
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
     private function makeGpgHomeDirectory() : string
528 528
     {
529
-        $homeDirectory = sys_get_temp_dir() . '/' . uniqid('gpg-verification-test', true);
529
+        $homeDirectory = sys_get_temp_dir().'/'.uniqid('gpg-verification-test', true);
530 530
 
531 531
         self::assertTrue(mkdir($homeDirectory, 0700));
532 532
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         self::assertGreaterThan(
552 552
             0,
553 553
             file_put_contents(
554
-                $gpgHomeDirectory . '/key-info.txt',
554
+                $gpgHomeDirectory.'/key-info.txt',
555 555
                 str_replace(['<<<NAME>>>', '<<<EMAIL>>>'], [$name, $emailAddress], $input)
556 556
             )
557 557
         );
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         string $foreignKey,
601 601
         bool $sign
602 602
     ) : void {
603
-        $exportPath = sys_get_temp_dir() . '/' . uniqid('exportedKey', true);
603
+        $exportPath = sys_get_temp_dir().'/'.uniqid('exportedKey', true);
604 604
 
605 605
         (new Process(
606 606
             sprintf('gpg --export --armor > %s', escapeshellarg($exportPath)),
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
             ->setTimeout(30)
621 621
             ->mustRun();
622 622
 
623
-        if (! $sign) {
623
+        if (!$sign) {
624 624
             return;
625 625
         }
626 626
 
Please login to merge, or discard this patch.
src/Roave/ComposerGpgVerify/Package/UnknownPackageFormat.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Roave\ComposerGpgVerify\Package;
6 6
 
Please login to merge, or discard this patch.
test/RoaveTest/ComposerGpgVerify/Package/GitPackageTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace RoaveTest\ComposerGpgVerify\Package;
6 6
 
Please login to merge, or discard this patch.
src/Roave/ComposerGpgVerify/Exception/PackagesTrustCheckFailed.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Roave\ComposerGpgVerify\Exception;
6 6
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
             implode(
20 20
                 "\n\n",
21 21
                 array_map(
22
-                    function (PackageVerification $failedVerification) : string {
22
+                    function(PackageVerification $failedVerification) : string {
23 23
                         return $failedVerification->printReason();
24 24
                     },
25 25
                     array_merge([$failedVerification], $furtherFailedVerifications)
Please login to merge, or discard this patch.