Test Failed
Pull Request — master (#225)
by MusikAnimal
05:07
created
src/AppBundle/AppBundle.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 /**
5 5
  * This file contains only the AppBundle class.
Please login to merge, or discard this patch.
src/AppBundle/EventSubscriber/ExceptionListener.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 /**
5 5
  * This file contains only the ExceptionListener class.
Please login to merge, or discard this patch.
src/AppBundle/EventSubscriber/RateLimitSubscriber.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 /**
5 5
  * This file contains only the RateLimitSubscriber class.
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function onKernelController(FilterControllerEvent $event): void
58 58
     {
59
-        $this->rateLimit = (int) $this->container->getParameter('app.rate_limit_count');
60
-        $this->rateDuration = (int) $this->container->getParameter('app.rate_limit_time');
59
+        $this->rateLimit = (int)$this->container->getParameter('app.rate_limit_count');
60
+        $this->rateDuration = (int)$this->container->getParameter('app.rate_limit_time');
61 61
 
62 62
         // Zero values indicate the rate limiting feature should be disabled.
63 63
         if (0 === $this->rateLimit || 0 === $this->rateDuration) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         }
66 66
 
67 67
         $controller = $event->getController();
68
-        $loggedIn = (bool) $this->container->get('session')->get('logged_in_user');
68
+        $loggedIn = (bool)$this->container->get('session')->get('logged_in_user');
69 69
 
70 70
         /**
71 71
          * Rate limiting will not apply to these actions
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $cacheItem = $cache->getItem($cacheKey);
92 92
 
93 93
         // If increment value already in cache, or start with 1.
94
-        $count = $cacheItem->isHit() ? (int) $cacheItem->get() + 1 : 1;
94
+        $count = $cacheItem->isHit() ? (int)$cacheItem->get()+1 : 1;
95 95
 
96 96
         // Check if limit has been exceeded, and if so, throw an error.
97 97
         if ($count > $this->rateLimit) {
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
         // Log the denied request
145 145
         $logger = $this->container->get('monolog.logger.rate_limit');
146 146
         $logger->info(
147
-            "<URI>: " . $request->getRequestUri() .
148
-            ('' != $logComment ? "\t<Reason>: $logComment" : '') .
149
-            "\t<User agent>: " . $request->headers->get('User-Agent')
147
+            "<URI>: ".$request->getRequestUri().
148
+            ('' != $logComment ? "\t<Reason>: $logComment" : '').
149
+            "\t<User agent>: ".$request->headers->get('User-Agent')
150 150
         );
151 151
 
152 152
         throw new TooManyRequestsHttpException(600, 'error-rate-limit', null, $this->rateDuration);
Please login to merge, or discard this patch.
src/AppBundle/EventSubscriber/DisabledToolSubscriber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 /**
5 5
  * This file contains only the DisabledToolSubscriber class.
Please login to merge, or discard this patch.
src/AppBundle/Twig/AppExtension.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 /**
5 5
  * This file contains only the AppExtension class.
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     public function requestTime(): float
109 109
     {
110 110
         if (!isset($this->requestTime)) {
111
-            $this->requestTime = microtime(true) - $this->getRequest()->server->get('REQUEST_TIME_FLOAT');
111
+            $this->requestTime = microtime(true)-$this->getRequest()->server->get('REQUEST_TIME_FLOAT');
112 112
         }
113 113
 
114 114
         return $this->requestTime;
@@ -660,15 +660,15 @@  discard block
 block discarded – undo
660 660
 
661 661
         if ($seconds >= 86400) {
662 662
             // Over a day
663
-            $val = (int) floor($seconds / 86400);
663
+            $val = (int)floor($seconds / 86400);
664 664
             $key = 'days';
665 665
         } elseif ($seconds >= 3600) {
666 666
             // Over an hour, less than a day
667
-            $val = (int) floor($seconds / 3600);
667
+            $val = (int)floor($seconds / 3600);
668 668
             $key = 'hours';
669 669
         } elseif ($seconds >= 60) {
670 670
             // Over a minute, less than an hour
671
-            $val = (int) floor($seconds / 60);
671
+            $val = (int)floor($seconds / 60);
672 672
             $key = 'minutes';
673 673
         }
674 674
 
Please login to merge, or discard this patch.
src/AppBundle/Model/SimpleEditCounter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 
4 4
 /**
5 5
  * This file contains only the SimpleEditCounter class.
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function getTotalEditCount(): int
135 135
     {
136
-        return $this->data['deletedEditCount'] + $this->data['liveEditCount'];
136
+        return $this->data['deletedEditCount']+$this->data['liveEditCount'];
137 137
     }
138 138
 
139 139
     /**
Please login to merge, or discard this patch.
src/AppBundle/Model/TopEdits.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the TopEdits class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     {
140 140
         $firstDateTime = $this->topEdits[0]->getTimestamp();
141 141
         $lastDateTime = end($this->topEdits)->getTimestamp();
142
-        $secs = $firstDateTime->getTimestamp() - $lastDateTime->getTimestamp();
142
+        $secs = $firstDateTime->getTimestamp()-$lastDateTime->getTimestamp();
143 143
         $days = $secs / (60 * 60 * 24);
144 144
         return $days / count($this->topEdits);
145 145
     }
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
         $displayTitles = $this->getDisplayTitles($pages);
312 312
 
313 313
         foreach ($pages as $page) {
314
-            $nsId = (int) $page['page_namespace'];
315
-            $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']] . ':' : '';
316
-            $pageTitle = $nsTitle . $page['page_title'];
314
+            $nsId = (int)$page['page_namespace'];
315
+            $nsTitle = $nsId > 0 ? $this->project->getNamespaces()[$page['page_namespace']].':' : '';
316
+            $pageTitle = $nsTitle.$page['page_title'];
317 317
             $page['displaytitle'] = $displayTitles[$pageTitle];
318 318
 
319 319
             // $page['page_title'] is retained without the namespace
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
         $namespaces = $this->project->getNamespaces();
341 341
 
342 342
         // First extract page titles including namespace.
343
-        $pageTitles = array_map(function ($page) use ($namespaces) {
343
+        $pageTitles = array_map(function($page) use ($namespaces) {
344 344
             // If non-mainspace, prepend namespace to the titles.
345 345
             $ns = $page['page_namespace'];
346
-            $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']] . ':' : '';
347
-            return $nsTitle . $page['page_title'];
346
+            $nsTitle = $ns > 0 ? $namespaces[$page['page_namespace']].':' : '';
347
+            return $nsTitle.$page['page_title'];
348 348
         }, $topPages);
349 349
 
350 350
         return $this->getRepository()->getDisplayTitles($this->project, $pageTitles);
Please login to merge, or discard this patch.
src/AppBundle/Model/PageAssessments.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
  * This file contains only the PageAssessments class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
Please login to merge, or discard this patch.
src/AppBundle/Model/EditCounter.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * This file contains only the EditCounter class.
4 4
  */
5 5
 
6
-declare(strict_types = 1);
6
+declare(strict_types=1);
7 7
 
8 8
 namespace AppBundle\Model;
9 9
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
         // Filter out unblocks unless requested.
140 140
         if ($blocksOnly) {
141
-            $blocks = array_filter($blocks, function ($block) {
141
+            $blocks = array_filter($blocks, function($block) {
142 142
                 return 'block' === $block['log_action'];
143 143
             });
144 144
         }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     public function countAllRevisions(): int
174 174
     {
175
-        return $this->countLiveRevisions() + $this->countDeletedRevisions();
175
+        return $this->countLiveRevisions()+$this->countDeletedRevisions();
176 176
     }
177 177
 
178 178
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function countRevisionsWithoutComments(): int
193 193
     {
194
-        return $this->countLiveRevisions() - $this->countRevisionsWithComments();
194
+        return $this->countLiveRevisions()-$this->countRevisionsWithComments();
195 195
     }
196 196
 
197 197
     /**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function countAllPagesEdited(): int
232 232
     {
233
-        return $this->countLivePagesEdited() + $this->countDeletedPagesEdited();
233
+        return $this->countLivePagesEdited()+$this->countDeletedPagesEdited();
234 234
     }
235 235
 
236 236
     /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public function countPagesCreated(): int
242 242
     {
243
-        return $this->countCreatedPagesLive() + $this->countPagesCreatedDeleted();
243
+        return $this->countCreatedPagesLive()+$this->countPagesCreatedDeleted();
244 244
     }
245 245
 
246 246
     /**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             } elseif ('unblock' === $block['log_action']) {
381 381
                 // The last block was lifted. So the duration will be the time from when the
382 382
                 // last block was set to the time of the unblock.
383
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
383
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
384 384
                 if ($timeSinceLastBlock > $this->longestBlockSeconds) {
385 385
                     $this->longestBlockSeconds = $timeSinceLastBlock;
386 386
 
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
                 // The last block was modified. So we will adjust $lastBlock to include
392 392
                 // the difference of the duration of the new reblock, and time since the last block.
393 393
                 // $lastBlock is left unchanged if its duration was indefinite.
394
-                $timeSinceLastBlock = $timestamp - $lastBlock[0];
395
-                $lastBlock[1] = $timeSinceLastBlock + $duration;
394
+                $timeSinceLastBlock = $timestamp-$lastBlock[0];
395
+                $lastBlock[1] = $timeSinceLastBlock+$duration;
396 396
             }
397 397
         }
398 398
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         }
403 403
 
404 404
         // Test if the last block is still active, and if so use the expiry as the duration.
405
-        $lastBlockExpiry = $lastBlock[0] + $lastBlock[1];
405
+        $lastBlockExpiry = $lastBlock[0]+$lastBlock[1];
406 406
         if ($lastBlockExpiry > time() && $lastBlockExpiry > $this->longestBlockSeconds) {
407 407
             $this->longestBlockSeconds = $lastBlock[1];
408 408
         // Otherwise, test if the duration of the last block is now the longest overall.
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
         // If invalid, $duration is left as null.
444 444
         if (strtotime($durationStr)) {
445 445
             $expiry = strtotime($durationStr, $timestamp);
446
-            $duration = $expiry - $timestamp;
446
+            $duration = $expiry-$timestamp;
447 447
         }
448 448
 
449 449
         return [$timestamp, $duration];
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
         $import = isset($logCounts['import-import']) ? (int)$logCounts['import-import'] : 0;
531 531
         $interwiki = isset($logCounts['import-interwiki']) ? (int)$logCounts['import-interwiki'] : 0;
532 532
         $upload = isset($logCounts['import-upload']) ? (int)$logCounts['import-upload'] : 0;
533
-        return $import + $interwiki + $upload;
533
+        return $import+$interwiki+$upload;
534 534
     }
535 535
 
536 536
     /**
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
     public function approvals(): int
645 645
     {
646 646
         $logCounts = $this->getLogCounts();
647
-        $total = $logCounts['review-approve'] +
648
-        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0) +
649
-        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0) +
647
+        $total = $logCounts['review-approve']+
648
+        (!empty($logCounts['review-approve-a']) ? $logCounts['review-approve-a'] : 0)+
649
+        (!empty($logCounts['review-approve-i']) ? $logCounts['review-approve-i'] : 0)+
650 650
         (!empty($logCounts['review-approve-ia']) ? $logCounts['review-approve-ia'] : 0);
651 651
         return $total;
652 652
     }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         $logCounts = $this->getLogCounts();
671 671
         $create2 = $logCounts['newusers-create2'] ?: 0;
672 672
         $byemail = $logCounts['newusers-byemail'] ?: 0;
673
-        return $create2 + $byemail;
673
+        return $create2+$byemail;
674 674
     }
675 675
 
676 676
     /**
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 
754 754
         $totals = $this->getRepository()->getMonthCounts($this->project, $this->user);
755 755
         $out = [
756
-            'yearLabels' => [],  // labels for years
756
+            'yearLabels' => [], // labels for years
757 757
             'monthLabels' => [], // labels for months
758 758
             'totals' => [], // actual totals, grouped by namespace, year and then month
759 759
         ];
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
                 $out['totals'][$ns][$total['year']] = [];
848 848
             }
849 849
 
850
-            $out['totals'][$ns][$total['year']][$total['month']] = (int) $total['count'];
850
+            $out['totals'][$ns][$total['year']][$total['month']] = (int)$total['count'];
851 851
         }
852 852
 
853 853
         return [$out, $firstEdit];
@@ -864,9 +864,9 @@  discard block
 block discarded – undo
864 864
     private function fillInMonthTotalsAndLabels(array $out, DatePeriod $dateRange)
865 865
     {
866 866
         foreach ($dateRange as $monthObj) {
867
-            $year = (int) $monthObj->format('Y');
867
+            $year = (int)$monthObj->format('Y');
868 868
             $yearLabel = $this->i18n->dateFormat($monthObj, 'yyyy');
869
-            $month = (int) $monthObj->format('n');
869
+            $month = (int)$monthObj->format('n');
870 870
             $monthLabel = $this->i18n->dateFormat($monthObj, 'yyyy-MM');
871 871
 
872 872
             // Fill in labels
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
         if ($sorted) {
1040 1040
             // Sort.
1041
-            uasort($this->globalEditCounts, function ($a, $b) {
1042
-                return $b['total'] - $a['total'];
1041
+            uasort($this->globalEditCounts, function($a, $b) {
1042
+                return $b['total']-$a['total'];
1043 1043
             });
1044 1044
         }
1045 1045
 
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
     public function countSmallEdits(): int
1129 1129
     {
1130 1130
         $editSizeData = $this->getEditSizeData();
1131
-        return isset($editSizeData['small_edits']) ? (int) $editSizeData['small_edits'] : 0;
1131
+        return isset($editSizeData['small_edits']) ? (int)$editSizeData['small_edits'] : 0;
1132 1132
     }
1133 1133
 
1134 1134
     /**
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
     public function countLargeEdits(): int
1139 1139
     {
1140 1140
         $editSizeData = $this->getEditSizeData();
1141
-        return isset($editSizeData['large_edits']) ? (int) $editSizeData['large_edits'] : 0;
1141
+        return isset($editSizeData['large_edits']) ? (int)$editSizeData['large_edits'] : 0;
1142 1142
     }
1143 1143
 
1144 1144
     /**
Please login to merge, or discard this patch.