Skip to content

Commit c449ca5

Browse files
committed
Use more standardized phpcs
1 parent a043071 commit c449ca5

File tree

493 files changed

+1124
-3911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

493 files changed

+1124
-3911
lines changed

.php_cs

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,43 @@
11
<?php
22

3-
$finder = PhpCsFixer\Finder::create()
4-
->in([
5-
'app',
6-
'bootstrap',
7-
'config',
8-
'database',
9-
'resources/lang',
10-
'routes',
11-
'tests',
12-
]);
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$finder = (new Finder)->in([
7+
'app',
8+
'bootstrap',
9+
'config',
10+
'database',
11+
'resources/lang',
12+
'routes',
13+
'tests',
14+
]);
1315

14-
return PhpCsFixer\Config::create()
16+
return (new Config)
17+
->setRiskyAllowed(true)
18+
->setFinder($finder)
1519
->setRules([
1620
'@Symfony' => true,
1721
'@PSR1' => true,
1822
'@PSR2' => true,
23+
'@PSR12' => true,
1924
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
20-
'array_syntax' => ['syntax' => 'short'],
21-
'blank_line_before_return' => true,
22-
'blank_line_before_statement' => false,
2325
'combine_consecutive_unsets' => true,
2426
'concat_space' => ['spacing' => 'one'],
25-
'declare_equal_normalize' => ['space' => 'single'],
2627
'heredoc_to_nowdoc' => true,
27-
'increment_style' => ['style' => 'post'],
28-
'linebreak_after_opening_tag' => true,
29-
'method_argument_space' => [
30-
'ensure_fully_multiline' => false,
31-
'keep_multiple_spaces_after_comma' => false,
32-
],
33-
'new_with_braces' => false,
3428
'no_alias_functions' => true,
35-
'no_multiline_whitespace_before_semicolons' => true,
36-
'no_superfluous_phpdoc_tags' => false,
3729
'no_unreachable_default_argument_value' => true,
3830
'no_useless_return' => true,
39-
'not_operator_with_successor_space' => true,
4031
'ordered_imports' => [
4132
'sortAlgorithm' => 'length',
4233
],
43-
'phpdoc_align' => false,
44-
'phpdoc_separation' => false,
45-
'protected_to_private' => false,
4634
'psr0' => ['dir' => 'app'],
4735
'psr4' => true,
4836
'random_api_migration' => true,
49-
'single_line_throw' => false,
50-
'single_trait_insert_per_statement' => false,
51-
'standardize_not_equals' => true,
5237
'ternary_to_null_coalescing' => true,
5338
'yoda_style' => [
5439
'equal' => false,
5540
'identical' => false,
5641
'less_and_greater' => false,
5742
],
58-
])->setRiskyAllowed(true)->setFinder($finder);
43+
]);

app/Console/Commands/Environment/AppSettingsCommand.php

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ class AppSettingsCommand extends Command
1919
{
2020
use EnvironmentWriterTrait;
2121

22-
const ALLOWED_CACHE_DRIVERS = [
22+
public const ALLOWED_CACHE_DRIVERS = [
2323
'redis' => 'Redis (recommended)',
2424
'memcached' => 'Memcached',
2525
'file' => 'Filesystem',
2626
];
2727

28-
const ALLOWED_SESSION_DRIVERS = [
28+
public const ALLOWED_SESSION_DRIVERS = [
2929
'redis' => 'Redis (recommended)',
3030
'memcached' => 'Memcached',
3131
'database' => 'MySQL Database',
3232
'file' => 'Filesystem',
3333
'cookie' => 'Cookie',
3434
];
3535

36-
const ALLOWED_QUEUE_DRIVERS = [
36+
public const ALLOWED_QUEUE_DRIVERS = [
3737
'redis' => 'Redis (recommended)',
3838
'database' => 'MySQL Database',
3939
'sync' => 'Sync',
@@ -77,9 +77,6 @@ class AppSettingsCommand extends Command
7777

7878
/**
7979
* AppSettingsCommand constructor.
80-
*
81-
* @param \Illuminate\Contracts\Config\Repository $config
82-
* @param \Illuminate\Contracts\Console\Kernel $command
8380
*/
8481
public function __construct(ConfigRepository $config, Kernel $command)
8582
{
@@ -102,43 +99,45 @@ public function handle()
10299

103100
$this->output->comment(trans('command/messages.environment.app.author_help'));
104101
$this->variables['APP_SERVICE_AUTHOR'] = $this->option('author') ?? $this->ask(
105-
trans('command/messages.environment.app.author'), $this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
106-
);
102+
trans('command/messages.environment.app.author'),
103+
$this->config->get('pterodactyl.service.author', 'unknown@unknown.com')
104+
);
107105

108106
$this->output->comment(trans('command/messages.environment.app.app_url_help'));
109107
$this->variables['APP_URL'] = $this->option('url') ?? $this->ask(
110-
trans('command/messages.environment.app.app_url'), $this->config->get('app.url', 'http://example.org')
111-
);
108+
trans('command/messages.environment.app.app_url'),
109+
$this->config->get('app.url', 'http://example.org')
110+
);
112111

113112
$this->output->comment(trans('command/messages.environment.app.timezone_help'));
114113
$this->variables['APP_TIMEZONE'] = $this->option('timezone') ?? $this->anticipate(
115-
trans('command/messages.environment.app.timezone'),
116-
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
117-
$this->config->get('app.timezone')
118-
);
114+
trans('command/messages.environment.app.timezone'),
115+
DateTimeZone::listIdentifiers(DateTimeZone::ALL),
116+
$this->config->get('app.timezone')
117+
);
119118

120119
$selected = $this->config->get('cache.default', 'redis');
121120
$this->variables['CACHE_DRIVER'] = $this->option('cache') ?? $this->choice(
122-
trans('command/messages.environment.app.cache_driver'),
123-
self::ALLOWED_CACHE_DRIVERS,
124-
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
125-
);
121+
trans('command/messages.environment.app.cache_driver'),
122+
self::ALLOWED_CACHE_DRIVERS,
123+
array_key_exists($selected, self::ALLOWED_CACHE_DRIVERS) ? $selected : null
124+
);
126125

127126
$selected = $this->config->get('session.driver', 'redis');
128127
$this->variables['SESSION_DRIVER'] = $this->option('session') ?? $this->choice(
129-
trans('command/messages.environment.app.session_driver'),
130-
self::ALLOWED_SESSION_DRIVERS,
131-
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
132-
);
128+
trans('command/messages.environment.app.session_driver'),
129+
self::ALLOWED_SESSION_DRIVERS,
130+
array_key_exists($selected, self::ALLOWED_SESSION_DRIVERS) ? $selected : null
131+
);
133132

134133
$selected = $this->config->get('queue.default', 'redis');
135134
$this->variables['QUEUE_CONNECTION'] = $this->option('queue') ?? $this->choice(
136-
trans('command/messages.environment.app.queue_driver'),
137-
self::ALLOWED_QUEUE_DRIVERS,
138-
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
139-
);
135+
trans('command/messages.environment.app.queue_driver'),
136+
self::ALLOWED_QUEUE_DRIVERS,
137+
array_key_exists($selected, self::ALLOWED_QUEUE_DRIVERS) ? $selected : null
138+
);
140139

141-
if (! is_null($this->option('settings-ui'))) {
140+
if (!is_null($this->option('settings-ui'))) {
142141
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->option('settings-ui') == 'true' ? 'false' : 'true';
143142
} else {
144143
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true';
@@ -171,28 +170,30 @@ private function checkForRedis()
171170

172171
$this->output->note(trans('command/messages.environment.app.using_redis'));
173172
$this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
174-
trans('command/messages.environment.app.redis_host'), $this->config->get('database.redis.default.host')
175-
);
173+
trans('command/messages.environment.app.redis_host'),
174+
$this->config->get('database.redis.default.host')
175+
);
176176

177177
$askForRedisPassword = true;
178-
if (! empty($this->config->get('database.redis.default.password'))) {
178+
if (!empty($this->config->get('database.redis.default.password'))) {
179179
$this->variables['REDIS_PASSWORD'] = $this->config->get('database.redis.default.password');
180180
$askForRedisPassword = $this->confirm(trans('command/messages.environment.app.redis_pass_defined'));
181181
}
182182

183183
if ($askForRedisPassword) {
184184
$this->output->comment(trans('command/messages.environment.app.redis_pass_help'));
185185
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
186-
trans('command/messages.environment.app.redis_password')
187-
);
186+
trans('command/messages.environment.app.redis_password')
187+
);
188188
}
189189

190190
if (empty($this->variables['REDIS_PASSWORD'])) {
191191
$this->variables['REDIS_PASSWORD'] = 'null';
192192
}
193193

194194
$this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask(
195-
trans('command/messages.environment.app.redis_port'), $this->config->get('database.redis.default.port')
196-
);
195+
trans('command/messages.environment.app.redis_port'),
196+
$this->config->get('database.redis.default.port')
197+
);
197198
}
198199
}

app/Console/Commands/Environment/DatabaseSettingsCommand.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ class DatabaseSettingsCommand extends Command
5757

5858
/**
5959
* DatabaseSettingsCommand constructor.
60-
*
61-
* @param \Illuminate\Contracts\Config\Repository $config
62-
* @param \Illuminate\Database\DatabaseManager $database
63-
* @param \Illuminate\Contracts\Console\Kernel $console
6460
*/
6561
public function __construct(ConfigRepository $config, DatabaseManager $database, Kernel $console)
6662
{
@@ -82,24 +78,28 @@ public function handle()
8278
{
8379
$this->output->note(trans('command/messages.environment.database.host_warning'));
8480
$this->variables['DB_HOST'] = $this->option('host') ?? $this->ask(
85-
trans('command/messages.environment.database.host'), $this->config->get('database.connections.mysql.host', '127.0.0.1')
86-
);
81+
trans('command/messages.environment.database.host'),
82+
$this->config->get('database.connections.mysql.host', '127.0.0.1')
83+
);
8784

8885
$this->variables['DB_PORT'] = $this->option('port') ?? $this->ask(
89-
trans('command/messages.environment.database.port'), $this->config->get('database.connections.mysql.port', 3306)
90-
);
86+
trans('command/messages.environment.database.port'),
87+
$this->config->get('database.connections.mysql.port', 3306)
88+
);
9189

9290
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
93-
trans('command/messages.environment.database.database'), $this->config->get('database.connections.mysql.database', 'panel')
94-
);
91+
trans('command/messages.environment.database.database'),
92+
$this->config->get('database.connections.mysql.database', 'panel')
93+
);
9594

9695
$this->output->note(trans('command/messages.environment.database.username_warning'));
9796
$this->variables['DB_USERNAME'] = $this->option('username') ?? $this->ask(
98-
trans('command/messages.environment.database.username'), $this->config->get('database.connections.mysql.username', 'pterodactyl')
99-
);
97+
trans('command/messages.environment.database.username'),
98+
$this->config->get('database.connections.mysql.username', 'pterodactyl')
99+
);
100100

101101
$askForMySQLPassword = true;
102-
if (! empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
102+
if (!empty($this->config->get('database.connections.mysql.password')) && $this->input->isInteractive()) {
103103
$this->variables['DB_PASSWORD'] = $this->config->get('database.connections.mysql.password');
104104
$askForMySQLPassword = $this->confirm(trans('command/messages.environment.database.password_defined'));
105105
}

app/Console/Commands/Environment/EmailSettingsCommand.php

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class EmailSettingsCommand extends Command
4747

4848
/**
4949
* EmailSettingsCommand constructor.
50-
*
51-
* @param \Illuminate\Contracts\Config\Repository $config
5250
*/
5351
public function __construct(ConfigRepository $config)
5452
{
@@ -65,13 +63,15 @@ public function __construct(ConfigRepository $config)
6563
public function handle()
6664
{
6765
$this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice(
68-
trans('command/messages.environment.mail.ask_driver'), [
66+
trans('command/messages.environment.mail.ask_driver'),
67+
[
6968
'smtp' => 'SMTP Server',
7069
'mail' => 'PHP\'s Internal Mail Function',
7170
'mailgun' => 'Mailgun Transactional Email',
7271
'mandrill' => 'Mandrill Transactional Email',
7372
'postmark' => 'Postmarkapp Transactional Email',
74-
], $this->config->get('mail.driver', 'smtp')
73+
],
74+
$this->config->get('mail.driver', 'smtp')
7575
);
7676

7777
$method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables';
@@ -80,16 +80,20 @@ public function handle()
8080
}
8181

8282
$this->variables['MAIL_FROM'] = $this->option('email') ?? $this->ask(
83-
trans('command/messages.environment.mail.ask_mail_from'), $this->config->get('mail.from.address')
84-
);
83+
trans('command/messages.environment.mail.ask_mail_from'),
84+
$this->config->get('mail.from.address')
85+
);
8586

8687
$this->variables['MAIL_FROM_NAME'] = $this->option('from') ?? $this->ask(
87-
trans('command/messages.environment.mail.ask_mail_name'), $this->config->get('mail.from.name')
88-
);
88+
trans('command/messages.environment.mail.ask_mail_name'),
89+
$this->config->get('mail.from.name')
90+
);
8991

9092
$this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice(
91-
trans('command/messages.environment.mail.ask_encryption'), ['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'], $this->config->get('mail.encryption', 'tls')
92-
);
93+
trans('command/messages.environment.mail.ask_encryption'),
94+
['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'],
95+
$this->config->get('mail.encryption', 'tls')
96+
);
9397

9498
$this->writeToEnvironment($this->variables);
9599

@@ -103,20 +107,23 @@ public function handle()
103107
private function setupSmtpDriverVariables()
104108
{
105109
$this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask(
106-
trans('command/messages.environment.mail.ask_smtp_host'), $this->config->get('mail.host')
107-
);
110+
trans('command/messages.environment.mail.ask_smtp_host'),
111+
$this->config->get('mail.host')
112+
);
108113

109114
$this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask(
110-
trans('command/messages.environment.mail.ask_smtp_port'), $this->config->get('mail.port')
111-
);
115+
trans('command/messages.environment.mail.ask_smtp_port'),
116+
$this->config->get('mail.port')
117+
);
112118

113119
$this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask(
114-
trans('command/messages.environment.mail.ask_smtp_username'), $this->config->get('mail.username')
115-
);
120+
trans('command/messages.environment.mail.ask_smtp_username'),
121+
$this->config->get('mail.username')
122+
);
116123

117124
$this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret(
118-
trans('command/messages.environment.mail.ask_smtp_password')
119-
);
125+
trans('command/messages.environment.mail.ask_smtp_password')
126+
);
120127
}
121128

122129
/**
@@ -125,12 +132,14 @@ private function setupSmtpDriverVariables()
125132
private function setupMailgunDriverVariables()
126133
{
127134
$this->variables['MAILGUN_DOMAIN'] = $this->option('host') ?? $this->ask(
128-
trans('command/messages.environment.mail.ask_mailgun_domain'), $this->config->get('services.mailgun.domain')
129-
);
135+
trans('command/messages.environment.mail.ask_mailgun_domain'),
136+
$this->config->get('services.mailgun.domain')
137+
);
130138

131139
$this->variables['MAILGUN_SECRET'] = $this->option('password') ?? $this->ask(
132-
trans('command/messages.environment.mail.ask_mailgun_secret'), $this->config->get('services.mailgun.secret')
133-
);
140+
trans('command/messages.environment.mail.ask_mailgun_secret'),
141+
$this->config->get('services.mailgun.secret')
142+
);
134143
}
135144

136145
/**
@@ -139,8 +148,9 @@ private function setupMailgunDriverVariables()
139148
private function setupMandrillDriverVariables()
140149
{
141150
$this->variables['MANDRILL_SECRET'] = $this->option('password') ?? $this->ask(
142-
trans('command/messages.environment.mail.ask_mandrill_secret'), $this->config->get('services.mandrill.secret')
143-
);
151+
trans('command/messages.environment.mail.ask_mandrill_secret'),
152+
$this->config->get('services.mandrill.secret')
153+
);
144154
}
145155

146156
/**
@@ -152,7 +162,8 @@ private function setupPostmarkDriverVariables()
152162
$this->variables['MAIL_HOST'] = 'smtp.postmarkapp.com';
153163
$this->variables['MAIL_PORT'] = 587;
154164
$this->variables['MAIL_USERNAME'] = $this->variables['MAIL_PASSWORD'] = $this->option('username') ?? $this->ask(
155-
trans('command/messages.environment.mail.ask_postmark_username'), $this->config->get('mail.username')
156-
);
165+
trans('command/messages.environment.mail.ask_postmark_username'),
166+
$this->config->get('mail.username')
167+
);
157168
}
158169
}

0 commit comments

Comments
 (0)