Passed
Push — master ( 78cb26...7adaf7 )
by Daimona
01:56
created
includes/Exception/TaskException.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/APIRequestException.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/ConfigException.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/LoginException.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/ProtectedPageException.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\Exception;
4 4
 
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	/**
10 10
 	 * @param string|null $title If available
11 11
 	 */
12
-	public function __construct( string $title = null ) {
12
+	public function __construct ( string $title = null ) {
13 13
 		if ( $title ) {
14 14
 			parent::__construct( "The specified page is protected: $title" );
15 15
 		} else {
Please login to merge, or discard this patch.
includes/Exception/MissingPageException.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\Exception;
4 4
 
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	/**
10 10
 	 * @param string|null $title If available
11 11
 	 */
12
-	public function __construct( string $title = null ) {
12
+	public function __construct ( string $title = null ) {
13 13
 		if ( $title ) {
14 14
 			parent::__construct( "The specified page doesn't exist: $title" );
15 15
 		} else {
Please login to merge, or discard this patch.
includes/Request/CurlRequest.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
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	/**
12 12
 	 * @inheritDoc
13 13
 	 */
14
-	protected function reallyMakeRequest( string $params ) : string {
14
+	protected function reallyMakeRequest ( string $params ) : string {
15 15
 		$curl = curl_init();
16 16
 		if ( $curl === false ) {
17 17
 			throw new APIRequestException( 'Cannot open cURL handler.' );
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 * @return int
54 54
 	 * @internal Only used as CB for cURL
55 55
 	 */
56
-	public function headersHandler( $ch, string $header ) : int {
56
+	public function headersHandler ( $ch, string $header ) : int {
57 57
 		$bits = explode( ':', $header, 2 );
58
-		if ( trim( $bits[0] ) === 'Set-Cookie' ) {
59
-			$this->newCookies[] = $bits[1];
58
+		if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) {
59
+			$this->newCookies[ ] = $bits[ 1 ];
60 60
 		}
61 61
 		// @phan-suppress-next-line PhanTypeMismatchReturn WTF? Why does phan thinks this is a string?
62 62
 		return strlen( $header );
Please login to merge, or discard this patch.
includes/Exception/EditException.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/RequestBase.php 1 patch
Spacing   +22 added lines, -22 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
 
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	/** @var string */
30 30
 	protected $method = 'GET';
31 31
 	/** @var string[] */
32
-	protected $newCookies = [];
32
+	protected $newCookies = [ ];
33 33
 
34 34
 	/**
35 35
 	 * Use self::newFromParams, which will provide the right class to use
36 36
 	 *
37 37
 	 * @param array $params
38 38
 	 */
39
-	protected function __construct( array $params ) {
39
+	protected function __construct ( array $params ) {
40 40
 		$this->params = [ 'format' => 'json' ] + $params;
41 41
 		$this->url = DEFAULT_URL;
42 42
 	}
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param array $params
48 48
 	 * @return self
49 49
 	 */
50
-	public static function newFromParams( array $params ) : self {
50
+	public static function newFromParams ( array $params ) : self {
51 51
 		if ( extension_loaded( 'curl' ) ) {
52 52
 			$ret = new CurlRequest( $params );
53 53
 		} else {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @return self For chaining
63 63
 	 */
64
-	public function setPost() : self {
64
+	public function setPost () : self {
65 65
 		$this->method = 'POST';
66 66
 		return $this;
67 67
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param string $url
73 73
 	 * @return self for chaining
74 74
 	 */
75
-	public function setUrl( string $url ) : self {
75
+	public function setUrl ( string $url ) : self {
76 76
 		$this->url = $url;
77 77
 		return $this;
78 78
 	}
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @return \stdClass
84 84
 	 */
85
-	public function execute() : \stdClass {
85
+	public function execute () : \stdClass {
86 86
 		$curParams = $this->params;
87
-		$sets = [];
87
+		$sets = [ ];
88 88
 		do {
89 89
 			$res = $this->makeRequestInternal( $curParams );
90 90
 
91 91
 			$this->handleErrorAndWarnings( $res );
92
-			$sets[] = $res;
92
+			$sets[ ] = $res;
93 93
 
94 94
 			$finished = true;
95 95
 			if ( isset( $res->continue ) ) {
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 	 * @param array $params
108 108
 	 * @return \stdClass
109 109
 	 */
110
-	private function makeRequestInternal( array $params ) : \stdClass {
110
+	private function makeRequestInternal ( array $params ) : \stdClass {
111 111
 		if ( $this->method === 'POST' ) {
112
-			$params['maxlag'] = self::MAXLAG;
112
+			$params[ 'maxlag' ] = self::MAXLAG;
113 113
 		}
114 114
 		$params = http_build_query( $params );
115 115
 
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 	 * @param string $params
126 126
 	 * @return string
127 127
 	 */
128
-	abstract protected function reallyMakeRequest( string $params ) : string;
128
+	abstract protected function reallyMakeRequest ( string $params ) : string;
129 129
 
130 130
 	/**
131 131
 	 * After a request, set cookies for the next ones
132 132
 	 *
133 133
 	 * @param array $cookies
134 134
 	 */
135
-	protected function setCookies( array $cookies ) {
135
+	protected function setCookies ( array $cookies ) {
136 136
 		foreach ( $cookies as $cookie ) {
137 137
 			$bits = explode( ';', $cookie );
138
-			list( $name, $value ) = explode( '=', $bits[0] );
138
+			list( $name, $value ) = explode( '=', $bits[ 0 ] );
139 139
 			self::$cookiesToSet[ $name ] = $value;
140 140
 		}
141 141
 	}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param \stdClass $res
147 147
 	 * @throws APIRequestException
148 148
 	 */
149
-	protected function handleErrorAndWarnings( $res ) {
149
+	protected function handleErrorAndWarnings ( $res ) {
150 150
 		if ( isset( $res->error ) ) {
151 151
 			switch ( $res->error->code ) {
152 152
 				case 'missingtitle':
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @param \stdClass[] $sets
173 173
 	 * @return \stdClass
174 174
 	 */
175
-	private function mergeSets( array $sets ) : \stdClass {
175
+	private function mergeSets ( array $sets ) : \stdClass {
176 176
 		// Use the first set as template
177 177
 		$ret = array_shift( $sets );
178 178
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param array|\stdClass $second
190 190
 	 * @return array|\stdClass array
191 191
 	 */
192
-	private function recursiveMerge( $first, $second ) {
192
+	private function recursiveMerge ( $first, $second ) {
193 193
 		$ret = $first;
194 194
 		if ( is_array( $second ) ) {
195 195
 			$ret = is_array( $first ) ? array_merge_recursive( $first, $second ) : $second;
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return array
209 209
 	 */
210
-	protected function getHeaders() :array {
210
+	protected function getHeaders () :array {
211 211
 		$ret = self::HEADERS;
212 212
 		if ( self::$cookiesToSet ) {
213
-			$cookies = [];
213
+			$cookies = [ ];
214 214
 			foreach ( self::$cookiesToSet as $cname => $cval ) {
215
-				$cookies[] = trim( "$cname=$cval" );
215
+				$cookies[ ] = trim( "$cname=$cval" );
216 216
 			}
217
-			$ret[] = 'Cookie: ' . implode( '; ', $cookies );
217
+			$ret[ ] = 'Cookie: ' . implode( '; ', $cookies );
218 218
 		}
219 219
 		return $ret;
220 220
 	}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 * @param array $headers
226 226
 	 * @return string
227 227
 	 */
228
-	protected function buildHeadersString( array $headers ) : string {
228
+	protected function buildHeadersString ( array $headers ) : string {
229 229
 		$ret = '';
230 230
 		foreach ( $headers as $header ) {
231 231
 			$ret .= "$header\r\n";
Please login to merge, or discard this patch.