Skip to content

Commit a264791

Browse files
authored
Update PHP and JS dependencies to latest versions and modernize codebase (#5446)
1 parent 9b703fb commit a264791

119 files changed

Lines changed: 6992 additions & 6569 deletions

File tree

Some content is hidden

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

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ module.exports = {
4747
'@typescript-eslint/no-use-before-define': 'warn',
4848
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
4949
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
50+
'react/no-unknown-property': ['error', { ignore: ['css'] }],
5051
},
5152
};

.github/workflows/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
node-version: [16]
22+
node-version: [22]
2323
steps:
2424
- name: Code Checkout
2525
uses: actions/checkout@v4
@@ -32,6 +32,6 @@ jobs:
3232

3333
- name: Install dependencies
3434
run: yarn install --frozen-lockfile
35-
36-
- name: Build
37-
run: yarn build:production
35+
- run: yarn tsc
36+
- run: yarn lint
37+
- run: yarn build:production

.github/workflows/release.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ jobs:
1818
- name: Setup Node
1919
uses: actions/setup-node@v4
2020
with:
21-
node-version: 16
21+
node-version: 22
2222
cache: yarn
2323

2424
- name: Install dependencies
2525
run: yarn install --frozen-lockfile
2626

27+
- run: yarn tsc
28+
- run: yarn lint
2729
- name: Build
2830
run: yarn build:production
2931

.php-cs-fixer.dist.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
66

77
$finder = (new Finder())
8-
->in(__DIR__)
9-
->exclude([
10-
'vendor',
11-
'node_modules',
12-
'storage',
13-
'bootstrap/cache',
14-
])
15-
->notName(['_ide_helper*']);
8+
->name('*.php')
9+
->ignoreVCSIgnored(true)
10+
->exclude([__DIR__ . '/bootstrap/cache'])
11+
->in([
12+
__DIR__ . '/app',
13+
__DIR__ . '/bootstrap',
14+
__DIR__ . '/config',
15+
__DIR__ . '/database',
16+
__DIR__ . '/routes',
17+
__DIR__ . '/tests',
18+
]);
1619

1720
return (new Config())
18-
->setParallelConfig(ParallelConfigFactory::detect())
19-
->setRiskyAllowed(true)
2021
->setFinder($finder)
22+
->setUsingCache(true)
23+
->setParallelConfig(ParallelConfigFactory::detect())
2124
->setRules([
2225
'@Symfony' => true,
2326
'@PSR1' => true,
@@ -27,8 +30,8 @@
2730
'combine_consecutive_unsets' => true,
2831
'concat_space' => ['spacing' => 'one'],
2932
'heredoc_to_nowdoc' => true,
30-
'no_alias_functions' => true,
31-
'no_unreachable_default_argument_value' => true,
33+
// 'no_alias_functions' => true,
34+
// 'no_unreachable_default_argument_value' => true,
3235
'no_useless_return' => true,
3336
'ordered_imports' => [
3437
'sort_algorithm' => 'length',
@@ -44,7 +47,7 @@
4447
'var',
4548
],
4649
],
47-
'random_api_migration' => true,
50+
// 'random_api_migration' => true,
4851
'ternary_to_null_coalescing' => true,
4952
'yoda_style' => [
5053
'equal' => false,

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Build the assets that are needed for the frontend. This build stage is then discarded
33
# since we won't need NodeJS anymore in the future. This Docker image ships a final production
44
# level distribution of Pterodactyl.
5-
FROM --platform=$TARGETOS/$TARGETARCH mhart/alpine-node:14
5+
FROM --platform=$TARGETOS/$TARGETARCH node:22-alpine
66
WORKDIR /app
77
COPY . ./
88
RUN yarn install --frozen-lockfile \

app/Console/Commands/Overrides/UpCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public function handle(): int
2121
return 1;
2222
}
2323

24-
return parent::handle() ?? 0;
24+
return parent::handle();
2525
}
2626
}

app/Console/Commands/Schedule/ProcessRunnableCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Pterodactyl\Console\Commands\Schedule;
44

5-
use Exception;
65
use Illuminate\Console\Command;
76
use Pterodactyl\Models\Schedule;
87
use Illuminate\Support\Facades\Log;
@@ -67,7 +66,7 @@ protected function processSchedule(Schedule $schedule)
6766
'schedule' => $schedule->name,
6867
'hash' => $schedule->hashid,
6968
]));
70-
} catch (\Throwable|\Exception $exception) {
69+
} catch (\Throwable $exception) {
7170
Log::error($exception, ['schedule_id' => $schedule->id]);
7271

7372
$this->error("An error was encountered while processing Schedule #$schedule->id: " . $exception->getMessage());

app/Console/Commands/Server/BulkPowerActionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected function getQueryBuilder(array $servers, array $nodes): Builder
9797
$instance->whereIn('id', $servers)->orWhereIn('node_id', $nodes);
9898
} elseif (empty($nodes) && !empty($servers)) {
9999
$instance->whereIn('id', $servers);
100-
} elseif (!empty($nodes) && empty($servers)) {
100+
} elseif (!empty($nodes) && empty($servers)) { // @phpstan-ignore empty.variable
101101
$instance->whereIn('node_id', $nodes);
102102
}
103103

app/Console/Commands/UpgradeCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public function handle()
3939
$this->line($this->getUrl());
4040
}
4141

42-
if (version_compare(PHP_VERSION, '7.4.0') < 0) {
43-
$this->error('Cannot execute self-upgrade process. The minimum required PHP version required is 7.4.0, you have [' . PHP_VERSION . '].');
42+
if (version_compare(PHP_VERSION, '8.2.0', '<')) {
43+
$this->error('Cannot execute self-upgrade process. The minimum required PHP version required is 8.2.0, you have [' . PHP_VERSION . '].');
4444
}
4545

4646
$user = 'www-data';

app/Exceptions/Handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ protected function convertExceptionToArray(\Throwable $e, array $override = []):
235235
*/
236236
public static function isReportable(\Exception $exception): bool
237237
{
238-
return (new static(Container::getInstance()))->shouldReport($exception);
238+
return (new self(Container::getInstance()))->shouldReport($exception);
239239
}
240240

241241
/**
@@ -262,7 +262,7 @@ protected function extractPrevious(\Throwable $e): array
262262
{
263263
$previous = [];
264264
while ($value = $e->getPrevious()) {
265-
if (!$value instanceof \Throwable) {
265+
if (!$value instanceof \Throwable) { // @phpstan-ignore instanceof.alwaysTrue
266266
break;
267267
}
268268
$previous[] = $value;

0 commit comments

Comments
 (0)