Failed Conditions
Pull Request — master (#1851)
by Struan
04:38
created
www/docs/calendar/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     foreach ($data['order'] as &$chamber) {
81 81
         if (in_array($chamber['major'] ?? 0, $majors)) {
82 82
             $URL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$chamber['major']]['page_all']);
83
-            $URL->insert([ 'd' => $date ]);
83
+            $URL->insert(['d' => $date]);
84 84
             $chamber['url'] = $URL->generate();
85 85
         }
86 86
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     [$firstyear, $firstmonth, $day] = explode('-', $min_future_date);
111 111
     [$finalyear, $finalmonth, $day] = explode('-', $max_future_date);
112 112
 
113
-    $q =  $db->query("SELECT DISTINCT(event_date) AS event_date FROM future
113
+    $q = $db->query("SELECT DISTINCT(event_date) AS event_date FROM future
114 114
         WHERE event_date >= :firstdate
115 115
         AND event_date <= :finaldate
116 116
         AND deleted = 0
Please login to merge, or discard this patch.
www/docs/user/login/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 block discarded – undo
19 19
 if (get_http_var("submitted") == "true") {
20 20
     // Form has been submitted, so check input.
21 21
 
22
-    $email 		= get_http_var("email");
22
+    $email = get_http_var("email");
23 23
     $password 	= get_http_var("password");
24 24
     $remember 	= get_http_var("remember");
25 25
 
26 26
     // The user may have tried to do something that requires being logged in.
27 27
     // In which case we should arrive here with that page's URL in 'ret'.
28 28
     // We can then send the user there after log in.
29
-    $returnurl 	= get_http_var("ret");
29
+    $returnurl = get_http_var("ret");
30 30
 
31 31
     $errors = [];
32 32
 
Please login to merge, or discard this patch.
scripts/alertmailer.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -469,7 +469,7 @@
 block discarded – undo
469 469
 
470 470
     $text .= '====================';
471 471
     $sentemails++;
472
-    mlog("SEND $sentemails : Sending email to $current[email] ... ");
472
+    mlog("send $sentemails : Sending email to $current[email] ... ");
473 473
     $d = ['to' => $current['email'], 'template' => $template];
474 474
     $m = [
475 475
         'DATA' => $text,
Please login to merge, or discard this patch.
scripts/alertgonemps.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,8 @@
 block discarded – undo
166 166
         $success = send_template_email($d, $m, true);
167 167
         mlog("sent ... ");
168 168
         # sleep if time between sending mails is less than a certain number of seconds on average
169
-        if (((time() - $start_time) / $sentemails) < 0.5) { # number of seconds per mail not to be quicker than
169
+        if (((time() - $start_time) / $sentemails) < 0.5) {
170
+# number of seconds per mail not to be quicker than
170 171
             mlog("pausing ... ");
171 172
             sleep(1);
172 173
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
     global $globalsuccess, $sentemails, $nomail, $start_time;
155 155
 
156 156
     $sentemails++;
157
-    mlog("SEND $sentemails : Sending email to $current[email] ... ");
157
+    mlog("send $sentemails : Sending email to $current[email] ... ");
158 158
     $d = ['to' => $current['email'], 'template' => $template];
159 159
     $m = [
160 160
         'DATA' => join("\n", $data),
Please login to merge, or discard this patch.
scripts/mprss.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,8 @@
 block discarded – undo
106 106
     // Write the text to the file...
107 107
     $filename = $rsspath . $person_id . '.rdf';
108 108
     $fh = @fopen($filename, "w");
109
-    if (!$fh) { # Problem writing, just carry on
109
+    if (!$fh) {
110
+# Problem writing, just carry on
110 111
         echo "Could not write to file ($filename)\n";
111 112
         continue;
112 113
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 foreach ($q as $person) {
25 25
     $person_id = $person['person_id'];
26 26
 
27
-    $args =  [ 'person_id' => $person_id ];
27
+    $args = ['person_id' => $person_id];
28 28
     $speeches = $HANSARDLIST->display('person', $args, 'none');
29 29
 
30 30
     // Some data about this person that we'll need for the feed.
Please login to merge, or discard this patch.
tests/PageTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
     }
17 17
 
18 18
     public function testQueenie() {
19
-        $page = $this->fetch_page([ 'representative_type' => 'royal', 'n' => 'elizabeth_the_second' ]);
19
+        $page = $this->fetch_page(['representative_type' => 'royal', 'n' => 'elizabeth_the_second']);
20 20
         $this->assertStringContainsString('Elizabeth the Second', $page);
21 21
         $this->assertStringContainsString('Coronated on 2 June 1953', $page);
22 22
     }
23 23
 
24 24
     public function testSittingMP() {
25
-        $page = $this->fetch_page([ 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ]);
25
+        $page = $this->fetch_page(['pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency']);
26 26
         $this->assertStringContainsString('Test Current-MP', $page);
27 27
         $this->assertMatchesRegularExpression('#<span class="person-header__about__position__constituency">\s*Test Westminster Constituency\s*</span>#', $page);
28 28
         $this->assertMatchesRegularExpression('#<span class="person-header__about__position__role">\s*Labour\s*MP\s*</span>#', $page);
29 29
     }
30 30
 
31 31
     public function testSittingMLA() {
32
-        $page = $this->fetch_page([ 'pid' => 4, 'representative_type' => 'mla', 'url' => '/mp/4/test_current-mla' ]);
32
+        $page = $this->fetch_page(['pid' => 4, 'representative_type' => 'mla', 'url' => '/mp/4/test_current-mla']);
33 33
         $this->assertStringContainsString('Test Current-MLA', $page);
34 34
         $this->assertMatchesRegularExpression('#<span class="person-header__about__position__constituency">\s*Test Northern Ireland Constituency\s*</span>#', $page);
35 35
         $this->assertMatchesRegularExpression('#<span class="person-header__about__position__role">\s*Sinn Féin\s*MLA\s*</span>#', $page);
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * Ensure that the Sinn Fein message is displayed for SF MPs.
40 40
      */
41 41
     public function testSittingSinnFeinMP() {
42
-        $page = $this->fetch_page([ 'pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency' ]);
42
+        $page = $this->fetch_page(['pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency']);
43 43
         $this->assertStringContainsString('Sinn F&eacute;in MPs do not take their seats in Parliament.', $page);
44 44
     }
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * Ensure that the Sinn Fein message is not displayed for non-SF MPs.
48 48
      */
49 49
     public function testSittingNonSinnFeinMP() {
50
-        $page = $this->fetch_page([ 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ]);
50
+        $page = $this->fetch_page(['pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency']);
51 51
         $this->assertStringNotContainsString('Sinn F&eacute;in MPs do not take their seats in Parliament.', $page);
52 52
     }
53 53
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * Ensure that the Speaker is given the correct constituency.
56 56
      */
57 57
     public function testSpeaker() {
58
-        $page = $this->fetch_page([ 'pid' => 13, 'url' => '/mp/13/test_speaker/buckingham' ]);
58
+        $page = $this->fetch_page(['pid' => 13, 'url' => '/mp/13/test_speaker/buckingham']);
59 59
         $this->assertMatchesRegularExpression('#<span class="person-header__about__position__role">\s*Speaker\s*MP\s*</span>#', $page);
60 60
     }
61 61
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         # makes sure it is empty in case there's something hanging
66 66
         # about in memcached
67 67
         $banner->set_text('', "banner");
68
-        $page = $this->fetch_page([ 'url' => '/' ]);
68
+        $page = $this->fetch_page(['url' => '/']);
69 69
         $this->assertStringNotContainsString('<div class="banner">', $page);
70 70
         $this->assertStringNotContainsString('This is a banner', $page);
71 71
 
@@ -85,20 +85,20 @@  discard block
 block discarded – undo
85 85
         ';
86 86
 
87 87
         $banner->set_text($banner_config, "banner");
88
-        $page = $this->fetch_page([ 'url' => '/' ]);
88
+        $page = $this->fetch_page(['url' => '/']);
89 89
         $this->assertStringContainsString('This is a banner', $page);
90 90
 
91 91
         $banner->set_text('', "banner");
92
-        $page = $this->fetch_page([ 'url' => '/' ]);
92
+        $page = $this->fetch_page(['url' => '/']);
93 93
         $this->assertStringNotContainsString('<div class="banner">', $page);
94 94
         $this->assertStringNotContainsString('This is a banner', $page);
95 95
     }
96 96
 
97 97
     public function testNewMPMessage() {
98
-        $page = $this->fetch_page([ 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ]);
98
+        $page = $this->fetch_page(['pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency']);
99 99
         $this->assertStringNotContainsString('is a recently elected MP', $page);
100 100
         self::$db->query('UPDATE member SET entered_house = NOW() WHERE person_id = 17');
101
-        $page = $this->fetch_page([ 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ]);
101
+        $page = $this->fetch_page(['pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency']);
102 102
         $this->assertStringContainsString('is a recently elected MP', $page);
103 103
     }
104 104
 
Please login to merge, or discard this patch.
tests/PartyTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     }
228 228
 
229 229
     private function getMemberFromPersonId($person_id) {
230
-        return new MySociety\TheyWorkForYou\Member([ "person_id" => $person_id ]);
230
+        return new MySociety\TheyWorkForYou\Member(["person_id" => $person_id]);
231 231
     }
232 232
 
233 233
     public function testMPPartyPolicyTextWhenDiffers() {
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     public function testMPPartyPolicyWherePartyMissingPositions() {
254 254
         // When an MP has votes, but there is no broader party policy to compare it to
255 255
         // this goes down a funnel that shows the votes, but does not make the comparison to party.
256
-        $page = $this->fetch_page(['pid' => 4, 'pagetype' => 'votes','url' => '/mp/4/test_mp_d/test_westminster_constituency/votes']);
256
+        $page = $this->fetch_page(['pid' => 4, 'pagetype' => 'votes', 'url' => '/mp/4/test_mp_d/test_westminster_constituency/votes']);
257 257
         $this->assertStringContainsString('Test MP D', $page);
258 258
         $this->assertStringContainsString('<li class="vote-description"', $page);
259 259
         $this->assertStringNotContainsString('comparable B Party MPs voted', $page);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
     public function testMPPartyPolicyTextWhenAgrees() {
263 263
         // Test when an MP mostly agrees with their party, as MP G Party 2 does with party G
264
-        $page = $this->fetch_page(['pagetype' => 'votes', 'pid' => 16,  'url' => '/mp/16/test_mp_g_party_2/test_westminster_constituency/votes']);
264
+        $page = $this->fetch_page(['pagetype' => 'votes', 'pid' => 16, 'url' => '/mp/16/test_mp_g_party_2/test_westminster_constituency/votes']);
265 265
         $this->assertStringContainsString('Test MP G Party 2', $page);
266 266
 
267 267
         $this->assertStringNotContainsString('sometimes <b>differs</b> from their party colleagues', $page);
Please login to merge, or discard this patch.
tests/UserPageTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     }
41 41
 
42 42
     public function testEditUserInfo() {
43
-        $page = $this->fetch_user_page(['pg' => 'edit' ]);
43
+        $page = $this->fetch_user_page(['pg' => 'edit']);
44 44
         $this->assertStringContainsString('Edit your details', $page);
45 45
         $this->assertStringContainsString('name="pg" value="edit"', $page);
46 46
         $this->assertStringContainsString('value="Test"', $page);
Please login to merge, or discard this patch.
tests/VotesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     }
14 14
 
15 15
     private function fetch_votes_page() {
16
-        return $this->fetch_page([ 'pagetype' => 'votes', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/votes' ]);
16
+        return $this->fetch_page(['pagetype' => 'votes', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/votes']);
17 17
     }
18 18
 
19 19
     public function testVoteSummary() {
Please login to merge, or discard this patch.