Passed
Push — master ( 6697c9...98e5c5 )
by Daimona
01:34
created
includes/Task/UserNotice.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\Task;
4 4
 
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 	/**
12 12
 	 * @inheritDoc
13 13
 	 */
14
-	public function run() : TaskResult {
14
+	public function run () : TaskResult {
15 15
 		$this->getLogger()->info( 'Starting task UserNotice' );
16 16
 
17 17
 		$pages = $this->getDataProvider()->getCreatedPages();
18 18
 		$users = $this->getDataProvider()->getUsersToProcess();
19 19
 		if ( $pages && $users ) {
20
-			$ricNums = [];
20
+			$ricNums = [ ];
21 21
 			foreach ( $pages as $page ) {
22 22
 				$ricNums[ $page->getUser() ] = $page->getNum();
23 23
 			}
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param string $user
40 40
 	 * @param int $ricNum
41 41
 	 */
42
-	protected function addMsg( string $user, int $ricNum ) {
42
+	protected function addMsg ( string $user, int $ricNum ) {
43 43
 		$this->getLogger()->info( "Leaving msg to $user" );
44 44
 		$msg = str_replace( '$num', "$ricNum", $this->getConfig()->get( 'user-notice-msg' ) );
45 45
 
Please login to merge, or discard this patch.
includes/Task/UpdatesAround.php 1 patch
Spacing   +12 added lines, -12 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,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function run() : TaskResult {
17
+	public function run () : TaskResult {
18 18
 		$this->getLogger()->info( 'Starting task UpdatesAround' );
19 19
 
20 20
 		$pages = $this->getDataProvider()->getCreatedPages();
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param PageRiconferma[] $pages
40 40
 	 */
41
-	protected function addToMainPage( array $pages ) {
41
+	protected function addToMainPage ( array $pages ) {
42 42
 		$this->getLogger()->info(
43 43
 			'Adding the following to main: ' . implode( ', ', array_map( 'strval', $pages ) )
44 44
 		);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$summary = preg_replace_callback(
56 56
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
57 57
 			function ( $matches ) {
58
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
58
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
59 59
 			},
60 60
 			$summary
61 61
 		);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param PageRiconferma[] $pages
76 76
 	 */
77
-	protected function addVote( array $pages ) {
77
+	protected function addVote ( array $pages ) {
78 78
 		$this->getLogger()->info(
79 79
 			'Adding the following to votes: ' . implode( ', ', array_map( 'strval', $pages ) )
80 80
 		);
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 			$newContent = preg_replace( $introReg, '$0' . "\n$newLines", $content, 1 );
95 95
 		} else {
96 96
 			// Start section
97
-			$matches = [];
97
+			$matches = [ ];
98 98
 			if ( preg_match( $introReg, $content, $matches ) === false ) {
99 99
 				throw new TaskException( 'Intro not found in vote page' );
100 100
 			}
101 101
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
102 102
 			// Replace semicolon with full stop
103 103
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
104
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $content, 1 );
104
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $content, 1 );
105 105
 		}
106 106
 
107 107
 		$summary = strtr(
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		$summary = preg_replace_callback(
112 112
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
113 113
 			function ( $matches ) {
114
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
114
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
115 115
 			},
116 116
 			$summary
117 117
 		);
@@ -130,26 +130,26 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @param int $amount
132 132
 	 */
133
-	protected function addNews( int $amount ) {
133
+	protected function addNews ( int $amount ) {
134 134
 		$this->getLogger()->info( "Increasing the news counter by $amount" );
135 135
 		$newsPage = $this->getConfig()->get( 'ric-news-page' );
136 136
 
137 137
 		$content = $this->getController()->getPageContent( $newsPage );
138 138
 		$reg = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!';
139 139
 
140
-		$matches = [];
140
+		$matches = [ ];
141 141
 		if ( preg_match( $reg, $content, $matches ) === false ) {
142 142
 			throw new TaskException( 'Param not found in news page' );
143 143
 		}
144 144
 
145
-		$newNum = (int)$matches[2] + $amount;
145
+		$newNum = (int)$matches[ 2 ] + $amount;
146 146
 		$newContent = preg_replace( $reg, '${1}' . $newNum, $content );
147 147
 
148 148
 		$summary = strtr( $this->getConfig()->get( 'ric-news-page-summary' ), [ '$num' => $amount ] );
149 149
 		$summary = preg_replace_callback(
150 150
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
151 151
 			function ( $matches ) {
152
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
152
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
153 153
 			},
154 154
 			$summary
155 155
 		);
Please login to merge, or discard this patch.
includes/TaskDataProvider.php 1 patch
Spacing   +14 added lines, -16 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
 
@@ -12,20 +12,20 @@  discard block
 block discarded – undo
12 12
 	private $users;
13 13
 
14 14
 	/** @var PageRiconferma[] */
15
-	private $createdPages = [];
15
+	private $createdPages = [ ];
16 16
 
17 17
 	/**
18 18
 	 * Get a list of users to execute tasks on.
19 19
 	 *
20 20
 	 * @return array[]
21 21
 	 */
22
-	public function getUsersToProcess() : array {
22
+	public function getUsersToProcess () : array {
23 23
 		if ( $this->users === null ) {
24 24
 			$this->getLogger()->debug( 'Retrieving users list' );
25 25
 			$content = $this->getController()->getPageContent( $this->getConfig()->get( 'list-title' ) );
26 26
 			$listUsers = json_decode( $content, true );
27 27
 
28
-			$this->users = [];
28
+			$this->users = [ ];
29 29
 			foreach ( $listUsers as $user => $groups ) {
30 30
 				$timestamp = $this->getValidTimestamp( $groups );
31 31
 
@@ -47,13 +47,11 @@  discard block
 block discarded – undo
47 47
 	 * @param array $groups
48 48
 	 * @return int
49 49
 	 */
50
-	private function getValidTimestamp( array $groups ) : int {
50
+	private function getValidTimestamp ( array $groups ) : int {
51 51
 		$checkuser = isset( $groups[ 'checkuser' ] ) ?
52
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() :
53
-			0;
52
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'checkuser' ] )->getTimestamp() : 0;
54 53
 		$bureaucrat = isset( $groups[ 'bureaucrat' ] ) ?
55
-			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() :
56
-			0;
54
+			\DateTime::createFromFormat( 'd/m/Y', $groups[ 'bureaucrat' ] )->getTimestamp() : 0;
57 55
 
58 56
 		$timestamp = max( $bureaucrat, $checkuser );
59 57
 		if ( $timestamp === 0 ) {
@@ -67,7 +65,7 @@  discard block
 block discarded – undo
67 65
 	 *
68 66
 	 * @return PageRiconferma[]
69 67
 	 */
70
-	public function getOpenPages() : array {
68
+	public function getOpenPages () : array {
71 69
 		$baseTitle = $this->getConfig()->get( 'ric-main-page' );
72 70
 		$params = [
73 71
 			'action' => 'query',
@@ -79,10 +77,10 @@  discard block
 block discarded – undo
79 77
 
80 78
 		$res = RequestBase::newFromParams( $params )->execute();
81 79
 		$pages = $res->query->pages;
82
-		$ret = [];
80
+		$ret = [ ];
83 81
 		foreach ( reset( $pages )->templates as $page ) {
84 82
 			if ( preg_match( "!$baseTitle\/[^\/]+\/\d!", $page->title ) !== false ) {
85
-				$ret[] = new PageRiconferma( $page->title, $this->getController() );
83
+				$ret[ ] = new PageRiconferma( $page->title, $this->getController() );
86 84
 			}
87 85
 		}
88 86
 		return $ret;
@@ -93,21 +91,21 @@  discard block
 block discarded – undo
93 91
 	 *
94 92
 	 * @param string $name
95 93
 	 */
96
-	public function removeUser( string $name ) {
94
+	public function removeUser ( string $name ) {
97 95
 		unset( $this->users[ $name ] );
98 96
 	}
99 97
 
100 98
 	/**
101 99
 	 * @return PageRiconferma[]
102 100
 	 */
103
-	public function getCreatedPages() : array {
101
+	public function getCreatedPages () : array {
104 102
 		return $this->createdPages;
105 103
 	}
106 104
 
107 105
 	/**
108 106
 	 * @param PageRiconferma $page
109 107
 	 */
110
-	public function addCreatedPages( PageRiconferma $page ) {
111
-		$this->createdPages[] = $page;
108
+	public function addCreatedPages ( PageRiconferma $page ) {
109
+		$this->createdPages[ ] = $page;
112 110
 	}
113 111
 }
Please login to merge, or discard this patch.
includes/Task/StartVote.php 1 patch
Spacing   +17 added lines, -17 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,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function run() : TaskResult {
17
+	public function run () : TaskResult {
18 18
 		$this->getLogger()->info( 'Starting task StartVote' );
19 19
 
20 20
 		$pages = $this->getDataProvider()->getOpenPages();
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @param PageRiconferma[] $pages
34 34
 	 */
35
-	protected function processPages( array $pages ) {
36
-		$actualPages = [];
35
+	protected function processPages ( array $pages ) {
36
+		$actualPages = [ ];
37 37
 		foreach ( $pages as $page ) {
38 38
 			if ( $page->hasOpposition() && !$page->isVote() ) {
39 39
 				$this->openVote( $page );
40
-				$actualPages[] = $page;
40
+				$actualPages[ ] = $page;
41 41
 			}
42 42
 		}
43 43
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @param PageRiconferma $page
56 56
 	 */
57
-	protected function openVote( PageRiconferma $page ) {
57
+	protected function openVote ( PageRiconferma $page ) {
58 58
 		$this->getLogger()->info( "Starting vote on $page" );
59 59
 
60 60
 		$content = $page->getContent();
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 * @see ClosePages::updateVote()
94 94
 	 * @see UpdatesAround::addVote()
95 95
 	 */
96
-	protected function updateVotePage( array $pages ) {
96
+	protected function updateVotePage ( array $pages ) {
97 97
 		$votePage = $this->getConfig()->get( 'ric-vote-page' );
98 98
 		$content = $this->getController()->getPageContent( $votePage );
99 99
 
100
-		$titles = [];
100
+		$titles = [ ];
101 101
 		foreach ( $pages as $page ) {
102
-			$titles[] = preg_quote( $page->getTitle() );
102
+			$titles[ ] = preg_quote( $page->getTitle() );
103 103
 		}
104 104
 		$titleReg = implode( '|', array_map( 'preg_quote', $titles ) );
105 105
 		$search = "!^\*.+ La \[\[($titleReg)\|procedura]] termina.+\n!gm";
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 			$newContent = preg_replace( $introReg, '$0' . "\n$newLines", $newContent, 1 );
123 123
 		} else {
124 124
 			// Start section
125
-			$matches = [];
125
+			$matches = [ ];
126 126
 			if ( preg_match( $introReg, $content, $matches ) === false ) {
127 127
 				throw new TaskException( 'Intro not found in vote page' );
128 128
 			}
129 129
 			$beforeReg = '!INSERIRE LA NOTIZIA PIÙ NUOVA IN CIMA.+!m';
130 130
 			// Replace semicolon with full stop
131 131
 			$newLines = substr( $newLines, 0, -2 ) . ".\n";
132
-			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[0]}\n$newLines", $newContent, 1 );
132
+			$newContent = preg_replace( $beforeReg, '$0' . "\n{$matches[ 0 ]}\n$newLines", $newContent, 1 );
133 133
 		}
134 134
 
135 135
 		$summary = strtr(
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$summary = preg_replace_callback(
140 140
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
141 141
 			function ( $matches ) {
142
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
142
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
143 143
 			},
144 144
 			$summary
145 145
 		);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @see UpdatesAround::addNews()
161 161
 	 * @see ClosePages::updateNews()
162 162
 	 */
163
-	protected function updateNews( int $amount ) {
163
+	protected function updateNews ( int $amount ) {
164 164
 		$this->getLogger()->info( "Turning $amount pages into votes" );
165 165
 		$newsPage = $this->getConfig()->get( 'ric-news-page' );
166 166
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$regTac = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!';
169 169
 		$regVot = '!(\| *riconferme[ _]voto[ _]amministratori *= *)(\d+)!';
170 170
 
171
-		$tacMatches = $votMatches = [];
171
+		$tacMatches = $votMatches = [ ];
172 172
 		if ( preg_match( $regTac, $content, $tacMatches ) === false ) {
173 173
 			throw new TaskException( 'Param "tacite" not found in news page' );
174 174
 		}
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 			throw new TaskException( 'Param "voto" not found in news page' );
177 177
 		}
178 178
 
179
-		$newTac = (int)$tacMatches[2] - $amount ?: '';
180
-		$newVot = (int)$votMatches[2] + $amount ?: '';
179
+		$newTac = (int)$tacMatches[ 2 ] - $amount ?: '';
180
+		$newVot = (int)$votMatches[ 2 ] + $amount ?: '';
181 181
 
182 182
 		$newContent = preg_replace( $regTac, '${1}' . $newTac, $content );
183 183
 		$newContent = preg_replace( $regVot, '${1}' . $newVot, $newContent );
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$summary = preg_replace_callback(
190 190
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
191 191
 			function ( $matches ) {
192
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
192
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
193 193
 			},
194 194
 			$summary
195 195
 		);
Please login to merge, or discard this patch.
includes/PageRiconferma.php 1 patch
Spacing   +28 added lines, -28 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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string $title
30 30
 	 * @param WikiController $controller
31 31
 	 */
32
-	public function __construct( string $title, WikiController $controller ) {
32
+	public function __construct ( string $title, WikiController $controller ) {
33 33
 		$this->title = $title;
34 34
 		$this->controller = $controller;
35 35
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @return string
39 39
 	 */
40
-	public function getTitle() : string {
40
+	public function getTitle () : string {
41 41
 		return $this->title;
42 42
 	}
43 43
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @return string
48 48
 	 */
49
-	public function getUser() : string {
50
-		return explode( '/', $this->title )[2];
49
+	public function getUser () : string {
50
+		return explode( '/', $this->title )[ 2 ];
51 51
 	}
52 52
 
53 53
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return int
57 57
 	 */
58
-	public function getNum() : int {
58
+	public function getNum () : int {
59 59
 		$bits = explode( '/', $this->getTitle() );
60 60
 		return intval( end( $bits ) );
61 61
 	}
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return string
67 67
 	 */
68
-	public function getUserNum() : string {
69
-		return explode( '/', $this->getTitle(), 3 )[2];
68
+	public function getUserNum () : string {
69
+		return explode( '/', $this->getTitle(), 3 )[ 2 ];
70 70
 	}
71 71
 
72 72
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return string
76 76
 	 */
77
-	public function getBaseTitle() : string {
77
+	public function getBaseTitle () : string {
78 78
 		// @phan-suppress-next-line PhanTypeMismatchArgumentInternal Phan bug
79 79
 		return substr( $this->getTitle(), 0, strrpos( $this->getTitle(), '/' ) );
80 80
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string
86 86
 	 */
87
-	public function getContent() : string {
87
+	public function getContent () : string {
88 88
 		if ( $this->content === null ) {
89 89
 			$this->content = $this->controller->getPageContent( $this->title );
90 90
 		}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return int
98 98
 	 */
99
-	public function getOpposingCount() : int {
99
+	public function getOpposingCount () : int {
100 100
 		return $this->getCountForSection( self::SECTION_OPPOSE );
101 101
 	}
102 102
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return int
107 107
 	 */
108
-	public function getSupportCount() : int {
108
+	public function getSupportCount () : int {
109 109
 		return $this->getCountForSection( self::SECTION_SUPPORT );
110 110
 	}
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @param int $secNum
116 116
 	 * @return int
117 117
 	 */
118
-	protected function getCountForSection( int $secNum ) : int {
118
+	protected function getCountForSection ( int $secNum ) : int {
119 119
 		$content = $this->controller->getPageContent( $this->title, $secNum );
120 120
 		// Let's hope that this is good enough...
121 121
 		return substr_count( $content, "\n\# *(?![#*])" );
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return int
128 128
 	 */
129
-	protected function getQuorum() : int {
129
+	protected function getQuorum () : int {
130 130
 		$reg = "!soddisfare il \[\[[^|\]]+\|quorum]] di '''(\d+) voti'''!";
131
-		$matches = [];
131
+		$matches = [ ];
132 132
 		preg_match( $reg, $this->getContent(), $matches );
133
-		return intval( $matches[1] );
133
+		return intval( $matches[ 1 ] );
134 134
 	}
135 135
 
136 136
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return bool
140 140
 	 */
141
-	public function hasOpposition() : bool {
141
+	public function hasOpposition () : bool {
142 142
 		return $this->getOpposingCount() >= 15;
143 143
 	}
144 144
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return int One of the OUTCOME_* constants
149 149
 	 * @throws \BadMethodCallException
150 150
 	 */
151
-	public function getOutcome() : int {
151
+	public function getOutcome () : int {
152 152
 		if ( !$this->isVote() ) {
153 153
 			throw new \BadMethodCallException( 'Cannot get outcome for a non-vote page.' );
154 154
 		}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @return string
168 168
 	 * @throws \BadMethodCallException
169 169
 	 */
170
-	public function getOutcomeText() : string {
170
+	public function getOutcomeText () : string {
171 171
 		if ( !$this->isVote() ) {
172 172
 			throw new \BadMethodCallException( 'No need for an outcome text.' );
173 173
 		}
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return bool
201 201
 	 */
202
-	public function isVote() : bool {
202
+	public function isVote () : bool {
203 203
 		$sectionReg = '/<!-- SEZIONE DA UTILIZZARE PER/';
204 204
 		return preg_match( $sectionReg, $this->getContent() ) === false;
205 205
 	}
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @return int
211 211
 	 */
212
-	public function getEndTimestamp() : int {
212
+	public function getEndTimestamp () : int {
213 213
 		if ( $this->isVote() ) {
214
-			$matches = [];
214
+			$matches = [ ];
215 215
 			$reg = "!La votazione ha inizio il.+ e ha termine.+ '''([^']+)''' alle ore '''([^']+)'''!";
216 216
 			preg_match( $reg, $this->getContent(), $matches );
217 217
 			list( , $day, $hours ) = $matches;
@@ -228,19 +228,19 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 * @param array $params
230 230
 	 */
231
-	public function edit( array $params ) {
231
+	public function edit ( array $params ) {
232 232
 		$params = [
233 233
 			'title' => $this->getTitle()
234 234
 		] + $params;
235 235
 
236 236
 		$this->controller->editPage( $params );
237
-		if ( isset( $params['text'] ) ) {
238
-			$this->content = $params['text'];
239
-		} elseif ( isset( $params['appendtext'] ) ) {
240
-			$this->content .= $params['appendtext'];
237
+		if ( isset( $params[ 'text' ] ) ) {
238
+			$this->content = $params[ 'text' ];
239
+		} elseif ( isset( $params[ 'appendtext' ] ) ) {
240
+			$this->content .= $params[ 'appendtext' ];
241 241
 		}
242 242
 	}
243
-	public function __toString() {
243
+	public function __toString () {
244 244
 		return $this->getTitle();
245 245
 	}
246 246
 }
Please login to merge, or discard this patch.
includes/WikiController.php 1 patch
Spacing   +19 added lines, -19 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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	/** @var string[] */
20 20
 	private $tokens;
21 21
 
22
-	public function __construct() {
22
+	public function __construct () {
23 23
 		$this->logger = new Logger;
24 24
 	}
25 25
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return string
32 32
 	 * @throws MissingPageException
33 33
 	 */
34
-	public function getPageContent( string $title, int $section = null ) : string {
34
+	public function getPageContent ( string $title, int $section = null ) : string {
35 35
 		$this->logger->debug( "Retrieving page $title" );
36 36
 		$params = [
37 37
 			'action' => 'query',
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		];
43 43
 
44 44
 		if ( $section !== null ) {
45
-			$params['rvsection'] = $section;
45
+			$params[ 'rvsection' ] = $section;
46 46
 		}
47 47
 
48 48
 		$req = RequestBase::newFromParams( $params );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			throw new MissingPageException( $title );
53 53
 		}
54 54
 
55
-		return $page->revisions[0]->slots->main->{ '*' };
55
+		return $page->revisions[ 0 ]->slots->main->{ '*' };
56 56
 	}
57 57
 
58 58
 	/**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @param array $params
62 62
 	 * @throws EditException
63 63
 	 */
64
-	public function editPage( array $params ) {
64
+	public function editPage ( array $params ) {
65 65
 		$this->login();
66 66
 
67 67
 		$params = [
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @return string
84 84
 	 * @fixme Not the right place for this
85 85
 	 */
86
-	public static function getTimeWithArticle( int $timestamp ) : string {
86
+	public static function getTimeWithArticle ( int $timestamp ) : string {
87 87
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
88 88
 		$timeString = strftime( '%e %B alle %R', $timestamp );
89 89
 		// Remove the left space if day has a single digit
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
 	 * @fixme Not the right place for this
103 103
 	 * @todo Is there a better way?
104 104
 	 */
105
-	public static function getTimestampFromLocalTime( string $timeString ) : int {
105
+	public static function getTimestampFromLocalTime ( string $timeString ) : int {
106 106
 		$oldLoc = setlocale( LC_TIME, 'it_IT', 'Italian_Italy', 'Italian' );
107 107
 		$bits = strptime( $timeString, '%e %m %Y alle %H:%M' );
108 108
 		$timestamp = mktime(
109
-			$bits['tm_hour'],
110
-			$bits['tm_min'],
109
+			$bits[ 'tm_hour' ],
110
+			$bits[ 'tm_min' ],
111 111
 			0,
112
-			$bits['tm_mon'] + 1,
113
-			$bits['tm_mday'],
114
-			$bits['tm_year'] + 1900
112
+			$bits[ 'tm_mon' ] + 1,
113
+			$bits[ 'tm_mday' ],
114
+			$bits[ 'tm_year' ] + 1900
115 115
 		);
116 116
 		setlocale( LC_TIME, $oldLoc );
117 117
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * Login wrapper. Checks if we're already logged in and clears tokens cache
122 122
 	 * @throws LoginException
123 123
 	 */
124
-	public function login() {
124
+	public function login () {
125 125
 		if ( self::$loggedIn ) {
126 126
 			$this->logger->debug( 'Already logged in' );
127 127
 			return;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 		self::$loggedIn = true;
150 150
 		// Clear tokens cache
151
-		$this->tokens = [];
151
+		$this->tokens = [ ];
152 152
 		$this->logger->info( 'Login succeeded' );
153 153
 	}
154 154
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @param string $type
159 159
 	 * @return string
160 160
 	 */
161
-	public function getToken( string $type ) : string {
161
+	public function getToken ( string $type ) : string {
162 162
 		if ( !isset( $this->tokens[ $type ] ) ) {
163 163
 			$params = [
164 164
 				'action' => 'query',
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param string $title
182 182
 	 * @return int
183 183
 	 */
184
-	public function getPageCreationTS( string $title ) : int {
184
+	public function getPageCreationTS ( string $title ) : int {
185 185
 		$params = [
186 186
 			'action' => 'query',
187 187
 			'prop' => 'revisions',
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 		$res = ( RequestBase::newFromParams( $params ) )->execute();
196 196
 		$data = $res->query->pages;
197
-		return strtotime( reset( $data )->revisions[0]->timestamp );
197
+		return strtotime( reset( $data )->revisions[ 0 ]->timestamp );
198 198
 	}
199 199
 
200 200
 	/**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @param string $title
204 204
 	 * @param string $reason
205 205
 	 */
206
-	public function protectPage( string $title, string $reason ) {
206
+	public function protectPage ( string $title, string $reason ) {
207 207
 		$this->logger->info( "Protecting page $title" );
208 208
 		$this->login();
209 209
 
Please login to merge, or discard this patch.
includes/Task/ClosePages.php 1 patch
Spacing   +55 added lines, -56 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,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function run() : TaskResult {
17
+	public function run () : TaskResult {
18 18
 		$this->getLogger()->info( 'Starting task ClosePages' );
19 19
 
20 20
 		$pages = $this->getPagesList();
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return PageRiconferma[]
53 53
 	 */
54
-	protected function getPagesList() : array {
54
+	protected function getPagesList () : array {
55 55
 		$allPages = $this->getDataProvider()->getOpenPages();
56
-		$ret = [];
56
+		$ret = [ ];
57 57
 		foreach ( $allPages as $page ) {
58 58
 			if ( time() > $page->getEndTimestamp() ) {
59
-				$ret[] = $page;
59
+				$ret[ ] = $page;
60 60
 			}
61 61
 		}
62 62
 		return $ret;
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 	 * @param PageRiconferma[] $pages
69 69
 	 * @return PageRiconferma[]
70 70
 	 */
71
-	private function getFailures( array $pages ) : array {
72
-		$ret = [];
71
+	private function getFailures ( array $pages ) : array {
72
+		$ret = [ ];
73 73
 		foreach ( $pages as $page ) {
74 74
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
75
-				$ret[] = $page;
75
+				$ret[ ] = $page;
76 76
 			}
77 77
 		}
78 78
 		return $ret;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	/**
82 82
 	 * @param PageRiconferma $page
83 83
 	 */
84
-	protected function addVoteCloseText( PageRiconferma $page ) {
84
+	protected function addVoteCloseText ( PageRiconferma $page ) {
85 85
 		$content = $page->getContent();
86 86
 		$beforeReg = '!è necessario ottenere una maggioranza .+ votanti\.!';
87 87
 		$newContent = preg_replace( $beforeReg, '$0' . "\n" . $page->getOutcomeText(), $content );
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 	 * @param PageRiconferma[] $pages
100 100
 	 * @see UpdatesAround::addToMainPage()
101 101
 	 */
102
-	protected function removeFromMainPage( array $pages ) {
102
+	protected function removeFromMainPage ( array $pages ) {
103 103
 		$this->getLogger()->info(
104 104
 			'Removing from main: ' . implode( ', ', array_map( 'strval', $pages ) )
105 105
 		);
106 106
 
107 107
 		$mainPage = $this->getConfig()->get( 'ric-main-page' );
108 108
 		$content = $this->getController()->getPageContent( $mainPage );
109
-		$translations = [];
109
+		$translations = [ ];
110 110
 		foreach ( $pages as $page ) {
111 111
 			$translations[ '{{' . $page->getTitle() . '}}' ] = '';
112 112
 		}
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param PageRiconferma[] $pages
126 126
 	 */
127
-	protected function addToArchive( array $pages ) {
127
+	protected function addToArchive ( array $pages ) {
128 128
 		$this->getLogger()->info(
129 129
 			'Adding to archive: ' . implode( ', ', array_map( 'strval', $pages ) )
130 130
 		);
131 131
 
132
-		$simple = $votes = [];
132
+		$simple = $votes = [ ];
133 133
 		foreach ( $pages as $page ) {
134 134
 			if ( $page->isVote() ) {
135
-				$votes[] = $page;
135
+				$votes[ ] = $page;
136 136
 			} else {
137
-				$simple[] = $page;
137
+				$simple[ ] = $page;
138 138
 			}
139 139
 		}
140 140
 
@@ -151,21 +151,21 @@  discard block
 block discarded – undo
151 151
 	 * @param string $archiveTitle
152 152
 	 * @param array $pages
153 153
 	 */
154
-	private function reallyAddToArchive( string $archiveTitle, array $pages ) {
154
+	private function reallyAddToArchive ( string $archiveTitle, array $pages ) {
155 155
 		$curTitle = "$archiveTitle/" . date( 'Y' );
156 156
 
157 157
 		$append = '';
158
-		$archivedList = [];
158
+		$archivedList = [ ];
159 159
 		foreach ( $pages as $page ) {
160 160
 			$append .= '{{' . $page->getTitle() . "}}\n";
161
-			$archivedList[] = $page->getUserNum();
161
+			$archivedList[ ] = $page->getUserNum();
162 162
 		}
163 163
 
164 164
 		if ( count( $archivedList ) > 1 ) {
165 165
 			$last = array_pop( $archivedList );
166 166
 			$userNums = implode( ', ', $archivedList ) . " e $last";
167 167
 		} else {
168
-			$userNums = $archivedList[0];
168
+			$userNums = $archivedList[ 0 ];
169 169
 		}
170 170
 
171 171
 		$summary = strtr(
@@ -186,14 +186,13 @@  discard block
 block discarded – undo
186 186
 	 * @param PageRiconferma $page
187 187
 	 * @see CreatePages::updateBasePage()
188 188
 	 */
189
-	protected function updateBasePage( PageRiconferma $page ) {
189
+	protected function updateBasePage ( PageRiconferma $page ) {
190 190
 		$this->getLogger()->info( "Updating base page for $page" );
191 191
 
192 192
 		$current = $this->getController()->getPageContent( $page->getBaseTitle() );
193 193
 
194 194
 		$outcomeText = $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ?
195
-			'non riconfermato' :
196
-			'riconfermato';
195
+			'non riconfermato' : 'riconfermato';
197 196
 		$text = $page->isVote() ? "votazione: $outcomeText" : 'riconferma tacita';
198 197
 
199 198
 		$newContent = str_replace( 'riconferma in corso', $text, $current );
@@ -210,13 +209,13 @@  discard block
 block discarded – undo
210 209
 	 * @param PageRiconferma[] $pages
211 210
 	 * @see UpdatesAround::addVote()
212 211
 	 */
213
-	protected function updateVote( array $pages ) {
212
+	protected function updateVote ( array $pages ) {
214 213
 		$votePage = $this->getConfig()->get( 'ric-vote-page' );
215 214
 		$content = $this->getController()->getPageContent( $votePage );
216 215
 
217
-		$titles = [];
216
+		$titles = [ ];
218 217
 		foreach ( $pages as $page ) {
219
-			$titles[] = preg_quote( $page->getTitle() );
218
+			$titles[ ] = preg_quote( $page->getTitle() );
220 219
 		}
221 220
 
222 221
 		$titleReg = implode( '|', array_map( 'preg_quote', $titles ) );
@@ -239,7 +238,7 @@  discard block
 block discarded – undo
239 238
 		$summary = preg_replace_callback(
240 239
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
241 240
 			function ( $matches ) {
242
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
241
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
243 242
 			},
244 243
 			$summary
245 244
 		);
@@ -257,7 +256,7 @@  discard block
 block discarded – undo
257 256
 	 * @param array $pages
258 257
 	 * @see UpdatesAround::addNews()
259 258
 	 */
260
-	protected function updateNews( array $pages ) {
259
+	protected function updateNews ( array $pages ) {
261 260
 		$simpleAmount = $voteAmount = 0;
262 261
 		foreach ( $pages as $page ) {
263 262
 			if ( $page->isVote() ) {
@@ -277,12 +276,12 @@  discard block
 block discarded – undo
277 276
 		$simpleReg = '!(\| *riconferme[ _]tacite[ _]amministratori *= *)(\d+)!';
278 277
 		$voteReg = '!(\| *riconferme[ _]voto[ _]amministratori *= *)(\d+)!';
279 278
 
280
-		$simpleMatches = $voteMatches = [];
279
+		$simpleMatches = $voteMatches = [ ];
281 280
 		preg_match( $simpleReg, $content, $simpleMatches );
282 281
 		preg_match( $voteReg, $content, $voteMatches );
283 282
 
284
-		$newSimp = (int)$simpleMatches[2] - $simpleAmount ?: '';
285
-		$newVote = (int)$voteMatches[2] - $voteAmount ?: '';
283
+		$newSimp = (int)$simpleMatches[ 2 ] - $simpleAmount ?: '';
284
+		$newVote = (int)$voteMatches[ 2 ] - $voteAmount ?: '';
286 285
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $content );
287 286
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
288 287
 
@@ -293,7 +292,7 @@  discard block
 block discarded – undo
293 292
 		$summary = preg_replace_callback(
294 293
 			'!\{\{$plur|(\d+)|([^|]+)|([^|]+)}}!',
295 294
 			function ( $matches ) {
296
-				return intval( $matches[1] ) > 1 ? trim( $matches[3] ) : trim( $matches[2] );
295
+				return intval( $matches[ 1 ] ) > 1 ? trim( $matches[ 3 ] ) : trim( $matches[ 2 ] );
297 296
 			},
298 297
 			$summary
299 298
 		);
@@ -312,22 +311,22 @@  discard block
 block discarded – undo
312 311
 	 *
313 312
 	 * @param PageRiconferma[] $pages
314 313
 	 */
315
-	protected function updateAdminList( array $pages ) {
314
+	protected function updateAdminList ( array $pages ) {
316 315
 		$listTitle = $this->getConfig()->get( 'admins-list' );
317 316
 		$newContent = $this->getController()->getPageContent( $listTitle );
318 317
 		$newDate = date( 'Ymd', strtotime( '+1 year' ) );
319 318
 
320
-		$riconfNames = $removeNames = [];
319
+		$riconfNames = $removeNames = [ ];
321 320
 		foreach ( $pages as $page ) {
322 321
 			$user = $page->getUser();
323 322
 			$reg = "!(\{\{Amministratore\/riga\|$user.+\| *)\d+( *\|(?: *pausa)? *\}\}\n)!";
324 323
 			if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
325 324
 				// Remove the line
326 325
 				$newContent = preg_replace( $reg, '', $newContent );
327
-				$removeNames[] = $user;
326
+				$removeNames[ ] = $user;
328 327
 			} else {
329 328
 				$newContent = preg_replace( $reg, '$1' . $newDate . '$2', $newContent );
330
-				$riconfNames[] = $user;
329
+				$riconfNames[ ] = $user;
331 330
 			}
332 331
 		}
333 332
 
@@ -335,7 +334,7 @@  discard block
 block discarded – undo
335 334
 			$lastUser = array_pop( $riconfNames );
336 335
 			$riconfList = implode( ', ', $riconfNames ) . " e $lastUser";
337 336
 		} elseif ( $riconfNames ) {
338
-			$riconfList = $riconfNames[0];
337
+			$riconfList = $riconfNames[ 0 ];
339 338
 		} else {
340 339
 			$riconfList = 'nessuno';
341 340
 		}
@@ -344,7 +343,7 @@  discard block
 block discarded – undo
344 343
 			$lastUser = array_pop( $removeNames );
345 344
 			$removeList = implode( ', ', $removeNames ) . " e $lastUser";
346 345
 		} elseif ( $removeNames ) {
347
-			$removeList = $removeNames[0];
346
+			$removeList = $removeNames[ 0 ];
348 347
 		} else {
349 348
 			$removeList = 'nessuno';
350 349
 		}
@@ -369,13 +368,13 @@  discard block
 block discarded – undo
369 368
 	/**
370 369
 	 * @param PageRiconferma[] $pages
371 370
 	 */
372
-	protected function updateCUList( array $pages ) {
371
+	protected function updateCUList ( array $pages ) {
373 372
 		$cuListTitle = $this->getConfig()->get( 'cu-list-title' );
374 373
 		$listTitle = $this->getConfig()->get( 'list-title' );
375 374
 		$admins = json_decode( $this->getController()->getPageContent( $listTitle ), true );
376 375
 		$newContent = $this->getController()->getPageContent( $cuListTitle );
377 376
 
378
-		$riconfNames = $removeNames = [];
377
+		$riconfNames = $removeNames = [ ];
379 378
 		foreach ( $pages as $page ) {
380 379
 			$user = $page->getUser();
381 380
 			if ( array_key_exists( 'checkuser', $admins[ $user ] ) ) {
@@ -383,10 +382,10 @@  discard block
 block discarded – undo
383 382
 				if ( $page->getOutcome() & PageRiconferma::OUTCOME_FAIL ) {
384 383
 					// Remove the line
385 384
 					$newContent = preg_replace( $reg, '', $newContent );
386
-					$removeNames[] = $user;
385
+					$removeNames[ ] = $user;
387 386
 				} else {
388 387
 					$newContent = preg_replace( $reg, '$1{{subst:#time:j F Y}}$2', $newContent );
389
-					$riconfNames[] = $user;
388
+					$riconfNames[ ] = $user;
390 389
 				}
391 390
 			}
392 391
 		}
@@ -399,7 +398,7 @@  discard block
 block discarded – undo
399 398
 			$lastUser = array_pop( $riconfNames );
400 399
 			$riconfList = implode( ', ', $riconfNames ) . " e $lastUser";
401 400
 		} elseif ( $riconfNames ) {
402
-			$riconfList = $riconfNames[0];
401
+			$riconfList = $riconfNames[ 0 ];
403 402
 		} else {
404 403
 			$riconfList = 'nessuno';
405 404
 		}
@@ -408,7 +407,7 @@  discard block
 block discarded – undo
408 407
 			$lastUser = array_pop( $removeNames );
409 408
 			$removeList = implode( ', ', $removeNames ) . " e $lastUser";
410 409
 		} elseif ( $removeNames ) {
411
-			$removeList = $removeNames[0];
410
+			$removeList = $removeNames[ 0 ];
412 411
 		} else {
413 412
 			$removeList = 'nessuno';
414 413
 		}
@@ -432,17 +431,17 @@  discard block
 block discarded – undo
432 431
 	/**
433 432
 	 * @param PageRiconferma[] $pages
434 433
 	 */
435
-	protected function updateBurList( array $pages ) {
434
+	protected function updateBurList ( array $pages ) {
436 435
 		$listTitle = $this->getConfig()->get( 'list-title' );
437 436
 		$admins = json_decode( $this->getController()->getPageContent( $listTitle ), true );
438 437
 
439
-		$remove = [];
438
+		$remove = [ ];
440 439
 		foreach ( $pages as $page ) {
441 440
 			$user = $page->getUser();
442 441
 			if ( array_key_exists( 'bureaucrat', $admins[ $user ] ) &&
443 442
 				$page->getOutcome() & PageRiconferma::OUTCOME_FAIL
444 443
 			) {
445
-				$remove[] = $user;
444
+				$remove[ ] = $user;
446 445
 			}
447 446
 		}
448 447
 
@@ -460,7 +459,7 @@  discard block
 block discarded – undo
460 459
 			$lastUser = array_pop( $remove );
461 460
 			$removeList = implode( ', ', $remove ) . " e $lastUser";
462 461
 		} else {
463
-			$removeList = $remove[0];
462
+			$removeList = $remove[ 0 ];
464 463
 		}
465 464
 
466 465
 		$summary = strtr(
@@ -483,7 +482,7 @@  discard block
 block discarded – undo
483 482
 	 *
484 483
 	 * @param PageRiconferma[] $pages
485 484
 	 */
486
-	protected function requestRemoval( array $pages ) {
485
+	protected function requestRemoval ( array $pages ) {
487 486
 		$listTitle = $this->getConfig()->get( 'list-title' );
488 487
 		$admins = json_decode( $this->getController()->getPageContent( $listTitle ), true );
489 488
 
@@ -528,14 +527,14 @@  discard block
 block discarded – undo
528 527
 	 *
529 528
 	 * @param PageRiconferma[] $pages
530 529
 	 */
531
-	protected function updateAnnunci( array $pages ) {
530
+	protected function updateAnnunci ( array $pages ) {
532 531
 		$title = $this->getConfig()->get( 'annunci-title' );
533 532
 
534
-		$names = [];
533
+		$names = [ ];
535 534
 		$text = '';
536 535
 		foreach ( $pages as $page ) {
537 536
 			$user = $page->getUser();
538
-			$names[] = $user;
537
+			$names[ ] = $user;
539 538
 			$text .= "{{Breve|admin|{{subst:#time:j}}|[[Utente:$user|]] " .
540 539
 				"non è stato riconfermato [[WP:A|amministratore]].}}\n";
541 540
 		}
@@ -557,7 +556,7 @@  discard block
 block discarded – undo
557 556
 			$lastUser = array_pop( $names );
558 557
 			$namesList = implode( ', ', $names ) . " e $lastUser";
559 558
 		} else {
560
-			$namesList = $names[0];
559
+			$namesList = $names[ 0 ];
561 560
 		}
562 561
 
563 562
 		$summary = strtr(
@@ -578,15 +577,15 @@  discard block
 block discarded – undo
578 577
 	 *
579 578
 	 * @param PageRiconferma[] $pages
580 579
 	 */
581
-	protected function updateUltimeNotizie( array $pages ) {
580
+	protected function updateUltimeNotizie ( array $pages ) {
582 581
 		$title = $this->getConfig()->get( 'ultimenotizie-title' );
583 582
 
584
-		$names = [];
583
+		$names = [ ];
585 584
 		$text = '';
586 585
 		foreach ( $pages as $page ) {
587 586
 			$user = $page->getUser();
588 587
 			$title = $page->getTitle();
589
-			$names[] = $user;
588
+			$names[ ] = $user;
590 589
 			$text .= "'''{{subst:#time:j F}}''': [[Utente:$user|]] non è stato [[$title|riconfermato]] " .
591 590
 				'[[WP:A|amministratore]]; ora gli admin sono {{subst:#expr: {{NUMBEROFADMINS}} - 1}}.';
592 591
 		}
@@ -605,7 +604,7 @@  discard block
 block discarded – undo
605 604
 			$lastUser = array_pop( $names );
606 605
 			$namesList = implode( ', ', $names ) . " e $lastUser";
607 606
 		} else {
608
-			$namesList = $names[0];
607
+			$namesList = $names[ 0 ];
609 608
 		}
610 609
 
611 610
 		$summary = strtr(
Please login to merge, or discard this patch.