Passed
Pull Request — master (#456)
by Alexander
01:42
created
src/Types/ChatJoinRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      *
13 13
      * @var array
14 14
      */
15
-    protected static $requiredParams = ['chat', 'from', 'user_chat_id', 'date'];
15
+    protected static $requiredParams = [ 'chat', 'from', 'user_chat_id', 'date' ];
16 16
 
17 17
     /**
18 18
      * {@inheritdoc}
Please login to merge, or discard this patch.
src/Types/ChatMemberUpdated.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      *
13 13
      * @var array
14 14
      */
15
-    protected static $requiredParams = ['chat', 'from', 'date', 'old_chat_member', 'new_chat_member'];
15
+    protected static $requiredParams = [ 'chat', 'from', 'date', 'old_chat_member', 'new_chat_member' ];
16 16
 
17 17
     /**
18 18
      * {@inheritdoc}
Please login to merge, or discard this patch.
src/Types/ChatInviteLink.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      *
13 13
      * @var array
14 14
      */
15
-    protected static $requiredParams = ['invite_link', 'creator', 'creates_join_request', 'is_primary', 'is_revoked'];
15
+    protected static $requiredParams = [ 'invite_link', 'creator', 'creates_join_request', 'is_primary', 'is_revoked' ];
16 16
 
17 17
     /**
18 18
      * {@inheritdoc}
Please login to merge, or discard this patch.
src/BotApi.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         // Informational 1xx
54 54
         100 => 'Continue',
55 55
         101 => 'Switching Protocols',
56
-        102 => 'Processing',            // RFC2518
56
+        102 => 'Processing', // RFC2518
57 57
         // Success 2xx
58 58
         200 => 'OK',
59 59
         201 => 'Created',
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
         204 => 'No Content',
63 63
         205 => 'Reset Content',
64 64
         206 => 'Partial Content',
65
-        207 => 'Multi-Status',          // RFC4918
66
-        208 => 'Already Reported',      // RFC5842
67
-        226 => 'IM Used',               // RFC3229
65
+        207 => 'Multi-Status', // RFC4918
66
+        208 => 'Already Reported', // RFC5842
67
+        226 => 'IM Used', // RFC3229
68 68
         // Redirection 3xx
69 69
         300 => 'Multiple Choices',
70 70
         301 => 'Moved Permanently',
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         305 => 'Use Proxy',
75 75
         // 306 is deprecated but reserved
76 76
         307 => 'Temporary Redirect',
77
-        308 => 'Permanent Redirect',    // RFC7238
77
+        308 => 'Permanent Redirect', // RFC7238
78 78
         // Client Error 4xx
79 79
         400 => 'Bad Request',
80 80
         401 => 'Unauthorized',
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
         415 => 'Unsupported Media Type',
95 95
         416 => 'Range Not Satisfiable',
96 96
         417 => 'Expectation Failed',
97
-        422 => 'Unprocessable Entity',                                        // RFC4918
98
-        423 => 'Locked',                                                      // RFC4918
99
-        424 => 'Failed Dependency',                                           // RFC4918
100
-        425 => 'Reserved for WebDAV advanced collections expired proposal',   // RFC2817
101
-        426 => 'Upgrade Required',                                            // RFC2817
102
-        428 => 'Precondition Required',                                       // RFC6585
103
-        429 => 'Too Many Requests',                                           // RFC6585
104
-        431 => 'Request Header Fields Too Large',                             // RFC6585
97
+        422 => 'Unprocessable Entity', // RFC4918
98
+        423 => 'Locked', // RFC4918
99
+        424 => 'Failed Dependency', // RFC4918
100
+        425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
101
+        426 => 'Upgrade Required', // RFC2817
102
+        428 => 'Precondition Required', // RFC6585
103
+        429 => 'Too Many Requests', // RFC6585
104
+        431 => 'Request Header Fields Too Large', // RFC6585
105 105
         // Server Error 5xx
106 106
         500 => 'Internal Server Error',
107 107
         501 => 'Not Implemented',
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
         503 => 'Service Unavailable',
110 110
         504 => 'Gateway Timeout',
111 111
         505 => 'HTTP Version Not Supported',
112
-        506 => 'Variant Also Negotiates (Experimental)',                      // RFC2295
113
-        507 => 'Insufficient Storage',                                        // RFC4918
114
-        508 => 'Loop Detected',                                               // RFC5842
115
-        510 => 'Not Extended',                                                // RFC2774
116
-        511 => 'Network Authentication Required',                             // RFC6585
112
+        506 => 'Variant Also Negotiates (Experimental)', // RFC2295
113
+        507 => 'Insufficient Storage', // RFC4918
114
+        508 => 'Loop Detected', // RFC5842
115
+        510 => 'Not Extended', // RFC2774
116
+        511 => 'Network Authentication Required', // RFC6585
117 117
     ];
118 118
 
119 119
     /**
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      *
184 184
      * @var array
185 185
      */
186
-    protected $trackedEvents = [];
186
+    protected $trackedEvents = [ ];
187 187
 
188 188
     /**
189 189
      * @param string $token Telegram Bot API token
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
     {
215 215
         parse_str($rawData, $data);
216 216
 
217
-        $sign = $data['hash'];
218
-        unset($data['hash']);
217
+        $sign = $data[ 'hash' ];
218
+        unset($data[ 'hash' ]);
219 219
 
220
-        if ($authDateDiff && (time() - $data['auth_date'] > $authDateDiff)) {
220
+        if ($authDateDiff && (time() - $data[ 'auth_date' ] > $authDateDiff)) {
221 221
             return false;
222 222
         }
223 223
 
@@ -314,15 +314,15 @@  discard block
 block discarded – undo
314 314
         @trigger_error(sprintf('Method "%s::%s" is deprecated', __CLASS__, __METHOD__), \E_USER_DEPRECATED);
315 315
 
316 316
         if ($response) {
317
-            $json = json_decode($response, true) ?: [];
317
+            $json = json_decode($response, true) ?: [ ];
318 318
         } else {
319
-            $json = [];
319
+            $json = [ ];
320 320
         }
321 321
         if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE))
322
-            && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE])
322
+            && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ])
323 323
         ) {
324
-            $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode];
325
-            $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : [];
324
+            $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ];
325
+            $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ];
326 326
             throw new HttpException($errorDescription, $httpCode, null, $errorParameters);
327 327
         }
328 328
     }
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      */
590 590
     public function deleteWebhook($dropPendingUpdates = false)
591 591
     {
592
-        return $this->call('deleteWebhook', ['drop_pending_updates' => $dropPendingUpdates]);
592
+        return $this->call('deleteWebhook', [ 'drop_pending_updates' => $dropPendingUpdates ]);
593 593
     }
594 594
 
595 595
     /**
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
      *
877 877
      * @author bernard-ng <[email protected]>
878 878
      */
879
-    public function getCustomEmojiStickers($customEmojiIds = [])
879
+    public function getCustomEmojiStickers($customEmojiIds = [ ])
880 880
     {
881 881
         return StickerSet::fromResponse($this->call('getCustomEmojiStickers', [
882 882
             'custom_emoji_ids' => $customEmojiIds,
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
         $webmSticker = null,
949 949
         $stickerType = null,
950 950
         $maskPosition = null,
951
-        $attachments = []
951
+        $attachments = [ ]
952 952
     ) {
953 953
         return $this->call('createNewStickerSet', [
954 954
             'user_id' => $userId,
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
         $tgsSticker = null,
993 993
         $webmSticker = null,
994 994
         $maskPosition = null,
995
-        $attachments = []
995
+        $attachments = [ ]
996 996
     ) {
997 997
         return $this->call('addStickerToSet', [
998 998
             'user_id' => $userId,
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
      */
1438 1438
     public function getFile($fileId)
1439 1439
     {
1440
-        return File::fromResponse($this->call('getFile', ['file_id' => $fileId]));
1440
+        return File::fromResponse($this->call('getFile', [ 'file_id' => $fileId ]));
1441 1441
     }
1442 1442
 
1443 1443
     /**
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
              * @param AbstractInlineQueryResult $item
1470 1470
              * @return array
1471 1471
              */
1472
-            function ($item) {
1472
+            function($item) {
1473 1473
                 /** @var array $array */
1474 1474
                 $array = $item->toJson(true);
1475 1475
 
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
         InputMedia $media,
1736 1736
         $inlineMessageId = null,
1737 1737
         $replyMarkup = null,
1738
-        $attachments = []
1738
+        $attachments = [ ]
1739 1739
     ) {
1740 1740
         $response = $this->call('editMessageMedia', [
1741 1741
             'chat_id' => $chatId,
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
             if (!$message) {
1824 1824
                 return;
1825 1825
             }
1826
-            $this->trackedEvents[] = $update->getUpdateId();
1826
+            $this->trackedEvents[ ] = $update->getUpdateId();
1827 1827
 
1828 1828
             $this->track($message, $eventName);
1829 1829
 
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
      * @return bool
1959 1959
      * @throws Exception
1960 1960
      */
1961
-    public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [], $errorMessage = null)
1961
+    public function answerShippingQuery($shippingQueryId, $ok = true, $shippingOptions = [ ], $errorMessage = null)
1962 1962
     {
1963 1963
         return $this->call('answerShippingQuery', [
1964 1964
             'shipping_query_id' => $shippingQueryId,
@@ -2507,7 +2507,7 @@  discard block
 block discarded – undo
2507 2507
         $messageThreadId = null,
2508 2508
         $protectContent = null,
2509 2509
         $allowSendingWithoutReply = null,
2510
-        $attachments = []
2510
+        $attachments = [ ]
2511 2511
     ) {
2512 2512
         return ArrayOfMessages::fromResponse($this->call('sendMediaGroup', [
2513 2513
             'chat_id' => $chatId,
Please login to merge, or discard this patch.
src/HttpException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * @var array
15 15
      */
16
-    protected $parameters = [];
16
+    protected $parameters = [ ];
17 17
 
18 18
     /**
19 19
      * HttpException constructor.
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param \Throwable|\Exception $previous [optional] The previous throwable used for the exception chaining.
24 24
      * @param array $parameters [optional] Array of parameters returned from API.
25 25
      */
26
-    public function __construct($message = '', $code = 0, $previous = null, $parameters = [])
26
+    public function __construct($message = '', $code = 0, $previous = null, $parameters = [ ])
27 27
     {
28 28
         $this->parameters = $parameters;
29 29
 
Please login to merge, or discard this patch.
src/Http/AbstractHttpClient.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@
 block discarded – undo
10 10
     {
11 11
         $response = $this->doRequest($url, $data);
12 12
 
13
-        if (!isset($response['ok']) || !$response['ok']) {
14
-            throw new Exception($response['description'], $response['error_code']);
13
+        if (!isset($response[ 'ok' ]) || !$response[ 'ok' ]) {
14
+            throw new Exception($response[ 'description' ], $response[ 'error_code' ]);
15 15
         }
16 16
 
17
-        return $response['result'];
17
+        return $response[ 'result' ];
18 18
     }
19 19
 
20 20
     public function download($url)
Please login to merge, or discard this patch.
src/Events/EventCollection.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function __construct($trackerToken = null)
32 32
     {
33
-        $this->events = [];
33
+        $this->events = [ ];
34 34
         if ($trackerToken) {
35 35
             @trigger_error(sprintf('Passing $trackerToken to %s is deprecated', self::class), \E_USER_DEPRECATED);
36 36
             $this->tracker = new Botan($trackerToken);
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function add(Closure $event, $checker = null)
49 49
     {
50
-        $this->events[] = !is_null($checker) ? new Event($event, $checker)
51
-            : new Event($event, function () {});
50
+        $this->events[ ] = !is_null($checker) ? new Event($event, $checker)
51
+            : new Event($event, function() {});
52 52
 
53 53
         return $this;
54 54
     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 if ($event->executeAction($update) === false) {
65 65
                     if ($this->tracker && ($message = $update->getMessage())) {
66 66
                         $checker = new ReflectionFunction($event->getChecker());
67
-                        $this->tracker->track($message, $checker->getStaticVariables()['name']);
67
+                        $this->tracker->track($message, $checker->getStaticVariables()[ 'name' ]);
68 68
                     }
69 69
                     break;
70 70
                 }
Please login to merge, or discard this patch.
src/Http/CurlHttpClient.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         // Informational 1xx
17 17
         100 => 'Continue',
18 18
         101 => 'Switching Protocols',
19
-        102 => 'Processing',            // RFC2518
19
+        102 => 'Processing', // RFC2518
20 20
         // Success 2xx
21 21
         200 => 'OK',
22 22
         201 => 'Created',
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
         204 => 'No Content',
26 26
         205 => 'Reset Content',
27 27
         206 => 'Partial Content',
28
-        207 => 'Multi-Status',          // RFC4918
29
-        208 => 'Already Reported',      // RFC5842
30
-        226 => 'IM Used',               // RFC3229
28
+        207 => 'Multi-Status', // RFC4918
29
+        208 => 'Already Reported', // RFC5842
30
+        226 => 'IM Used', // RFC3229
31 31
         // Redirection 3xx
32 32
         300 => 'Multiple Choices',
33 33
         301 => 'Moved Permanently',
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         305 => 'Use Proxy',
38 38
         // 306 is deprecated but reserved
39 39
         307 => 'Temporary Redirect',
40
-        308 => 'Permanent Redirect',    // RFC7238
40
+        308 => 'Permanent Redirect', // RFC7238
41 41
         // Client Error 4xx
42 42
         400 => 'Bad Request',
43 43
         401 => 'Unauthorized',
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
         415 => 'Unsupported Media Type',
58 58
         416 => 'Range Not Satisfiable',
59 59
         417 => 'Expectation Failed',
60
-        422 => 'Unprocessable Entity',                                        // RFC4918
61
-        423 => 'Locked',                                                      // RFC4918
62
-        424 => 'Failed Dependency',                                           // RFC4918
63
-        425 => 'Reserved for WebDAV advanced collections expired proposal',   // RFC2817
64
-        426 => 'Upgrade Required',                                            // RFC2817
65
-        428 => 'Precondition Required',                                       // RFC6585
66
-        429 => 'Too Many Requests',                                           // RFC6585
67
-        431 => 'Request Header Fields Too Large',                             // RFC6585
60
+        422 => 'Unprocessable Entity', // RFC4918
61
+        423 => 'Locked', // RFC4918
62
+        424 => 'Failed Dependency', // RFC4918
63
+        425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
64
+        426 => 'Upgrade Required', // RFC2817
65
+        428 => 'Precondition Required', // RFC6585
66
+        429 => 'Too Many Requests', // RFC6585
67
+        431 => 'Request Header Fields Too Large', // RFC6585
68 68
         // Server Error 5xx
69 69
         500 => 'Internal Server Error',
70 70
         501 => 'Not Implemented',
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
         503 => 'Service Unavailable',
73 73
         504 => 'Gateway Timeout',
74 74
         505 => 'HTTP Version Not Supported',
75
-        506 => 'Variant Also Negotiates (Experimental)',                      // RFC2295
76
-        507 => 'Insufficient Storage',                                        // RFC4918
77
-        508 => 'Loop Detected',                                               // RFC5842
78
-        510 => 'Not Extended',                                                // RFC2774
79
-        511 => 'Network Authentication Required',                             // RFC6585
75
+        506 => 'Variant Also Negotiates (Experimental)', // RFC2295
76
+        507 => 'Insufficient Storage', // RFC4918
77
+        508 => 'Loop Detected', // RFC5842
78
+        510 => 'Not Extended', // RFC2774
79
+        511 => 'Network Authentication Required', // RFC6585
80 80
     ];
81 81
 
82 82
     /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     private $options;
103 103
 
104
-    public function __construct(array $options = [])
104
+    public function __construct(array $options = [ ])
105 105
     {
106 106
         $this->curl = curl_init();
107 107
         $this->options = $options;
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
         ];
119 119
 
120 120
         if ($data) {
121
-            $options[CURLOPT_POST] = true;
122
-            $options[CURLOPT_POSTFIELDS] = $data;
121
+            $options[ CURLOPT_POST ] = true;
122
+            $options[ CURLOPT_POSTFIELDS ] = $data;
123 123
         }
124 124
 
125 125
         return self::jsonValidate($this->execute($options));
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
      */
186 186
     private static function curlValidate($curl, $response = null)
187 187
     {
188
-        $json = json_decode((string) $response, true) ?: [];
188
+        $json = json_decode((string) $response, true) ?: [ ];
189 189
 
190 190
         if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE))
191
-            && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE])
191
+            && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ])
192 192
         ) {
193
-            $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode];
194
-            $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : [];
193
+            $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ];
194
+            $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ];
195 195
 
196 196
             throw new HttpException($errorDescription, $httpCode, null, $errorParameters);
197 197
         }
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
     public function setProxy($proxyString = '', $socks5 = false)
208 208
     {
209 209
         if (empty($proxyString)) {
210
-            unset($this->options[CURLOPT_PROXY], $this->options[CURLOPT_HTTPPROXYTUNNEL], $this->options[CURLOPT_PROXYTYPE]);
210
+            unset($this->options[ CURLOPT_PROXY ], $this->options[ CURLOPT_HTTPPROXYTUNNEL ], $this->options[ CURLOPT_PROXYTYPE ]);
211 211
 
212 212
             return;
213 213
         }
214 214
 
215
-        $this->options[CURLOPT_PROXY] = $proxyString;
216
-        $this->options[CURLOPT_HTTPPROXYTUNNEL] = true;
215
+        $this->options[ CURLOPT_PROXY ] = $proxyString;
216
+        $this->options[ CURLOPT_HTTPPROXYTUNNEL ] = true;
217 217
 
218 218
         if ($socks5) {
219
-            $this->options[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5;
219
+            $this->options[ CURLOPT_PROXYTYPE ] = CURLPROXY_SOCKS5;
220 220
         }
221 221
     }
222 222
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function setOption($option, $value)
229 229
     {
230
-        $this->options[$option] = $value;
230
+        $this->options[ $option ] = $value;
231 231
     }
232 232
 
233 233
     /**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function unsetOption($option)
238 238
     {
239
-        unset($this->options[$option]);
239
+        unset($this->options[ $option ]);
240 240
     }
241 241
 
242 242
     /**
@@ -244,6 +244,6 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function resetOptions()
246 246
     {
247
-        $this->options = [];
247
+        $this->options = [ ];
248 248
     }
249 249
 }
Please login to merge, or discard this patch.
src/Http/PsrHttpClient.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,9 +87,9 @@
 block discarded – undo
87 87
 
88 88
         $json = self::jsonValidate($content);
89 89
 
90
-        if (!\in_array($response->getStatusCode(), [200, 304])) {
91
-            $errorDescription = array_key_exists('description', $json) ? $json['description'] : $response->getReasonPhrase();
92
-            $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : [];
90
+        if (!\in_array($response->getStatusCode(), [ 200, 304 ])) {
91
+            $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : $response->getReasonPhrase();
92
+            $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ];
93 93
 
94 94
             throw new HttpException($errorDescription, $response->getStatusCode(), null, $errorParameters);
95 95
         }
Please login to merge, or discard this patch.