Completed
Pull Request — master (#615)
by
unknown
02:51
created
src/SelfUpdateCommand.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -42,6 +42,9 @@
 block discarded – undo
42 42
             );
43 43
     }
44 44
 
45
+    /**
46
+     * @param string $repository
47
+     */
45 48
     protected function getLatestReleaseFromGithub($repository)
46 49
     {
47 50
         $opts = [
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $this
34 34
             ->setName('self-update')
35
-            ->setAliases(array( 'selfupdate' ))
35
+            ->setAliases(array('selfupdate'))
36 36
             ->setDescription('Updates the robo.phar to the latest version.')
37 37
             ->setHelp(
38 38
                 <<<EOT
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
         $releases = file_get_contents('https://api.github.com/repos/' . $repository . '/releases', false, $context);
59 59
         $releases = json_decode($releases);
60 60
 
61
-        if (! isset($releases[0])) {
61
+        if (!isset($releases[0])) {
62 62
             throw new \Exception('API error - no release found at GitHub repository ' . $repository);
63 63
         }
64 64
 
65 65
         $version = $releases[0]->tag_name;
66 66
         $url     = $releases[0]->assets[0]->browser_download_url;
67 67
 
68
-        return [ $version, $url ];
68
+        return [$version, $url];
69 69
     }
70 70
 
71 71
     /**
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
         $tempFilename  = dirname($localFilename) . '/' . basename($localFilename, '.phar') . '-temp.phar';
79 79
 
80 80
         // check for permissions in local filesystem before start connection process
81
-        if (! is_writable($tempDirectory = dirname($tempFilename))) {
81
+        if (!is_writable($tempDirectory = dirname($tempFilename))) {
82 82
             throw new \Exception(
83 83
                 $programName . ' update failed: the "' . $tempDirectory .
84 84
                 '" directory used to download the temp file could not be written'
85 85
             );
86 86
         }
87 87
 
88
-        if (! is_writable($localFilename)) {
88
+        if (!is_writable($localFilename)) {
89 89
             throw new \Exception(
90 90
                 $programName . ' update failed: the "' . $localFilename . '" file could not be written'
91 91
             );
92 92
         }
93 93
 
94
-        list( $latest, $downloadUrl ) = $this->getLatestReleaseFromGithub('consolidation/robo');
94
+        list($latest, $downloadUrl) = $this->getLatestReleaseFromGithub('consolidation/robo');
95 95
 
96 96
 
97 97
         if (Robo::VERSION == $latest) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             $this->_exit();
121 121
         } catch (\Exception $e) {
122 122
             @unlink($tempFilename);
123
-            if (! $e instanceof \UnexpectedValueException && ! $e instanceof \PharException) {
123
+            if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
124 124
                 throw $e;
125 125
             }
126 126
             $output->writeln('<error>The download is corrupted (' . $e->getMessage() . ').</error>');
Please login to merge, or discard this patch.