@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function initialize(): void |
90 | 90 | { |
91 | - $config = (array)Configure::read('ChangeLog'); |
|
91 | + $config = (array) Configure::read('ChangeLog'); |
|
92 | 92 | $this->setConfig($config); |
93 | 93 | } |
94 | 94 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | $from = $args->getArgument('from'); |
105 | 105 | $io->out("Reading closed PRs from from $from"); |
106 | 106 | |
107 | - $json = $this->fetchPrs((string)$from); |
|
108 | - $items = (array)Hash::get($json, 'items'); |
|
109 | - $version = (string)$args->getArgument('version'); |
|
107 | + $json = $this->fetchPrs((string) $from); |
|
108 | + $items = (array) Hash::get($json, 'items'); |
|
109 | + $version = (string) $args->getArgument('version'); |
|
110 | 110 | $items = $this->filterItems($items, $version); |
111 | 111 | $io->out(sprintf('Loaded %d prs', count($items))); |
112 | 112 | |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function filterItems(array $items, string $version): array |
129 | 129 | { |
130 | - $major = substr($version, 0, (int)strpos($version, '.')); |
|
130 | + $major = substr($version, 0, (int) strpos($version, '.')); |
|
131 | 131 | |
132 | 132 | return array_filter( |
133 | 133 | $items, |
134 | - function ($item) use ($major) { |
|
135 | - $milestone = (string)Hash::get($item, 'milestone.title'); |
|
134 | + function($item) use ($major) { |
|
135 | + $milestone = (string) Hash::get($item, 'milestone.title'); |
|
136 | 136 | $milestone = str_replace('-', '.', $milestone); |
137 | - $v = substr($milestone, 0, (int)strpos($milestone, '.')); |
|
137 | + $v = substr($milestone, 0, (int) strpos($milestone, '.')); |
|
138 | 138 | |
139 | 139 | return $v == $major; |
140 | 140 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function fetchPrs(string $from): array |
151 | 151 | { |
152 | - $client = new Client((array)$this->getConfig('client')); |
|
152 | + $client = new Client((array) $this->getConfig('client')); |
|
153 | 153 | $query = [ |
154 | 154 | 'q' => sprintf('is:pr draft:false repo:bedita/bedita merged:>%s', $from), |
155 | 155 | 'sort' => '-closed', |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $url = $this->getConfig('url'); |
161 | 161 | $response = $client->get($url, $query, compact('headers')); |
162 | 162 | |
163 | - return (array)$response->getJson(); |
|
163 | + return (array) $response->getJson(); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $res = []; |
175 | 175 | foreach ($items as $item) { |
176 | 176 | $labels = Hash::extract($item, 'labels.{n}.name'); |
177 | - $type = $this->classify((array)$labels); |
|
177 | + $type = $this->classify((array) $labels); |
|
178 | 178 | $res[$type][] = $item; |
179 | 179 | } |
180 | 180 | |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function classify(array $labels): string |
191 | 191 | { |
192 | - foreach ((array)$this->getConfig('filter') as $name => $data) { |
|
193 | - if (!empty(array_intersect($labels, (array)$data))) { |
|
192 | + foreach ((array) $this->getConfig('filter') as $name => $data) { |
|
193 | + if (!empty(array_intersect($labels, (array) $data))) { |
|
194 | 194 | return $name; |
195 | 195 | } |
196 | 196 | } |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | { |
210 | 210 | $out = sprintf("## Version %s - Cactus\n", $version); |
211 | 211 | |
212 | - foreach ((array)$this->getConfig('sections') as $name => $label) { |
|
212 | + foreach ((array) $this->getConfig('sections') as $name => $label) { |
|
213 | 213 | /** @var string $label */ |
214 | - $out .= sprintf("\n### %s changes (%s)\n\n", $label, (string)$version); |
|
215 | - $out .= $this->loglines((array)Hash::get($changeLog, $name)); |
|
214 | + $out .= sprintf("\n### %s changes (%s)\n\n", $label, (string) $version); |
|
215 | + $out .= $this->loglines((array) Hash::get($changeLog, $name)); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | file_put_contents(sprintf('changelog-%s.md', $version), $out); |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | { |
229 | 229 | $res = ''; |
230 | 230 | foreach ($items as $item) { |
231 | - $id = (string)$item['number']; |
|
232 | - $url = (string)$item['html_url']; |
|
233 | - $title = (string)$item['title']; |
|
231 | + $id = (string) $item['number']; |
|
232 | + $url = (string) $item['html_url']; |
|
233 | + $title = (string) $item['title']; |
|
234 | 234 | $res .= sprintf("* [#%s](%s) %s\n", $id, $url, $title); |
235 | 235 | } |
236 | 236 |