Passed
Push — master ( 4b4859...1d252d )
by Daimona
02:04
created
includes/Task/Subtask/ArchivePages.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Task\Subtask;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	/**
14 14
 	 * @inheritDoc
15 15
 	 */
16
-	public function runInternal() : int {
16
+	public function runInternal () : int {
17 17
 		$pages = $this->getDataProvider()->getPagesToClose();
18 18
 
19 19
 		if ( !$pages ) {
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 	 * @param PageRiconferma[] $pages
33 33
 	 * @see OpenUpdates::addToMainPage()
34 34
 	 */
35
-	protected function removeFromMainPage( array $pages ) : void {
35
+	protected function removeFromMainPage ( array $pages ) : void {
36 36
 		$this->getLogger()->info(
37 37
 			'Removing from main: ' . implode( ', ', $pages )
38 38
 		);
39 39
 
40 40
 		$mainPage = $this->getPage( $this->getOpt( 'main-page-title' ) );
41
-		$remove = [];
41
+		$remove = [ ];
42 42
 		foreach ( $pages as $page ) {
43 43
 			// Order matters here. It's not guaranteed that there'll be a newline, but avoid
44 44
 			// regexps for that single character.
45
-			$remove[] = '{{' . $page->getTitle() . "}}\n";
46
-			$remove[] = '{{' . $page->getTitle() . '}}';
45
+			$remove[ ] = '{{' . $page->getTitle() . "}}\n";
46
+			$remove[ ] = '{{' . $page->getTitle() . '}}';
47 47
 		}
48 48
 
49 49
 		$newContent = str_replace( $remove, '', $mainPage->getContent() );
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param PageRiconferma[] $pages
74 74
 	 */
75
-	protected function addToArchive( array $pages ) : void {
75
+	protected function addToArchive ( array $pages ) : void {
76 76
 		$this->getLogger()->info(
77 77
 			'Adding to archive: ' . implode( ', ', $pages )
78 78
 		);
79 79
 
80
-		$simple = $votes = [];
80
+		$simple = $votes = [ ];
81 81
 		foreach ( $pages as $page ) {
82 82
 			if ( $page->isVote() ) {
83
-				$votes[] = $page;
83
+				$votes[ ] = $page;
84 84
 			} else {
85
-				$simple[] = $page;
85
+				$simple[ ] = $page;
86 86
 			}
87 87
 		}
88 88
 
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 	 * @param string $archiveTitle
104 104
 	 * @param PageRiconferma[] $pages
105 105
 	 */
106
-	private function reallyAddToArchive( string $archiveTitle, array $pages ) : void {
106
+	private function reallyAddToArchive ( string $archiveTitle, array $pages ) : void {
107 107
 		$archivePage = $this->getPage( "$archiveTitle/" . date( 'Y' ) );
108 108
 		$existed = $archivePage->exists();
109 109
 
110 110
 		$append = "\n";
111
-		$archivedList = [];
111
+		$archivedList = [ ];
112 112
 		foreach ( $pages as $page ) {
113 113
 			$append .= '{{' . $page->getTitle() . "}}\n";
114
-			$archivedList[] = $page->getUserNum();
114
+			$archivedList[ ] = $page->getUserNum();
115 115
 		}
116 116
 
117 117
 		$summary = $this->msg( 'close-archive-summary' )
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param string $archiveTitle
134 134
 	 */
135
-	private function addArchiveYear( string $archiveTitle ) : void {
135
+	private function addArchiveYear ( string $archiveTitle ) : void {
136 136
 		$page = $this->getPage( $archiveTitle );
137 137
 		$year = date( 'Y' );
138 138
 
Please login to merge, or discard this patch.
includes/Task/Subtask/ClosePages.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Task\Subtask;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	/**
14 14
 	 * @inheritDoc
15 15
 	 */
16
-	public function runInternal() : int {
16
+	public function runInternal () : int {
17 17
 		$pages = $this->getDataProvider()->getPagesToClose();
18 18
 
19 19
 		if ( !$pages ) {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	/**
36 36
 	 * @param PageRiconferma $page
37 37
 	 */
38
-	protected function addVoteCloseText( PageRiconferma $page ) : void {
38
+	protected function addVoteCloseText ( PageRiconferma $page ) : void {
39 39
 		$content = $page->getContent();
40 40
 		$beforeReg = '!è necessario ottenere una maggioranza .+ votanti\.!u';
41 41
 		$newContent = preg_replace( $beforeReg, '$0' . "\n" . $page->getOutcomeText(), $content );
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @param PageRiconferma $page
51 51
 	 * @see CreatePages::updateBasePage()
52 52
 	 */
53
-	protected function updateBasePage( PageRiconferma $page ) : void {
53
+	protected function updateBasePage ( PageRiconferma $page ) : void {
54 54
 		$this->getLogger()->info( "Updating base page for $page" );
55 55
 
56 56
 		if ( $page->getNum() === 1 ) {
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
 		$current = $basePage->getContent();
63 63
 
64 64
 		$outcomeText = ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) ?
65
-			'non riconfermato' :
66
-			'riconfermato';
65
+			'non riconfermato' : 'riconfermato';
67 66
 		$text = $page->isVote() ? "votazione: $outcomeText" : 'riconferma tacita';
68 67
 
69 68
 		$newContent = str_replace( 'riconferma in corso', $text, $current );
Please login to merge, or discard this patch.
includes/Task/UpdateList.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Task;
4 4
 
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 	/**
20 20
 	 * @inheritDoc
21 21
 	 */
22
-	protected function getSubtasksMap(): array {
22
+	protected function getSubtasksMap (): array {
23 23
 		// Everything is done here.
24
-		return [];
24
+		return [ ];
25 25
 	}
26 26
 
27 27
 	/**
28 28
 	 * @inheritDoc
29 29
 	 */
30
-	public function runInternal() : int {
30
+	public function runInternal () : int {
31 31
 		$this->actualList = $this->getActualAdmins();
32 32
 		$pageBotList = PageBotList::get( $this->getWiki() );
33 33
 		$this->botList = $pageBotList->getDecodedContent();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @return array
56 56
 	 */
57
-	protected function getActualAdmins() : array {
57
+	protected function getActualAdmins () : array {
58 58
 		$params = [
59 59
 			'action' => 'query',
60 60
 			'list' => 'allusers',
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param \stdClass $data
72 72
 	 * @return array
73 73
 	 */
74
-	protected function extractAdmins( \stdClass $data ) : array {
75
-		$ret = [];
74
+	protected function extractAdmins ( \stdClass $data ) : array {
75
+		$ret = [ ];
76 76
 		$blacklist = $this->getOpt( 'exclude-admins' );
77 77
 		foreach ( $data->query->allusers as $u ) {
78 78
 			if ( in_array( $u->name, $blacklist, true ) ) {
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return array[]
91 91
 	 */
92
-	protected function getMissingGroups() : array {
93
-		$missing = [];
92
+	protected function getMissingGroups () : array {
93
+		$missing = [ ];
94 94
 		foreach ( $this->actualList as $adm => $groups ) {
95
-			$curMissing = array_diff( $groups, array_keys( $this->botList[$adm] ?? [] ) );
95
+			$curMissing = array_diff( $groups, array_keys( $this->botList[ $adm ] ?? [ ] ) );
96 96
 
97 97
 			foreach ( $curMissing as $group ) {
98 98
 				try {
99 99
 					$missing[ $adm ][ $group ] = $this->getFlagDate( $adm, $group );
100 100
 				} catch ( TaskException $e ) {
101
-					$this->errors[] = $e->getMessage();
101
+					$this->errors[ ] = $e->getMessage();
102 102
 				}
103 103
 			}
104 104
 		}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @return string
114 114
 	 * @throws TaskException
115 115
 	 */
116
-	protected function getFlagDate( string $admin, string $group ) : string {
116
+	protected function getFlagDate ( string $admin, string $group ) : string {
117 117
 		$this->getLogger()->info( "Retrieving $group flag date for $admin" );
118 118
 
119 119
 		$url = DEFAULT_URL;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @param string $group
150 150
 	 * @return string|null
151 151
 	 */
152
-	private function extractTimestamp( \stdClass $data, string $group ) : ?string {
152
+	private function extractTimestamp ( \stdClass $data, string $group ) : ?string {
153 153
 		$ts = null;
154 154
 		foreach ( $data->query->logevents as $entry ) {
155 155
 			if (
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return array[]
170 170
 	 */
171
-	protected function getExtraGroups() : array {
172
-		$extra = [];
171
+	protected function getExtraGroups () : array {
172
+		$extra = [ ];
173 173
 		foreach ( $this->botList as $name => $groups ) {
174 174
 			$groups = array_diff_key( $groups, array_fill_keys( PageBotList::NON_GROUP_KEYS, 1 ) );
175 175
 			if ( !isset( $this->actualList[ $name ] ) ) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @param string[] $names
186 186
 	 * @return \stdClass
187 187
 	 */
188
-	private function getRenameEntries( array $names ) : \stdClass {
188
+	private function getRenameEntries ( array $names ) : \stdClass {
189 189
 		$titles = array_map( static function ( $x ) {
190 190
 			return "Utente:$x";
191 191
 		}, $names );
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	 * @param string[] $names
210 210
 	 * @return string[] [ old_name => new_name ]
211 211
 	 */
212
-	protected function getRenamedUsers( array $names ) : array {
212
+	protected function getRenamedUsers ( array $names ) : array {
213 213
 		if ( !$names ) {
214
-			return [];
214
+			return [ ];
215 215
 		}
216 216
 		$this->getLogger()->info( 'Checking rename for ' . implode( ', ', $names ) );
217 217
 
218 218
 		$data = $this->getRenameEntries( $names );
219
-		$ret = [];
219
+		$ret = [ ];
220 220
 		foreach ( $data->query->logevents as $entry ) {
221 221
 			// 1 month is arbitrary
222 222
 			if ( strtotime( $entry->timestamp ) > strtotime( '-1 month' ) ) {
@@ -234,18 +234,18 @@  discard block
 block discarded – undo
234 234
 	 * @param array &$newContent
235 235
 	 * @param array $removed
236 236
 	 */
237
-	private function handleRenames( array &$newContent, array $removed ) : void {
237
+	private function handleRenames ( array &$newContent, array $removed ) : void {
238 238
 		$renameMap = $this->getRenamedUsers( array_keys( $removed ) );
239 239
 		foreach ( $removed as $oldName => $info ) {
240 240
 			if (
241 241
 				array_key_exists( $oldName, $renameMap ) &&
242
-				array_key_exists( $renameMap[$oldName], $newContent )
242
+				array_key_exists( $renameMap[ $oldName ], $newContent )
243 243
 			) {
244 244
 				// This user was renamed! Add this name as alias, if they're still listed
245 245
 				$newName = $renameMap[ $oldName ];
246 246
 				$this->getLogger()->info( "Found rename $oldName -> $newName" );
247
-				$aliases = array_unique( array_merge( $newContent[ $newName ]['aliases'], [ $oldName ] ) );
248
-				$newContent[ $newName ]['aliases'] = $aliases;
247
+				$aliases = array_unique( array_merge( $newContent[ $newName ][ 'aliases' ], [ $oldName ] ) );
248
+				$newContent[ $newName ][ 'aliases' ] = $aliases;
249 249
 				// Transfer overrides to the new name.
250 250
 				$overrides = array_diff_key( $info, [ 'override' => 1, 'override-perm' => 1 ] );
251 251
 				$newContent[ $newName ] = array_merge( $newContent[ $newName ], $overrides );
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 	 * @param array[] $extra
260 260
 	 * @return string[] Removed users
261 261
 	 */
262
-	private function handleExtraAndMissing(
262
+	private function handleExtraAndMissing (
263 263
 		array &$newContent,
264 264
 		array $missing,
265 265
 		array $extra
266 266
 	) : array {
267
-		$removed = [];
267
+		$removed = [ ];
268 268
 		foreach ( $newContent as $user => $groups ) {
269 269
 			if ( isset( $missing[ $user ] ) ) {
270 270
 				$newContent[ $user ] = array_merge( $groups, $missing[ $user ] );
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				if ( array_diff_key( $newGroups, array_fill_keys( PageBotList::NON_GROUP_KEYS, 1 ) ) ) {
275 275
 					$newContent[ $user ] = $newGroups;
276 276
 				} else {
277
-					$removed[$user] = $newContent[$user];
277
+					$removed[ $user ] = $newContent[ $user ];
278 278
 					unset( $newContent[ $user ] );
279 279
 				}
280 280
 			}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @param array[] $extra
292 292
 	 * @return array[]
293 293
 	 */
294
-	protected function getNewContent( array $missing, array $extra ) : array {
294
+	protected function getNewContent ( array $missing, array $extra ) : array {
295 295
 		$newContent = $this->botList;
296 296
 
297 297
 		$removed = $this->handleExtraAndMissing( $newContent, $missing, $extra );
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @param array[] &$newContent
313 313
 	 */
314
-	protected function removeOverrides( array &$newContent ) : void {
315
-		$removed = [];
314
+	protected function removeOverrides ( array &$newContent ) : void {
315
+		$removed = [ ];
316 316
 		foreach ( $newContent as $user => $groups ) {
317 317
 			if ( PageBotList::isOverrideExpired( $groups ) ) {
318 318
 				unset( $newContent[ $user ][ 'override' ] );
319
-				$removed[] = $user;
319
+				$removed[ ] = $user;
320 320
 			}
321 321
 		}
322 322
 
Please login to merge, or discard this patch.
includes/Task/StartVote.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Task;
4 4
 
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	protected function getSubtasksMap(): array {
17
+	protected function getSubtasksMap (): array {
18 18
 		// Everything is done here.
19
-		return [];
19
+		return [ ];
20 20
 	}
21 21
 
22 22
 	/**
23 23
 	 * @inheritDoc
24 24
 	 */
25
-	public function runInternal() : int {
25
+	public function runInternal () : int {
26 26
 		$pages = $this->getDataProvider()->getOpenPages();
27 27
 
28 28
 		if ( !$pages ) {
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	 * @param PageRiconferma[] $pages
37 37
 	 * @return int a STATUS_* constant
38 38
 	 */
39
-	protected function processPages( array $pages ) : int {
40
-		$donePages = [];
39
+	protected function processPages ( array $pages ) : int {
40
+		$donePages = [ ];
41 41
 		foreach ( $pages as $page ) {
42 42
 			if ( $page->hasOpposition() && !$page->isVote() ) {
43 43
 				$this->openVote( $page );
44
-				$donePages[] = $page;
44
+				$donePages[ ] = $page;
45 45
 			}
46 46
 		}
47 47
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @param PageRiconferma $page
61 61
 	 */
62
-	protected function openVote( PageRiconferma $page ) : void {
62
+	protected function openVote ( PageRiconferma $page ) : void {
63 63
 		$this->getLogger()->info( "Starting vote on $page" );
64 64
 
65 65
 		$content = $page->getContent();
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 * @see SimpleUpdates::updateVotazioni()
99 99
 	 * @see OpenUpdates::addToVotazioni()
100 100
 	 */
101
-	protected function updateVotazioni( array $pages ) : void {
101
+	protected function updateVotazioni ( array $pages ) : void {
102 102
 		$votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) );
103 103
 
104
-		$users = [];
104
+		$users = [ ];
105 105
 		foreach ( $pages as $page ) {
106
-			$users[] = $page->getUser();
106
+			$users[ ] = $page->getUser();
107 107
 		}
108 108
 		$usersReg = Element::regexFromArray( $users, '!' );
109 109
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @see SimpleUpdates::updateNews()
142 142
 	 * @see OpenUpdates::addToNews()
143 143
 	 */
144
-	protected function updateNews( int $amount ) : void {
144
+	protected function updateNews ( int $amount ) : void {
145 145
 		$this->getLogger()->info( "Turning $amount pages into votes" );
146 146
 		$newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) );
147 147
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 			throw new TaskException( 'Param "voto" not found in news page' );
157 157
 		}
158 158
 
159
-		$newTac = ( (int)$newsPage->getMatch( $regTac )[2] - $amount ) ?: '';
160
-		$newVot = ( (int)$newsPage->getMatch( $regVot )[2] + $amount ) ?: '';
159
+		$newTac = ( (int)$newsPage->getMatch( $regTac )[ 2 ] - $amount ) ?: '';
160
+		$newVot = ( (int)$newsPage->getMatch( $regVot )[ 2 ] + $amount ) ?: '';
161 161
 
162 162
 		$newContent = preg_replace( $regTac, '${1}' . $newTac, $content );
163 163
 		$newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent );
Please login to merge, or discard this patch.
includes/Wiki/Page/PageRiconferma.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Wiki\Page;
4 4
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	private $supportSection;
14 14
 	private $opposeSection;
15 15
 	/** @var array Counts of votes for each section */
16
-	private $sectionCounts = [];
16
+	private $sectionCounts = [ ];
17 17
 
18 18
 	// Possible outcomes of a vote
19 19
 	public const OUTCOME_OK = 0;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * because they can vary depending on whether the page is a vote, which is relatively
33 33
 	 * expensive to know since it requires parsing the content of the page.
34 34
 	 */
35
-	private function defineSections() : void {
35
+	private function defineSections () : void {
36 36
 		$this->supportSection = $this->isVote() ? 3 : 0;
37 37
 		$this->opposeSection = $this->isVote() ? 4 : 3;
38 38
 	}
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return User
44 44
 	 */
45
-	public function getUser() : User {
46
-		$name = explode( '/', $this->title )[2];
45
+	public function getUser () : User {
46
+		$name = explode( '/', $this->title )[ 2 ];
47 47
 		return new User( $name, $this->wiki );
48 48
 	}
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return int
54 54
 	 */
55
-	public function getNum() : int {
55
+	public function getNum () : int {
56 56
 		$bits = explode( '/', $this->getTitle() );
57 57
 		return (int)end( $bits );
58 58
 	}
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string
64 64
 	 */
65
-	public function getUserNum() : string {
66
-		return explode( '/', $this->getTitle(), 3 )[2];
65
+	public function getUserNum () : string {
66
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
67 67
 	}
68 68
 
69 69
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return int
73 73
 	 */
74
-	public function getOpposingCount() : int {
74
+	public function getOpposingCount () : int {
75 75
 		$this->defineSections();
76 76
 		return $this->getCountForSection( $this->opposeSection );
77 77
 	}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return int
83 83
 	 * @throws \BadMethodCallException
84 84
 	 */
85
-	public function getSupportCount() : int {
85
+	public function getSupportCount () : int {
86 86
 		if ( !$this->isVote() ) {
87 87
 			throw new \BadMethodCallException( 'Cannot get support for a non-vote page.' );
88 88
 		}
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	 * @param int $secNum
97 97
 	 * @return int
98 98
 	 */
99
-	protected function getCountForSection( int $secNum ) : int {
99
+	protected function getCountForSection ( int $secNum ) : int {
100 100
 		if ( !isset( $this->sectionCounts[ $secNum ] ) ) {
101 101
 			$content = $this->wiki->getPageContent( $this->title, $secNum );
102 102
 			// Let's hope that this is good enough...
103
-			$this->sectionCounts[$secNum] = preg_match_all( "/^# *(?![# *:]|\.\.\.$)/m", $content );
103
+			$this->sectionCounts[ $secNum ] = preg_match_all( "/^# *(?![# *:]|\.\.\.$)/m", $content );
104 104
 		}
105
-		return $this->sectionCounts[$secNum];
105
+		return $this->sectionCounts[ $secNum ];
106 106
 	}
107 107
 
108 108
 	/**
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return int
112 112
 	 */
113
-	protected function getQuorum() : int {
113
+	protected function getQuorum () : int {
114 114
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
115
-		return (int)$this->getMatch( $reg )[1];
115
+		return (int)$this->getMatch( $reg )[ 1 ];
116 116
 	}
117 117
 
118 118
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @return bool
122 122
 	 */
123
-	public function hasOpposition() : bool {
123
+	public function hasOpposition () : bool {
124 124
 		return $this->getOpposingCount() >= self::REQUIRED_OPPOSE;
125 125
 	}
126 126
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return int One of the OUTCOME_* constants
131 131
 	 */
132
-	public function getOutcome() : int {
132
+	public function getOutcome () : int {
133 133
 		if ( !$this->isVote() ) {
134 134
 			return self::OUTCOME_OK;
135 135
 		}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @throws \BadMethodCallException
153 153
 	 * @throws \LogicException
154 154
 	 */
155
-	public function getOutcomeText() : string {
155
+	public function getOutcomeText () : string {
156 156
 		if ( !$this->isVote() ) {
157 157
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
158 158
 		}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return bool
188 188
 	 */
189
-	public function isVote() : bool {
189
+	public function isVote () : bool {
190 190
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
191 191
 		return !$this->matches( $sectionReg );
192 192
 	}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return int
198 198
 	 */
199
-	public function getCreationTimestamp() : int {
199
+	public function getCreationTimestamp () : int {
200 200
 		return $this->wiki->getPageCreationTS( $this->title );
201 201
 	}
202 202
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return int
207 207
 	 */
208
-	public function getEndTimestamp() : int {
208
+	public function getEndTimestamp () : int {
209 209
 		if ( $this->isVote() ) {
210 210
 			$reg = "!La votazione ha inizio il.+ alle ore ([\d:]+) e ha termine il (.+) alla stessa ora!";
211 211
 			[ , $hours, $day ] = $this->getMatch( $reg );
Please login to merge, or discard this patch.
includes/TaskResult.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme;
4 4
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param int $status One of the Task::STATUS_* constants
22 22
 	 * @param string[] $errors
23 23
 	 */
24
-	public function __construct( int $status, array $errors = [] ) {
24
+	public function __construct ( int $status, array $errors = [ ] ) {
25 25
 		$this->status = $status;
26 26
 		$this->errors = $errors;
27 27
 	}
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * @return int
31 31
 	 */
32
-	public function getStatus() : int {
32
+	public function getStatus () : int {
33 33
 		return $this->status;
34 34
 	}
35 35
 
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 * @return string[]
38 38
 	 * @suppress PhanUnreferencedPublicMethod
39 39
 	 */
40
-	public function getErrors() : array {
40
+	public function getErrors () : array {
41 41
 		return $this->errors;
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * @param TaskResult $that
46 46
 	 */
47
-	public function merge( TaskResult $that ) : void {
47
+	public function merge ( TaskResult $that ) : void {
48 48
 		$this->status |= $that->status;
49 49
 		$this->errors = array_merge( $this->errors, $that->errors );
50 50
 	}
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @return string
54 54
 	 */
55
-	public function __toString() {
55
+	public function __toString () {
56 56
 		if ( $this->isOK() ) {
57 57
 			$stat = 'OK';
58 58
 			$errs = "\tNo errors.";
59 59
 		} else {
60 60
 			$stat = 'ERROR';
61
-			$formattedErrs = [];
61
+			$formattedErrs = [ ];
62 62
 			foreach ( $this->errors as $err ) {
63
-				$formattedErrs[] = "\t - $err";
63
+				$formattedErrs[ ] = "\t - $err";
64 64
 			}
65 65
 			$errs = implode( "\n", $formattedErrs );
66 66
 		}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return bool
74 74
 	 */
75
-	public function isOK() : bool {
75
+	public function isOK () : bool {
76 76
 		return ( $this->status | self::STATUS_GOOD ) === self::STATUS_GOOD;
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.
includes/TaskDataProvider.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme;
4 4
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/** @var User[]|null */
15 15
 	private $processUsers;
16 16
 	/** @var PageRiconferma[] */
17
-	private $createdPages = [];
17
+	private $createdPages = [ ];
18 18
 	/** @var PageRiconferma[]|null */
19 19
 	private $openPages;
20 20
 	/** @var PageRiconferma[]|null */
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @return User[]
27 27
 	 */
28
-	public function getUsersToProcess() : array {
28
+	public function getUsersToProcess () : array {
29 29
 		if ( $this->processUsers === null ) {
30
-			$this->processUsers = [];
30
+			$this->processUsers = [ ];
31 31
 			foreach ( PageBotList::get( $this->getWiki() )->getAdminsList() as $name => $user ) {
32 32
 				if ( $this->shouldAddUser( $user ) ) {
33 33
 					$this->processUsers[ $name ] = $user;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param User $user
45 45
 	 * @return bool
46 46
 	 */
47
-	private function shouldAddUser( User $user ) : bool {
47
+	private function shouldAddUser ( User $user ) : bool {
48 48
 		$timestamp = PageBotList::getOverrideTimestamp( $user->getUserInfo() );
49 49
 		$override = $timestamp !== null;
50 50
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return PageRiconferma[]
64 64
 	 */
65
-	public function getOpenPages() : array {
65
+	public function getOpenPages () : array {
66 66
 		if ( $this->openPages === null ) {
67
-			$this->openPages = [];
67
+			$this->openPages = [ ];
68 68
 			$mainTitle = $this->getOpt( 'main-page-title' );
69 69
 			$params = [
70 70
 				'action' => 'query',
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			$pages = RequestBase::newFromParams( $params )->execute()->query->pages;
79 79
 			foreach ( reset( $pages )->templates as $page ) {
80 80
 				if ( preg_match( "!$titleReg/[^/]+/\d!", $page->title ) ) {
81
-					$this->openPages[] = new PageRiconferma( $page->title, $this->getWiki() );
81
+					$this->openPages[ ] = new PageRiconferma( $page->title, $this->getWiki() );
82 82
 				}
83 83
 			}
84 84
 		}
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return PageRiconferma[]
93 93
 	 */
94
-	public function getPagesToClose() : array {
94
+	public function getPagesToClose () : array {
95 95
 		if ( $this->pagesToClose === null ) {
96
-			$this->pagesToClose = [];
96
+			$this->pagesToClose = [ ];
97 97
 			foreach ( $this->getOpenPages() as $page ) {
98 98
 				if ( time() > $page->getEndTimestamp() ) {
99
-					$this->pagesToClose[] = $page;
99
+					$this->pagesToClose[ ] = $page;
100 100
 				}
101 101
 			}
102 102
 		}
@@ -108,21 +108,21 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param string $name
110 110
 	 */
111
-	public function removeUser( string $name ) : void {
111
+	public function removeUser ( string $name ) : void {
112 112
 		unset( $this->processUsers[ $name ] );
113 113
 	}
114 114
 
115 115
 	/**
116 116
 	 * @return PageRiconferma[]
117 117
 	 */
118
-	public function getCreatedPages() : array {
118
+	public function getCreatedPages () : array {
119 119
 		return $this->createdPages;
120 120
 	}
121 121
 
122 122
 	/**
123 123
 	 * @param PageRiconferma $page
124 124
 	 */
125
-	public function addCreatedPage( PageRiconferma $page ) : void {
126
-		$this->createdPages[] = $page;
125
+	public function addCreatedPage ( PageRiconferma $page ) : void {
126
+		$this->createdPages[ ] = $page;
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
includes/Logger/SimpleLogger.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Logger;
4 4
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @param string $minlevel
19 19
 	 */
20
-	public function __construct( $minlevel = LogLevel::INFO ) {
20
+	public function __construct ( $minlevel = LogLevel::INFO ) {
21 21
 		$this->minLevel = $this->levelToInt( $minlevel );
22 22
 	}
23 23
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @inheritDoc
26 26
 	 * @suppress PhanUnusedPublicMethodParameter
27 27
 	 */
28
-	public function log( $level, $message, array $context = [] ) : void {
28
+	public function log ( $level, $message, array $context = [ ] ) : void {
29 29
 		if ( $this->levelToInt( $level ) >= $this->minLevel ) {
30 30
 			echo $this->getFormattedMessage( $level, $message ) . "\n";
31 31
 		}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	/**
35 35
 	 * @inheritDoc
36 36
 	 */
37
-	public function flush() : void {
37
+	public function flush () : void {
38 38
 		// Everything else is printed immediately
39 39
 		echo "\n" . str_repeat( '-', 80 ) . "\n\n";
40 40
 	}
Please login to merge, or discard this patch.
includes/Logger/MultiLogger.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Logger;
4 4
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @param IFlushingAwareLogger ...$loggers
16 16
 	 */
17
-	public function __construct( IFlushingAwareLogger ...$loggers ) {
17
+	public function __construct ( IFlushingAwareLogger ...$loggers ) {
18 18
 		$this->loggers = $loggers;
19 19
 	}
20 20
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @inheritDoc
23 23
 	 * @suppress PhanUnusedPublicMethodParameter
24 24
 	 */
25
-	public function log( $level, $message, array $context = [] ) :void {
25
+	public function log ( $level, $message, array $context = [ ] ) :void {
26 26
 		foreach ( $this->loggers as $logger ) {
27 27
 			$logger->log( $level, $message );
28 28
 		}
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * @inheritDoc
33 33
 	 */
34
-	public function flush() : void {
34
+	public function flush () : void {
35 35
 		foreach ( $this->loggers as $logger ) {
36 36
 			$logger->flush();
37 37
 		}
Please login to merge, or discard this patch.