Completed
Pull Request — master (#11)
by
unknown
23:55
created
test/RoaveTest/ComposerGpgVerify/VerifyTest.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
             ->installationManager
113 113
             ->expects(self::any())
114 114
             ->method('getInstallPath')
115
-            ->willReturnCallback(function (PackageInterface $package) : string {
115
+            ->willReturnCallback(function(PackageInterface $package) : string {
116 116
                 return array_search($package, $this->installedPackages, true);
117 117
             });
118 118
         $this
119 119
             ->localRepository
120 120
             ->expects(self::any())
121 121
             ->method('getPackages')
122
-            ->willReturnCallback(function () {
122
+            ->willReturnCallback(function() {
123 123
                 return array_values($this->installedPackages);
124 124
             });
125 125
     }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     public function testWillRejectNonGitPackages() : void
165 165
     {
166 166
         $packageName = 'vendor1/package1';
167
-        $vendor1     = sys_get_temp_dir() . '/' . uniqid('vendor', true) . '/' . $packageName;
167
+        $vendor1     = sys_get_temp_dir().'/'.uniqid('vendor', true).'/'.$packageName;
168 168
 
169 169
         /* @var $package PackageInterface|\PHPUnit_Framework_MockObject_MockObject */
170 170
         $package = $this->createMock(PackageInterface::class);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
         $this->configureCorrectComposerSetup();
195 195
 
196
-        putenv('GNUPGHOME=' . $gpgHomeDirectory);
196
+        putenv('GNUPGHOME='.$gpgHomeDirectory);
197 197
 
198 198
         $this->assertWillSucceedPackageVerification();
199 199
     }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
         $this->configureCorrectComposerSetup();
219 219
 
220
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
220
+        putenv('GNUPGHOME='.$personalGpgDirectory);
221 221
 
222 222
         $this->assertWillFailPackageVerification();
223 223
     }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
         $this->configureCorrectComposerSetup();
244 244
 
245
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
245
+        putenv('GNUPGHOME='.$personalGpgDirectory);
246 246
         putenv('LANGUAGE=de_DE');
247 247
 
248 248
         try {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
         $this->configureCorrectComposerSetup();
277 277
 
278
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
278
+        putenv('GNUPGHOME='.$personalGpgDirectory);
279 279
 
280 280
         $this->assertWillSucceedPackageVerification();
281 281
     }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
         $this->configureCorrectComposerSetup();
301 301
 
302
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
302
+        putenv('GNUPGHOME='.$personalGpgDirectory);
303 303
 
304 304
         $this->assertWillFailPackageVerification();
305 305
     }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
         $this->configureCorrectComposerSetup();
325 325
 
326
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
326
+        putenv('GNUPGHOME='.$personalGpgDirectory);
327 327
 
328 328
         $this->assertWillSucceedPackageVerification();
329 329
     }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
         $this->configureCorrectComposerSetup();
344 344
 
345
-        putenv('GNUPGHOME=' . $gpgHomeDirectory);
345
+        putenv('GNUPGHOME='.$gpgHomeDirectory);
346 346
 
347 347
         $this->assertWillSucceedPackageVerification();
348 348
     }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
         $this->configureCorrectComposerSetup();
362 362
 
363
-        putenv('GNUPGHOME=' . $this->makeGpgHomeDirectory());
363
+        putenv('GNUPGHOME='.$this->makeGpgHomeDirectory());
364 364
 
365 365
         $this->assertWillFailPackageVerification();
366 366
     }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
         $this->configureCorrectComposerSetup();
384 384
 
385
-        putenv('GNUPGHOME=' . $this->makeGpgHomeDirectory());
385
+        putenv('GNUPGHOME='.$this->makeGpgHomeDirectory());
386 386
 
387 387
         $this->assertWillFailPackageVerification();
388 388
     }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
         $this->configureCorrectComposerSetup();
403 403
 
404
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
404
+        putenv('GNUPGHOME='.$personalGpgDirectory);
405 405
 
406 406
         $this->assertWillFailPackageVerification();
407 407
     }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 
424 424
         $this->configureCorrectComposerSetup();
425 425
 
426
-        putenv('GNUPGHOME=' . $gpgHome);
426
+        putenv('GNUPGHOME='.$gpgHome);
427 427
 
428 428
         $this->assertWillFailPackageVerification();
429 429
     }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
         $this->configureCorrectComposerSetup();
447 447
 
448
-        putenv('GNUPGHOME=' . $gpgHome);
448
+        putenv('GNUPGHOME='.$gpgHome);
449 449
 
450 450
         $this->assertWillFailPackageVerification();
451 451
     }
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 
466 466
         $this->configureCorrectComposerSetup();
467 467
 
468
-        putenv('GNUPGHOME=' . $personalGpgDirectory);
468
+        putenv('GNUPGHOME='.$personalGpgDirectory);
469 469
 
470 470
         $this->assertWillFailPackageVerification();
471 471
     }
472 472
 
473 473
     private function makeVendorDirectory() : string
474 474
     {
475
-        $vendorDirectory = sys_get_temp_dir() . '/' . uniqid('vendor', true);
475
+        $vendorDirectory = sys_get_temp_dir().'/'.uniqid('vendor', true);
476 476
 
477 477
         self::assertTrue(mkdir($vendorDirectory));
478 478
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
         string $email,
526 526
         string $name
527 527
     ) : string {
528
-        $dependencyRepository = $vendorDirectory . '/' . $packageName;
528
+        $dependencyRepository = $vendorDirectory.'/'.$packageName;
529 529
 
530 530
         self::assertTrue(mkdir($dependencyRepository, 0777, true));
531 531
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
     private function makeGpgHomeDirectory() : string
555 555
     {
556
-        $homeDirectory = sys_get_temp_dir() . '/' . uniqid('gpg-verification-test', true);
556
+        $homeDirectory = sys_get_temp_dir().'/'.uniqid('gpg-verification-test', true);
557 557
 
558 558
         self::assertTrue(mkdir($homeDirectory, 0700));
559 559
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
         self::assertGreaterThan(
579 579
             0,
580 580
             file_put_contents(
581
-                $gpgHomeDirectory . '/key-info.txt',
581
+                $gpgHomeDirectory.'/key-info.txt',
582 582
                 str_replace(['<<<NAME>>>', '<<<EMAIL>>>'], [$name, $emailAddress], $input)
583 583
             )
584 584
         );
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
         string $foreignKey,
643 643
         bool $sign
644 644
     ) : void {
645
-        $exportPath = sys_get_temp_dir() . '/' . uniqid('exportedKey', true);
645
+        $exportPath = sys_get_temp_dir().'/'.uniqid('exportedKey', true);
646 646
 
647 647
         (new Process(
648 648
             sprintf('gpg --export --armor > %s', escapeshellarg($exportPath)),
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
             ->setTimeout(30)
663 663
             ->mustRun();
664 664
 
665
-        if (! $sign) {
665
+        if (!$sign) {
666 666
             return;
667 667
         }
668 668
 
Please login to merge, or discard this patch.
src/Roave/ComposerGpgVerify/Exception/PackagesTrustCheckFailed.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 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.
src/Roave/ComposerGpgVerify/Verify.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $installationManager = $composer->getInstallationManager();
67 67
         /* @var $checkedPackages PackageVerification[] */
68 68
         $checkedPackages     = array_map(
69
-            function (PackageInterface $package) use ($installationManager) : PackageVerification {
69
+            function(PackageInterface $package) use ($installationManager) : PackageVerification {
70 70
                 return self::verifyPackage($installationManager, $package);
71 71
             },
72 72
             $composer->getRepositoryManager()->getLocalRepository()->getPackages()
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 
77 77
         $escapes = array_filter(
78 78
             $checkedPackages,
79
-            function (PackageVerification $verification) : bool {
80
-                return ! $verification->isVerified();
79
+            function(PackageVerification $verification) : bool {
80
+                return !$verification->isVerified();
81 81
             }
82 82
         );
83 83
 
84
-        if (! $escapes) {
84
+        if (!$escapes) {
85 85
             $io->write('<info>roave/composer-gpg-verify:</info>  All installed packages passed GPG validation!');
86 86
 
87 87
             return;
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
         InstallationManager $installationManager,
95 95
         PackageInterface $package
96 96
     ) : PackageVerification {
97
-        $gitDirectory = $installationManager->getInstallPath($package) . '/.git';
97
+        $gitDirectory = $installationManager->getInstallPath($package).'/.git';
98 98
 
99
-        if (! is_dir($gitDirectory)) {
99
+        if (!is_dir($gitDirectory)) {
100 100
             return UnknownPackageFormat::fromNonGitPackage($package);
101 101
         }
102 102
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     private static function checkTagSignatures(string $gitDirectory, PackageInterface $package, string ...$tags) : array
151 151
     {
152 152
         return array_map(
153
-            function (string $tag) use ($gitDirectory, $package) : GitSignatureCheck {
153
+            function(string $tag) use ($gitDirectory, $package) : GitSignatureCheck {
154 154
                 $command = sprintf(
155 155
                     'git --git-dir %s tag -v %s 2>&1',
156 156
                     escapeshellarg($gitDirectory),
Please login to merge, or discard this patch.
src/Roave/ComposerGpgVerify/Package/Git/GitSignatureCheck.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -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
     }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 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;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 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;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 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;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 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/GitPackage.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -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.