@@ -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,15 +127,15 @@ 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) { |
|
| 134 | + function($item) use ($major) { |
|
| 135 | 135 | /** @var string $milestone */ |
| 136 | 136 | $milestone = Hash::get($item, 'milestone.title'); |
| 137 | 137 | $milestone = str_replace('-', '.', $milestone); |
| 138 | - $v = substr($milestone, 0, (int)strpos($milestone, '.')); |
|
| 138 | + $v = substr($milestone, 0, (int) strpos($milestone, '.')); |
|
| 139 | 139 | |
| 140 | 140 | return $v == $major; |
| 141 | 141 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | protected function fetchPrs(string $from): array |
| 152 | 152 | { |
| 153 | - $client = new Client((array)$this->getConfig('client')); |
|
| 153 | + $client = new Client((array) $this->getConfig('client')); |
|
| 154 | 154 | $query = [ |
| 155 | 155 | 'q' => sprintf('is:pr draft:false repo:bedita/bedita merged:>%s', $from), |
| 156 | 156 | 'sort' => '-closed', |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $url = $this->getConfig('url'); |
| 162 | 162 | $response = $client->get($url, $query, compact('headers')); |
| 163 | 163 | |
| 164 | - return (array)$response->getJson(); |
|
| 164 | + return (array) $response->getJson(); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $res = []; |
| 176 | 176 | foreach ($items as $item) { |
| 177 | 177 | $labels = Hash::extract($item, 'labels.{n}.name'); |
| 178 | - $type = $this->classify((array)$labels); |
|
| 178 | + $type = $this->classify((array) $labels); |
|
| 179 | 179 | $res[$type][] = $item; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | protected function classify(array $labels): string |
| 192 | 192 | { |
| 193 | - foreach ((array)$this->getConfig('filter') as $name => $data) { |
|
| 194 | - if (!empty(array_intersect($labels, (array)$data))) { |
|
| 193 | + foreach ((array) $this->getConfig('filter') as $name => $data) { |
|
| 194 | + if (!empty(array_intersect($labels, (array) $data))) { |
|
| 195 | 195 | return $name; |
| 196 | 196 | } |
| 197 | 197 | } |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $out = sprintf("## Version %s - Cactus\n", $version); |
| 212 | 212 | |
| 213 | - foreach ((array)$this->getConfig('sections') as $name => $label) { |
|
| 213 | + foreach ((array) $this->getConfig('sections') as $name => $label) { |
|
| 214 | 214 | /** @var string $label */ |
| 215 | - $out .= sprintf("\n### %s changes (%s)\n\n", $label, (string)$version); |
|
| 216 | - $out .= $this->loglines((array)Hash::get($changeLog, $name)); |
|
| 215 | + $out .= sprintf("\n### %s changes (%s)\n\n", $label, (string) $version); |
|
| 216 | + $out .= $this->loglines((array) Hash::get($changeLog, $name)); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | file_put_contents(sprintf('changelog-%s.md', $version), $out); |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | { |
| 230 | 230 | $res = ''; |
| 231 | 231 | foreach ($items as $item) { |
| 232 | - $id = (string)$item['number']; |
|
| 233 | - $url = (string)$item['html_url']; |
|
| 234 | - $title = (string)$item['title']; |
|
| 232 | + $id = (string) $item['number']; |
|
| 233 | + $url = (string) $item['html_url']; |
|
| 234 | + $title = (string) $item['title']; |
|
| 235 | 235 | $res .= sprintf("* [#%s](%s) %s\n", $id, $url, $title); |
| 236 | 236 | } |
| 237 | 237 | |