Skip to content

Commit ce43936

Browse files
committed
Minor code style fixes, remove unused use definitions, set YAML indentation to 2
1 parent fd813ac commit ce43936

File tree

14 files changed

+69
-70
lines changed

14 files changed

+69
-70
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ charset = utf-8
77
indent_style = space
88
indent_size = 4
99
trim_trailing_whitespace = true
10+
11+
[*.{yml, yaml}]
12+
indent_size = 2

.scrutinizer.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
filter:
2-
paths: [src/*]
2+
paths: [src/*]
33

44
checks:
5-
php:
6-
remove_extra_empty_lines: true
7-
remove_php_closing_tag: true
8-
remove_trailing_whitespace: true
9-
fix_use_statements:
10-
remove_unused: true
11-
preserve_multiple: false
12-
preserve_blanklines: true
13-
order_alphabetically: true
14-
fix_php_opening_tag: true
15-
fix_linefeed: true
16-
fix_line_ending: true
17-
fix_identation_4spaces: true
18-
fix_doc_comments: true
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
1919

2020
tools:
21-
external_code_coverage:
22-
timeout: 120
21+
external_code_coverage:
22+
timeout: 120

phpunit.xml.dist

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
5-
bootstrap="./tests/bootstrap.php"
6-
backupGlobals="false"
7-
backupStaticAttributes="false"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
processIsolation="false"
13-
stopOnError="false"
14-
stopOnFailure="false"
15-
stopOnIncomplete="false"
16-
stopOnSkipped="false"
17-
syntaxCheck="true"
18-
timeoutForLargeTests="60"
19-
timeoutForMediumTests="10"
20-
timeoutForSmallTests="1"
21-
verbose="false"
22-
>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
5+
bootstrap="./tests/bootstrap.php"
6+
backupGlobals="false"
7+
backupStaticAttributes="false"
8+
colors="true"
9+
convertErrorsToExceptions="true"
10+
convertNoticesToExceptions="true"
11+
convertWarningsToExceptions="true"
12+
processIsolation="false"
13+
stopOnError="false"
14+
stopOnFailure="false"
15+
stopOnIncomplete="false"
16+
stopOnSkipped="false"
17+
syntaxCheck="true"
18+
timeoutForLargeTests="60"
19+
timeoutForMediumTests="10"
20+
timeoutForSmallTests="1"
21+
verbose="false"
22+
>
2323
<php>
24-
<ini name="error_reporting" value="-1" />
24+
<ini name="error_reporting" value="-1"/>
2525
<const name="PHPUNIT_TESTSUITE" value="true"/>
2626
<const name="PHPUNIT_DB_HOST" value="127.0.0.1"/>
2727
<const name="PHPUNIT_DB_NAME" value="telegrambot"/>

src/Commands/AdminCommands/DebugCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ class DebugCommand extends AdminCommand
4747
*/
4848
public function execute()
4949
{
50-
$pdo = DB::getPdo();
50+
$pdo = DB::getPdo();
5151
$message = $this->getMessage();
52-
$chat = $message->getChat();
53-
$text = strtolower($message->getText(true));
52+
$chat = $message->getChat();
53+
$text = strtolower($message->getText(true));
5454

5555
$data = ['chat_id' => $chat->getId()];
5656

@@ -80,15 +80,15 @@ public function execute()
8080
$debug_info[] = sprintf('*Maximum PHP script execution time:* `%d seconds`', ini_get('max_execution_time'));
8181

8282
$mysql_version = $pdo ? $pdo->query('SELECT VERSION() AS version')->fetchColumn() : null;
83-
$debug_info[] = sprintf('*MySQL version:* `%s`', $mysql_version ?: 'disabled');
83+
$debug_info[] = sprintf('*MySQL version:* `%s`', $mysql_version ?: 'disabled');
8484

8585
$debug_info[] = sprintf('*Operating System:* `%s`', php_uname());
8686

8787
if (isset($_SERVER['SERVER_SOFTWARE'])) {
8888
$debug_info[] = sprintf('*Web Server:* `%s`', $_SERVER['SERVER_SOFTWARE']);
8989
}
9090
if (function_exists('curl_init')) {
91-
$curlversion = curl_version();
91+
$curlversion = curl_version();
9292
$debug_info[] = sprintf('*curl version:* `%1$s; %2$s`', $curlversion['version'], $curlversion['ssl_version']);
9393
}
9494

@@ -105,8 +105,8 @@ public function execute()
105105
}
106106

107107
$webhook_info_result_str = json_encode($webhook_info_result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
108-
$debug_info[] = $webhook_info_title;
109-
$debug_info[] = sprintf(
108+
$debug_info[] = $webhook_info_title;
109+
$debug_info[] = sprintf(
110110
'```' . PHP_EOL . '%s```',
111111
$webhook_info_result_str
112112
);
@@ -116,7 +116,7 @@ public function execute()
116116
}
117117

118118
$data['parse_mode'] = 'Markdown';
119-
$data['text'] = implode(PHP_EOL, $debug_info);
119+
$data['text'] = implode(PHP_EOL, $debug_info);
120120

121121
return Request::sendMessage($data);
122122
}

src/Commands/SystemCommands/GenericCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
namespace Longman\TelegramBot\Commands\SystemCommands;
1212

1313
use Longman\TelegramBot\Commands\SystemCommand;
14-
use Longman\TelegramBot\Request;
1514

1615
/**
1716
* Generic command

src/Commands/SystemCommands/GenericmessageCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
namespace Longman\TelegramBot\Commands\SystemCommands;
1212

13+
use Longman\TelegramBot\Commands\SystemCommand;
1314
use Longman\TelegramBot\Conversation;
1415
use Longman\TelegramBot\Request;
15-
use Longman\TelegramBot\Commands\SystemCommand;
1616

1717
/**
1818
* Generic message command

src/Commands/SystemCommands/InlinequeryCommand.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
namespace Longman\TelegramBot\Commands\SystemCommands;
1212

1313
use Longman\TelegramBot\Commands\SystemCommand;
14-
use Longman\TelegramBot\Entities\InlineQuery\InlineQueryResultArticle;
15-
use Longman\TelegramBot\Entities\InputMessageContent\InputTextMessageContent;
1614
use Longman\TelegramBot\Request;
1715

1816
/**

src/Commands/SystemCommands/StartCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
namespace Longman\TelegramBot\Commands\SystemCommands;
1212

1313
use Longman\TelegramBot\Commands\SystemCommand;
14-
use Longman\TelegramBot\Request;
1514

1615
/**
1716
* Start command

src/Entities/Keyboard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected function parseButton($button)
179179
protected function validate()
180180
{
181181
$keyboard_type = $this->getKeyboardType();
182-
$keyboard = $this->getProperty($keyboard_type);
182+
$keyboard = $this->getProperty($keyboard_type);
183183

184184
if ($keyboard !== null) {
185185
if (!is_array($keyboard)) {

src/Telegram.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ protected function getCommandFromType($type)
442442
*/
443443
public function processUpdate(Update $update)
444444
{
445-
$this->update = $update;
445+
$this->update = $update;
446446
$this->last_update_id = $update->getUpdateId();
447447

448448
//Load admin commands
@@ -877,7 +877,7 @@ protected function ucfirstUnicode($str, $encoding = 'UTF-8')
877877
/**
878878
* Enable requests limiter
879879
*
880-
* @param array $options
880+
* @param array $options
881881
*
882882
* @return \Longman\TelegramBot\Telegram
883883
* @throws TelegramException
@@ -902,7 +902,7 @@ public function runCommands($commands)
902902
throw new TelegramException('No command(s) provided!');
903903
}
904904

905-
$this->run_commands = true;
905+
$this->run_commands = true;
906906

907907
$result = Request::getMe();
908908

0 commit comments

Comments
 (0)