Passed
Push — master ( 868ca3...792763 )
by Daimona
02:01
created
includes/Exception/MissingMatchException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Exception;
4 4
 
Please login to merge, or discard this patch.
includes/Request/NativeRequest.php 1 patch
Spacing   +5 added lines, -5 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\Request;
4 4
 
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	/**
10 10
 	 * @inheritDoc
11 11
 	 */
12
-	protected function reallyMakeRequest( string $params ) : string {
12
+	protected function reallyMakeRequest ( string $params ) : string {
13 13
 		$context = [
14 14
 			'http' => [
15 15
 				'method' => $this->method,
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		];
19 19
 		$url = $this->url;
20 20
 		if ( $this->method === self::METHOD_POST ) {
21
-			$context['http']['content'] = $params;
21
+			$context[ 'http' ][ 'content' ] = $params;
22 22
 		} else {
23 23
 			$url = "$url?$params";
24 24
 		}
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 
28 28
 		foreach ( $http_response_header as $header ) {
29 29
 			$bits = explode( ':', $header, 2 );
30
-			if ( trim( $bits[0] ) === 'Set-Cookie' ) {
31
-				$this->newCookies[] = $bits[1];
30
+			if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) {
31
+				$this->newCookies[ ] = $bits[ 1 ];
32 32
 			}
33 33
 		}
34 34
 
Please login to merge, or discard this patch.
includes/Exception/CannotLoginException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Exception;
4 4
 
Please login to merge, or discard this patch.
includes/Exception/MessageNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Exception;
4 4
 
Please login to merge, or discard this patch.
includes/Exception/MessagesPageDoesNotExistException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php declare( strict_types=1 );
1
+<?php declare(strict_types=1);
2 2
 
3 3
 namespace BotRiconferme\Exception;
4 4
 
Please login to merge, or discard this patch.
includes/MessageProvider.php 1 patch
Spacing   +5 added lines, -5 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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param Wiki $wiki
21 21
 	 * @param string $msgTitle
22 22
 	 */
23
-	public function __construct( Wiki $wiki, string $msgTitle ) {
23
+	public function __construct ( Wiki $wiki, string $msgTitle ) {
24 24
 		$this->wiki = $wiki;
25 25
 		$this->msgTitle = $msgTitle;
26 26
 	}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @throws MessagesPageDoesNotExistException
30 30
 	 */
31
-	private function grabWikiMessages() : void {
31
+	private function grabWikiMessages () : void {
32 32
 		if ( self::$messages !== null ) {
33 33
 			return;
34 34
 		}
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	 * @return Message
46 46
 	 * @throws MessageNotFoundException
47 47
 	 */
48
-	public function getMessage( string $key ) : Message {
48
+	public function getMessage ( string $key ) : Message {
49 49
 		$this->grabWikiMessages();
50 50
 		if ( !isset( self::$messages[ $key ] ) ) {
51 51
 			throw new MessageNotFoundException( "Message '$key' does not exist." );
52 52
 		}
53 53
 		// @phan-suppress-next-line PhanTypeArraySuspiciousNullable
54
-		return new Message( self::$messages[$key] );
54
+		return new Message( self::$messages[ $key ] );
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
includes/Wiki/LoginInfo.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\Wiki;
4 4
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 * @param string $username
16 16
 	 * @param string $password
17 17
 	 */
18
-	public function __construct( string $username, string $password ) {
18
+	public function __construct ( string $username, string $password ) {
19 19
 		$this->username = $username;
20 20
 		$this->password = $password;
21 21
 	}
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 	/**
24 24
 	 * @return string
25 25
 	 */
26
-	public function getUsername() : string {
26
+	public function getUsername () : string {
27 27
 		return $this->username;
28 28
 	}
29 29
 
30 30
 	/**
31 31
 	 * @return string
32 32
 	 */
33
-	public function getPassword() : string {
33
+	public function getPassword () : string {
34 34
 		return $this->password;
35 35
 	}
36 36
 }
Please login to merge, or discard this patch.
includes/Logger/WikiLogger.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\Logger;
4 4
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string $summary
30 30
 	 * @param string $minlevel
31 31
 	 */
32
-	public function __construct( Page $logPage, string $summary, $minlevel = LogLevel::INFO ) {
32
+	public function __construct ( Page $logPage, string $summary, $minlevel = LogLevel::INFO ) {
33 33
 		$this->minLevel = $this->levelToInt( $minlevel );
34 34
 		$this->logPage = $logPage;
35 35
 		$this->summary = $summary;
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 	 * @inheritDoc
40 40
 	 * @suppress PhanUnusedPublicMethodParameter
41 41
 	 */
42
-	public function log( $level, $message, array $context = [] ) :void {
42
+	public function log ( $level, $message, array $context = [ ] ) :void {
43 43
 		if ( $this->levelToInt( $level ) >= $this->minLevel ) {
44
-			$this->buffer[] = $this->getFormattedMessage( $level, $message );
44
+			$this->buffer[ ] = $this->getFormattedMessage( $level, $message );
45 45
 		}
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 * @return string
50 50
 	 */
51
-	protected function getOutput() : string {
51
+	protected function getOutput () : string {
52 52
 		$line = str_repeat( '-', 80 );
53 53
 		return "\n\n" . implode( "\n", $this->buffer ) . "\n$line\n\n";
54 54
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * @inheritDoc
58 58
 	 */
59
-	public function flush() : void {
59
+	public function flush () : void {
60 60
 		if ( $this->buffer ) {
61 61
 			$this->logPage->edit( [
62 62
 				'appendtext' => $this->getOutput(),
Please login to merge, or discard this patch.
includes/CLI.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;
4 4
 
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @return bool
59 59
 	 */
60
-	public static function isCLI() : bool {
60
+	public static function isCLI () : bool {
61 61
 		return PHP_SAPI === 'cli';
62 62
 	}
63 63
 
64 64
 	/**
65 65
 	 * Populate options and check for required ones
66 66
 	 */
67
-	public function __construct() {
67
+	public function __construct () {
68 68
 		$opts = getopt( self::SHORT_OPTS, self::LONG_OPTS );
69 69
 		$this->checkRequiredOpts( $opts );
70 70
 		$this->checkConflictingOpts( $opts );
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	/**
76 76
 	 * @param array $opts
77 77
 	 */
78
-	private function checkRequiredOpts( array $opts ) : void {
78
+	private function checkRequiredOpts ( array $opts ) : void {
79 79
 		$missingOpts = array_diff( self::REQUIRED_OPTS, array_keys( $opts ) );
80 80
 		if ( $missingOpts ) {
81 81
 			exit( 'Required options missing: ' . implode( ', ', $missingOpts ) );
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	/**
92 92
 	 * @param array $opts
93 93
 	 */
94
-	private function checkConflictingOpts( array $opts ) : void {
94
+	private function checkConflictingOpts ( array $opts ) : void {
95 95
 		$hasPw = array_key_exists( 'password', $opts );
96 96
 		$hasPwFile = array_key_exists( 'use-password-file', $opts );
97 97
 		if ( $hasPw && $hasPwFile ) {
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * @param array &$opts
110 110
 	 */
111
-	private function canonicalize( array &$opts ) : void {
111
+	private function canonicalize ( array &$opts ) : void {
112 112
 		if ( array_key_exists( 'use-password-file', $opts ) ) {
113 113
 			$pw = trim( file_get_contents( self::PASSWORD_FILE ) );
114
-			$opts['password'] = $pw;
115
-			unset( $opts['use-password-file'] );
114
+			$opts[ 'password' ] = $pw;
115
+			unset( $opts[ 'use-password-file' ] );
116 116
 		}
117 117
 	}
118 118
 
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
 	 * @param mixed|null $default
122 122
 	 * @return mixed
123 123
 	 */
124
-	public function getOpt( string $opt, $default = null ) {
125
-		return $this->opts[$opt] ?? $default;
124
+	public function getOpt ( string $opt, $default = null ) {
125
+		return $this->opts[ $opt ] ?? $default;
126 126
 	}
127 127
 
128 128
 	/**
129 129
 	 * @return array Either [ 'task' => taskname ] or [ 'subtask' => subtaskname ]
130 130
 	 */
131
-	public function getTaskOpt() : array {
131
+	public function getTaskOpt () : array {
132 132
 		return array_intersect_key(
133 133
 			$this->opts,
134 134
 			[ 'task' => true, 'subtask' => true ]
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	/**
139 139
 	 * @return string|null
140 140
 	 */
141
-	public function getURL() : ?string {
141
+	public function getURL () : ?string {
142 142
 		return $this->getOpt( 'force-url' );
143 143
 	}
144 144
 }
Please login to merge, or discard this patch.