@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Monolog; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Exception; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Helper; |
| 6 | 6 | |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $session = $this->container->get('session'); |
| 85 | - $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title=' . |
|
| 86 | - 'MediaWiki:XTools-AutoEdits.json' . ($useSandbox ? '/sandbox' : ''); |
|
| 85 | + $uri = 'https://meta.wikimedia.org/w/index.php?action=raw&ctype=application/json&title='. |
|
| 86 | + 'MediaWiki:XTools-AutoEdits.json'.($useSandbox ? '/sandbox' : ''); |
|
| 87 | 87 | |
| 88 | 88 | if ($useSandbox && $session->get('logged_in_user')) { |
| 89 | 89 | // Request via OAuth to get around server-side caching. |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | // Once last walk through for some tidying up and validation. |
| 148 | 148 | $invalid = []; |
| 149 | - array_walk($this->tools[$projectDomain], function (&$data, $tool) use (&$invalid): void { |
|
| 149 | + array_walk($this->tools[$projectDomain], function(&$data, $tool) use (&$invalid): void { |
|
| 150 | 150 | // Populate the 'label' with the tool name, if a label doesn't already exist. |
| 151 | 151 | $data['label'] = $data['label'] ?? $tool; |
| 152 | 152 | |
@@ -230,14 +230,14 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $revertEntries = array_filter( |
| 232 | 232 | $this->getTools($project), |
| 233 | - function ($tool) { |
|
| 233 | + function($tool) { |
|
| 234 | 234 | return isset($tool['revert']) && isset($tool['regex']); |
| 235 | 235 | } |
| 236 | 236 | ); |
| 237 | 237 | |
| 238 | 238 | // If 'revert' is set to `true`, then use 'regex' as the regular expression, |
| 239 | 239 | // otherwise 'revert' is assumed to be the regex string. |
| 240 | - $this->revertTools[$projectDomain] = array_map(function ($revertTool) { |
|
| 240 | + $this->revertTools[$projectDomain] = array_map(function($revertTool) { |
|
| 241 | 241 | return [ |
| 242 | 242 | 'link' => $revertTool['link'], |
| 243 | 243 | 'regex' => true === $revertTool['revert'] ? $revertTool['regex'] : $revertTool['revert'], |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Helper; |
| 6 | 6 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Find the path, and complain if English doesn't exist. |
| 74 | - $path = $this->container->getParameter('kernel.root_dir') . '/../i18n'; |
|
| 74 | + $path = $this->container->getParameter('kernel.root_dir').'/../i18n'; |
|
| 75 | 75 | if (!file_exists("$path/en.json")) { |
| 76 | 76 | throw new Exception("Language directory doesn't exist: $path"); |
| 77 | 77 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $messageFiles = glob($this->container->getParameter('kernel.root_dir').'/../i18n/*.json'); |
| 127 | 127 | |
| 128 | 128 | $languages = array_values(array_unique(array_map( |
| 129 | - function ($filename) { |
|
| 129 | + function($filename) { |
|
| 130 | 130 | return basename($filename, '.json'); |
| 131 | 131 | }, |
| 132 | 132 | $messageFiles |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $this->getIntuition()->getLangFallbacks($this->getLang()) |
| 169 | 169 | ); |
| 170 | 170 | |
| 171 | - return array_filter($fallbacks, function ($lang) use ($i18nPath) { |
|
| 171 | + return array_filter($fallbacks, function($lang) use ($i18nPath) { |
|
| 172 | 172 | return is_file($i18nPath.$lang.'.json'); |
| 173 | 173 | }); |
| 174 | 174 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\EventSubscriber; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\EventSubscriber; |
| 6 | 6 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $cacheItem = $this->cache->getItem($cacheKey); |
| 141 | 141 | |
| 142 | 142 | // If increment value already in cache, or start with 1. |
| 143 | - $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1; |
|
| 143 | + $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1; |
|
| 144 | 144 | |
| 145 | 145 | // Check if limit has been exceeded, and if so, throw an error. |
| 146 | 146 | if ($count > $this->rateLimit) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $cacheItem = $this->cache->getItem($cacheKey); |
| 181 | 181 | |
| 182 | 182 | // If increment value already in cache, or start with 1. |
| 183 | - $count = $cacheItem->isHit() ? (int)$cacheItem->get() + 1 : 1; |
|
| 183 | + $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1; |
|
| 184 | 184 | |
| 185 | 185 | // Check if limit has been exceeded, and if so, add a log entry. |
| 186 | 186 | if ($count > 3) { |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | $message = $this->i18n->msg('error-rate-limit', [ |
| 256 | 256 | $this->rateDuration, |
| 257 | 257 | "<a href='/login'>".$this->i18n->msg('error-rate-limit-login')."</a>", |
| 258 | - "<a href='https://www.mediawiki.org/wiki/Special:MyLanguage/XTools/API' target='_blank'>" . |
|
| 259 | - $this->i18n->msg('api') . |
|
| 258 | + "<a href='https://www.mediawiki.org/wiki/Special:MyLanguage/XTools/API' target='_blank'>". |
|
| 259 | + $this->i18n->msg('api'). |
|
| 260 | 260 | "</a>", |
| 261 | 261 | ]); |
| 262 | 262 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\EventSubscriber; |
| 6 | 6 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | throw new XtoolsHttpException( |
| 260 | 260 | $this->i18n->msg('not-opted-in', [ |
| 261 | 261 | $this->getOptedInPage()->getTitle(), |
| 262 | - $this->i18n->msg('not-opted-in-link') . |
|
| 262 | + $this->i18n->msg('not-opted-in-link'). |
|
| 263 | 263 | ' <https://www.mediawiki.org/wiki/XTools/Edit_Counter#restricted_stats>', |
| 264 | 264 | $this->i18n->msg('not-opted-in-login'), |
| 265 | 265 | ]), |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * Set cookies on the given Response. |
| 304 | 304 | * @param Response $response |
| 305 | 305 | */ |
| 306 | - private function setCookies(Response &$response): void |
|
| 306 | + private function setCookies(Response & $response): void |
|
| 307 | 307 | { |
| 308 | 308 | // Not done for subrequests. |
| 309 | 309 | if ($this->isSubRequest) { |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | $params = $this->convertLegacyParams($params); |
| 699 | 699 | |
| 700 | 700 | // Remove blank values. |
| 701 | - return array_filter($params, function ($param) { |
|
| 701 | + return array_filter($params, function($param) { |
|
| 702 | 702 | // 'namespace' or 'username' could be '0'. |
| 703 | 703 | return null !== $param && '' !== $param; |
| 704 | 704 | }); |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | // Show warnings that the date range was truncated. |
| 757 | 757 | $this->addFlashMessage('warning', 'date-range-too-wide', [$this->maxDays()]); |
| 758 | 758 | |
| 759 | - $startTime = strtotime('-' . $this->maxDays() . ' days', $endTime); |
|
| 759 | + $startTime = strtotime('-'.$this->maxDays().' days', $endTime); |
|
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | return [$startTime, $endTime]; |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | $elapsedTime = round( |
| 902 | - microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT'), |
|
| 902 | + microtime(true)-$this->request->server->get('REQUEST_TIME_FLOAT'), |
|
| 903 | 903 | 3 |
| 904 | 904 | ); |
| 905 | 905 | |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | public function addFullPageTitlesAndContinue(string $key, array $out, array $data): array |
| 941 | 941 | { |
| 942 | 942 | // Add full_page_title (in addition to the existing page_title and page_namespace keys). |
| 943 | - $out[$key] = array_map(function ($rev) { |
|
| 943 | + $out[$key] = array_map(function($rev) { |
|
| 944 | 944 | return array_merge([ |
| 945 | 945 | 'full_page_title' => $this->getPageFromNsAndTitle( |
| 946 | 946 | (int)$rev['page_namespace'], |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | $conn = $this->container->get('doctrine') |
| 977 | 977 | ->getManager('default') |
| 978 | 978 | ->getConnection(); |
| 979 | - $date = date('Y-m-d'); |
|
| 979 | + $date = date('Y-m-d'); |
|
| 980 | 980 | |
| 981 | 981 | // Increment count in timeline |
| 982 | 982 | try { |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace App\Repository; |
| 6 | 6 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | // $tableExtension in order to generate the new table name |
| 208 | 208 | if ($this->isWMF && null !== $tableExtension) { |
| 209 | 209 | $mapped = true; |
| 210 | - $tableName .=('' === $tableExtension ? '' : '_'.$tableExtension); |
|
| 210 | + $tableName .= ('' === $tableExtension ? '' : '_'.$tableExtension); |
|
| 211 | 211 | } elseif ($this->container->hasParameter("app.table.$tableName")) { |
| 212 | 212 | // Use the table specified in the table mapping configuration, if present. |
| 213 | 213 | $mapped = true; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | // This is a safeguard in case table mapping isn't properly set up. |
| 220 | 220 | $isLoggingOrRevision = in_array($tableName, ['revision', 'logging', 'archive']); |
| 221 | 221 | if (!$mapped && $isLoggingOrRevision && $this->isWMF) { |
| 222 | - $tableName .="_userindex"; |
|
| 222 | + $tableName .= "_userindex"; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // Figure out database name. |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $offset = date('YmdHis', $offset); |
| 339 | 339 | $datesConditions .= " AND {$tableAlias}{$field} <= '$offset'"; |
| 340 | 340 | } elseif (is_int($end)) { |
| 341 | - $end = date('Ymd', $end) . '235959'; |
|
| 341 | + $end = date('Ymd', $end).'235959'; |
|
| 342 | 342 | $datesConditions .= " AND {$tableAlias}{$field} <= '$end'"; |
| 343 | 343 | } |
| 344 | 344 | |