Passed
Push — master ( aecdf6...dbd8ef )
by Daimona
19:47 queued 17:09
created
src/Task/Subtask/SimpleUpdates.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	 * @inheritDoc
16 16
 	 */
17
-	public function runInternal() : int {
17
+	public function runInternal () : int {
18 18
 		$pages = $this->getDataProvider()->getPagesToClose();
19 19
 
20 20
 		if ( !$pages ) {
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	 * @param PageRiconferma[] $pages
37 37
 	 * @see OpenUpdates::addToVotazioni()
38 38
 	 */
39
-	protected function updateVotazioni( array $pages ) : void {
39
+	protected function updateVotazioni ( array $pages ) : void {
40 40
 		$this->getLogger()->info(
41 41
 			'Updating votazioni: ' . implode( ', ', $pages )
42 42
 		);
43 43
 		$votePage = $this->getPage( $this->getOpt( 'vote-page-title' ) );
44 44
 
45
-		$users = [];
45
+		$users = [ ];
46 46
 		foreach ( $pages as $page ) {
47
-			$users[] = $this->getUser( $page->getUserName() );
47
+			$users[ ] = $this->getUser( $page->getUserName() );
48 48
 		}
49 49
 		$usersReg = RegexUtils::regexFromArray( '!', ...$users );
50 50
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param PageRiconferma[] $pages
66 66
 	 * @see OpenUpdates::addToNews()
67 67
 	 */
68
-	protected function updateNews( array $pages ) : void {
68
+	protected function updateNews ( array $pages ) : void {
69 69
 		$simpleAmount = $voteAmount = 0;
70 70
 		foreach ( $pages as $page ) {
71 71
 			if ( $page->isVote() ) {
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 		$simpleMatches = $newsPage->getMatch( $simpleReg );
86 86
 		$voteMatches = $newsPage->getMatch( $voteReg );
87 87
 
88
-		$newSimp = ( (int)$simpleMatches[2] - $simpleAmount ) ?: '';
89
-		$newVote = ( (int)$voteMatches[2] - $voteAmount ) ?: '';
88
+		$newSimp = ( (int)$simpleMatches[ 2 ] - $simpleAmount ) ?: '';
89
+		$newVote = ( (int)$voteMatches[ 2 ] - $voteAmount ) ?: '';
90 90
 		$newContent = preg_replace( $simpleReg, '${1}' . $newSimp, $newsPage->getContent() );
91 91
 		$newContent = preg_replace( $voteReg, '${1}' . $newVote, $newContent );
92 92
 
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @param bool[] $outcomes
106 106
 	 */
107
-	protected function updateAdminList( array $outcomes ) : void {
107
+	protected function updateAdminList ( array $outcomes ) : void {
108 108
 		$this->getLogger()->info( 'Updating admin list' );
109 109
 		$adminsPage = $this->getPage( $this->getOpt( 'admins-list-title' ) );
110 110
 		$newContent = $adminsPage->getContent();
111 111
 
112
-		$riconfNames = $removeNames = [];
112
+		$riconfNames = $removeNames = [ ];
113 113
 		foreach ( $outcomes as $username => $confirmed ) {
114 114
 			$user = $this->getUser( $username );
115 115
 			$userReg = $user->getRegex( '!' );
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 					'${1}{{subst:#timel:Ymd}}|' . $nextDate . '$2',
125 125
 					$newContent
126 126
 				);
127
-				$riconfNames[] = $username;
127
+				$riconfNames[ ] = $username;
128 128
 			} else {
129 129
 				$newContent = preg_replace( $reg, '', $newContent );
130
-				$removeNames[] = $username;
130
+				$removeNames[ ] = $username;
131 131
 			}
132 132
 		}
133 133
 
@@ -147,21 +147,21 @@  discard block
 block discarded – undo
147 147
 	/**
148 148
 	 * @param bool[] $outcomes
149 149
 	 */
150
-	protected function updateCUList( array $outcomes ) : void {
150
+	protected function updateCUList ( array $outcomes ) : void {
151 151
 		$this->getLogger()->info( 'Updating CU list.' );
152 152
 		$cuList = $this->getPage( $this->getOpt( 'cu-list-title' ) );
153 153
 		$newContent = $cuList->getContent();
154 154
 
155
-		$riconfNames = $removeNames = [];
155
+		$riconfNames = $removeNames = [ ];
156 156
 		foreach ( $outcomes as $user => $confirmed ) {
157 157
 			$userReg = $this->getUser( $user )->getRegex( '!' );
158 158
 			$reg = "!(\{\{ *Checkuser *\| *$userReg *\|[^}]+\| *)[\w \d]+(}}.*\n)!";
159 159
 			if ( $confirmed ) {
160 160
 				$newContent = preg_replace( $reg, '${1}{{subst:#time:j F Y}}$2', $newContent );
161
-				$riconfNames[] = $user;
161
+				$riconfNames[ ] = $user;
162 162
 			} else {
163 163
 				$newContent = preg_replace( $reg, '', $newContent );
164
-				$removeNames[] = $user;
164
+				$removeNames[ ] = $user;
165 165
 			}
166 166
 		}
167 167
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param PageRiconferma[] $pages
186 186
 	 * @return bool[]
187 187
 	 */
188
-	private function getGroupOutcomes( string $group, array $pages ) : array {
189
-		$ret = [];
188
+	private function getGroupOutcomes ( string $group, array $pages ) : array {
189
+		$ret = [ ];
190 190
 		foreach ( $pages as $page ) {
191 191
 			$user = $this->getUser( $page->getUserName() );
192 192
 			if ( $user->inGroup( $group ) ) {
Please login to merge, or discard this patch.
src/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 di riconferma: $outcomeText" : 'riconferma tacita';
68 67
 
69 68
 		$newContent = preg_replace( '/^(#: *)(votazione di )?riconferma in corso/m', '$1' . $text, $current );
Please login to merge, or discard this patch.
src/Task/Subtask/CreatePages.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	/**
18 18
 	 * @inheritDoc
19 19
 	 */
20
-	public function runInternal() : int {
20
+	public function runInternal () : int {
21 21
 		$users = $this->getDataProvider()->getUsersToProcess();
22 22
 
23 23
 		if ( !$users ) {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 *
37 37
 	 * @param User $user
38 38
 	 */
39
-	protected function processUser( User $user ) : void {
39
+	protected function processUser ( User $user ) : void {
40 40
 		$this->getLogger()->info( "Processing user $user" );
41 41
 		try {
42 42
 			$num = $this->getLastPageNum( $user ) + 1;
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
 	 * @return int
72 72
 	 * @throws TaskException
73 73
 	 */
74
-	protected function getLastPageNum( User $user ) : int {
74
+	protected function getLastPageNum ( User $user ) : int {
75 75
 		$this->getLogger()->info( "Retrieving previous pages for $user" );
76 76
 
77
-		$unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[1];
77
+		$unprefixedTitle = explode( ':', $this->getOpt( 'main-page-title' ), 2 )[ 1 ];
78 78
 
79 79
 		$prefixes = [ "$unprefixedTitle/$user/" ];
80 80
 		foreach ( $user->getAliases() as $alias ) {
81
-			$prefixes[] = "$unprefixedTitle/$alias/";
81
+			$prefixes[ ] = "$unprefixedTitle/$alias/";
82 82
 		}
83 83
 
84 84
 		$params = [
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		];
91 91
 		$pagesIterator = new AppendIterator();
92 92
 		foreach ( $prefixes as $prefix ) {
93
-			$params['apprefix'] = $prefix;
93
+			$params[ 'apprefix' ] = $prefix;
94 94
 			$res = $this->getRequestFactory()->newFromParams( $params )->executeAsQuery();
95 95
 			$pagesIterator->append( new NoRewindIterator( $res ) );
96 96
 		}
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 	 * @param string $title
117 117
 	 * @param User $user
118 118
 	 */
119
-	protected function createPage( string $title, User $user ) : void {
119
+	protected function createPage ( string $title, User $user ) : void {
120 120
 		$this->getLogger()->info( "Creating page $title" );
121 121
 		$groups = $user->getGroupsWithDates();
122 122
 		$textParams = [
123 123
 			'$user' => $user->getName(),
124
-			'$date' => $groups['sysop'],
125
-			'$burocrate' => $groups['bureaucrat'] ?? '',
126
-			'$checkuser' => $groups['checkuser'] ?? ''
124
+			'$date' => $groups[ 'sysop' ],
125
+			'$burocrate' => $groups[ 'bureaucrat' ] ?? '',
126
+			'$checkuser' => $groups[ 'checkuser' ] ?? ''
127 127
 		];
128 128
 
129 129
 		$params = [
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @param Page $basePage
142 142
 	 * @param string $newText
143 143
 	 */
144
-	protected function createBasePage( Page $basePage, string $newText ) : void {
144
+	protected function createBasePage ( Page $basePage, string $newText ) : void {
145 145
 		$this->getLogger()->info( "Creating base page $basePage" );
146 146
 
147 147
 		$params = [
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @param Page $basePage
158 158
 	 * @param string $newText
159 159
 	 */
160
-	protected function updateBasePage( Page $basePage, string $newText ) : void {
160
+	protected function updateBasePage ( Page $basePage, string $newText ) : void {
161 161
 		$this->getLogger()->info( "Updating base page $basePage" );
162 162
 
163 163
 		$params = [
Please login to merge, or discard this patch.
src/Task/Subtask/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\Subtask;
4 4
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	/**
13 13
 	 * @inheritDoc
14 14
 	 */
15
-	public function runInternal() : int {
15
+	public function runInternal () : int {
16 16
 		$pages = $this->getDataProvider()->getCreatedPages();
17 17
 		$users = $this->getDataProvider()->getUsersToProcess();
18 18
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			return TaskResult::STATUS_NOTHING;
21 21
 		}
22 22
 
23
-		$ricNums = [];
23
+		$ricNums = [ ];
24 24
 		foreach ( $pages as $page ) {
25 25
 			$ricNums[ $page->getUserName() ] = $page->getNum();
26 26
 		}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param User $user
39 39
 	 * @param int $ricNum
40 40
 	 */
41
-	protected function addMsg( User $user, int $ricNum ) : void {
41
+	protected function addMsg ( User $user, int $ricNum ) : void {
42 42
 		$this->getLogger()->info( "Leaving msg to $user" );
43 43
 		$msg = $this->msg( 'user-notice-msg' )->params( [ '$num' => $ricNum ] )->text();
44 44
 
Please login to merge, or discard this patch.
src/Task/Subtask/Subtask.php 1 patch
Spacing   +2 added lines, -2 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
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	/**
12 12
 	 * @inheritDoc
13 13
 	 */
14
-	final public function getOperationName(): string {
14
+	final public function getOperationName (): string {
15 15
 		return 'subtask';
16 16
 	}
17 17
 }
Please login to merge, or discard this patch.
src/Task/Subtask/OpenUpdates.php 1 patch
Spacing   +6 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()->getCreatedPages();
18 18
 
19 19
 		if ( !$pages ) {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param PageRiconferma[] $pages
37 37
 	 */
38
-	protected function addToMainPage( array $pages ) : void {
38
+	protected function addToMainPage ( array $pages ) : void {
39 39
 		$this->getLogger()->info(
40 40
 			'Adding the following to main: ' . implode( ', ', $pages )
41 41
 		);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param PageRiconferma[] $pages
70 70
 	 */
71
-	protected function addToVotazioni( array $pages ) : void {
71
+	protected function addToVotazioni ( array $pages ) : void {
72 72
 		$this->getLogger()->info(
73 73
 			'Adding the following to votes: ' . implode( ', ', $pages )
74 74
 		);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param int $amount
106 106
 	 * @throws TaskException
107 107
 	 */
108
-	protected function addToNews( int $amount ) : void {
108
+	protected function addToNews ( int $amount ) : void {
109 109
 		$this->getLogger()->info( "Increasing the news counter by $amount" );
110 110
 		$newsPage = $this->getPage( $this->getOpt( 'news-page-title' ) );
111 111
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$matches = $newsPage->getMatch( $reg );
120 120
 
121
-		$newNum = (int)$matches[2] + $amount;
121
+		$newNum = (int)$matches[ 2 ] + $amount;
122 122
 		$newContent = preg_replace( $reg, '${1}' . $newNum, $content );
123 123
 
124 124
 		$summary = $this->msg( 'news-page-summary' )
Please login to merge, or discard this patch.
src/Task/StartNew.php 1 patch
Spacing   +3 added lines, -3 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 runInternal() : int {
17
+	public function runInternal () : int {
18 18
 		$orderedList = [
19 19
 			'create-pages',
20 20
 			'open-updates',
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @inheritDoc
34 34
 	 */
35
-	protected function getSubtasksMap() : array {
35
+	protected function getSubtasksMap () : array {
36 36
 		return [
37 37
 			'create-pages' => CreatePages::class,
38 38
 			'open-updates' => OpenUpdates::class,
Please login to merge, or discard this patch.
src/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
 
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @inheritDoc
24 24
 	 */
25
-	protected function getSubtasksMap(): array {
25
+	protected function getSubtasksMap (): array {
26 26
 		// Everything is done here.
27
-		return [];
27
+		return [ ];
28 28
 	}
29 29
 
30 30
 	/**
31 31
 	 * @inheritDoc
32 32
 	 */
33
-	public function runInternal() : int {
33
+	public function runInternal () : int {
34 34
 		$this->actualList = $this->getActualAdmins();
35 35
 		$pageBotList = $this->getBotList();
36 36
 		$this->botList = $pageBotList->getDecodedContent();
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @return string[][]
59 59
 	 * @phan-return array<string,string[]>
60 60
 	 */
61
-	protected function getActualAdmins() : array {
61
+	protected function getActualAdmins () : array {
62 62
 		$params = [
63 63
 			'action' => 'query',
64 64
 			'list' => 'allusers',
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @return string[][]
77 77
 	 * @phan-return array<string,string[]>
78 78
 	 */
79
-	protected function extractAdmins( Generator $data ) : array {
80
-		$ret = [];
79
+	protected function extractAdmins ( Generator $data ) : array {
80
+		$ret = [ ];
81 81
 		$blacklist = $this->getOpt( 'exclude-admins' );
82 82
 		foreach ( $data as $u ) {
83 83
 			if ( in_array( $u->name, $blacklist, true ) ) {
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @return string[][]
96 96
 	 */
97
-	protected function getMissingGroups() : array {
98
-		$missing = [];
97
+	protected function getMissingGroups () : array {
98
+		$missing = [ ];
99 99
 		foreach ( $this->actualList as $adm => $groups ) {
100
-			$curMissing = array_diff( $groups, array_keys( $this->botList[$adm] ?? [] ) );
100
+			$curMissing = array_diff( $groups, array_keys( $this->botList[ $adm ] ?? [ ] ) );
101 101
 
102 102
 			foreach ( $curMissing as $group ) {
103 103
 				try {
104 104
 					$missing[ $adm ][ $group ] = $this->getFlagDate( $adm, $group );
105 105
 				} catch ( TaskException $e ) {
106
-					$this->errors[] = $e->getMessage();
106
+					$this->errors[ ] = $e->getMessage();
107 107
 				}
108 108
 			}
109 109
 		}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return string
119 119
 	 * @throws TaskException
120 120
 	 */
121
-	protected function getFlagDate( string $admin, string $group ) : string {
121
+	protected function getFlagDate ( string $admin, string $group ) : string {
122 122
 		$this->getLogger()->info( "Retrieving $group flag date for $admin" );
123 123
 
124 124
 		$wiki = $this->getWiki();
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @param string $group
154 154
 	 * @return string|null
155 155
 	 */
156
-	private function extractTimestamp( Generator $data, string $group ) : ?string {
156
+	private function extractTimestamp ( Generator $data, string $group ) : ?string {
157 157
 		$ts = null;
158 158
 		foreach ( $data as $entry ) {
159 159
 			if (
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string[][]
174 174
 	 */
175
-	protected function getExtraGroups() : array {
176
-		$extra = [];
175
+	protected function getExtraGroups () : array {
176
+		$extra = [ ];
177 177
 		foreach ( $this->botList as $name => $groups ) {
178 178
 			$groups = array_diff_key( $groups, array_fill_keys( PageBotList::NON_GROUP_KEYS, 1 ) );
179 179
 			if ( !isset( $this->actualList[ $name ] ) ) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param string[] $names
190 190
 	 * @return Generator
191 191
 	 */
192
-	private function getRenameEntries( array $names ) : Generator {
192
+	private function getRenameEntries ( array $names ) : Generator {
193 193
 		$titles = array_map( static function ( string $x ) : string {
194 194
 			return "Utente:$x";
195 195
 		}, $names );
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 	 * @param string[] $names
214 214
 	 * @return string[] [ old_name => new_name ]
215 215
 	 */
216
-	protected function getRenamedUsers( array $names ) : array {
216
+	protected function getRenamedUsers ( array $names ) : array {
217 217
 		if ( !$names ) {
218
-			return [];
218
+			return [ ];
219 219
 		}
220 220
 		$this->getLogger()->info( 'Checking rename for ' . implode( ', ', $names ) );
221 221
 
222 222
 		$data = $this->getRenameEntries( $names );
223
-		$ret = [];
223
+		$ret = [ ];
224 224
 		foreach ( $data as $entry ) {
225 225
 			// 1 month is arbitrary
226 226
 			if ( strtotime( $entry->timestamp ) > strtotime( '-1 month' ) ) {
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 	 * @phan-param array<string,array<string,string|string[]>> $newContent
240 240
 	 * @param string[][] $removed
241 241
 	 */
242
-	private function handleRenames( array &$newContent, array $removed ) : void {
242
+	private function handleRenames ( array &$newContent, array $removed ) : void {
243 243
 		$renameMap = $this->getRenamedUsers( array_keys( $removed ) );
244 244
 		foreach ( $removed as $oldName => $info ) {
245 245
 			if (
246 246
 				array_key_exists( $oldName, $renameMap ) &&
247
-				array_key_exists( $renameMap[$oldName], $newContent )
247
+				array_key_exists( $renameMap[ $oldName ], $newContent )
248 248
 			) {
249 249
 				// This user was renamed! Add this name as alias, if they're still listed
250 250
 				$newName = $renameMap[ $oldName ];
251 251
 				$this->getLogger()->info( "Found rename $oldName -> $newName" );
252
-				$aliases = array_unique( array_merge( $newContent[ $newName ]['aliases'], [ $oldName ] ) );
253
-				$newContent[ $newName ]['aliases'] = $aliases;
252
+				$aliases = array_unique( array_merge( $newContent[ $newName ][ 'aliases' ], [ $oldName ] ) );
253
+				$newContent[ $newName ][ 'aliases' ] = $aliases;
254 254
 				// Transfer overrides to the new name.
255 255
 				$overrides = array_diff_key( $info, [ 'override' => 1, 'override-perm' => 1 ] );
256 256
 				$newContent[ $newName ] = array_merge( $newContent[ $newName ], $overrides );
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
 	 * @param string[][] $extra
266 266
 	 * @return string[][] Removed users
267 267
 	 */
268
-	private function handleExtraAndMissing(
268
+	private function handleExtraAndMissing (
269 269
 		array &$newContent,
270 270
 		array $missing,
271 271
 		array $extra
272 272
 	) : array {
273
-		$removed = [];
273
+		$removed = [ ];
274 274
 		foreach ( $newContent as $user => $groups ) {
275 275
 			if ( isset( $missing[ $user ] ) ) {
276 276
 				$newContent[ $user ] = array_merge( $groups, $missing[ $user ] );
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				if ( array_diff_key( $newGroups, array_fill_keys( PageBotList::NON_GROUP_KEYS, 1 ) ) ) {
281 281
 					$newContent[ $user ] = $newGroups;
282 282
 				} else {
283
-					$removed[$user] = $newContent[$user];
283
+					$removed[ $user ] = $newContent[ $user ];
284 284
 					unset( $newContent[ $user ] );
285 285
 				}
286 286
 			}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param string[][] $extra
298 298
 	 * @return array[]
299 299
 	 */
300
-	protected function getNewContent( array $missing, array $extra ) : array {
300
+	protected function getNewContent ( array $missing, array $extra ) : array {
301 301
 		$newContent = $this->botList;
302 302
 
303 303
 		$removed = $this->handleExtraAndMissing( $newContent, $missing, $extra );
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @param array[] &$newContent
318 318
 	 */
319
-	protected function removeOverrides( array &$newContent ) : void {
320
-		$removed = [];
319
+	protected function removeOverrides ( array &$newContent ) : void {
320
+		$removed = [ ];
321 321
 		foreach ( $newContent as $user => $groups ) {
322 322
 			if ( PageBotList::isOverrideExpired( $groups ) ) {
323 323
 				unset( $newContent[ $user ][ 'override' ] );
324
-				$removed[] = $user;
324
+				$removed[ ] = $user;
325 325
 			}
326 326
 		}
327 327
 
Please login to merge, or discard this patch.
src/Task/CloseOld.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * @inheritDoc
17 17
 	 */
18
-	public function runInternal() : int {
18
+	public function runInternal () : int {
19 19
 		$orderedList = [
20 20
 			'close-pages',
21 21
 			'archive-pages',
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	/**
35 35
 	 * @inheritDoc
36 36
 	 */
37
-	protected function getSubtasksMap(): array {
37
+	protected function getSubtasksMap (): array {
38 38
 		return [
39 39
 			'archive-pages' => ArchivePages::class,
40 40
 			'close-pages' => ClosePages::class,
Please login to merge, or discard this patch.