Skip to content

Commit

Permalink
Run cs-fix, ensure we only install dependency versions supporting 7.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed May 4, 2022
1 parent 3e55a79 commit 34ffaeb
Show file tree
Hide file tree
Showing 16 changed files with 154 additions and 290 deletions.
11 changes: 1 addition & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,17 @@ node_modules
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
.php_cs.cache
.yarn
public/assets/manifest.json

# For local development with docker
# Remove if we ever put the Dockerfile in the repo
.dockerignore
#Dockerfile
docker-compose.yml

# for image related files
misc
.phpstorm.meta.php
.php_cs.cache

.php-cs-fixer.cache
coverage.xml

# Vagrant
*.log
resources/lang/locales.js
resources/assets/pterodactyl/scripts/helpers/ziggy.js
resources/assets/scripts/helpers/ziggy.js
.phpunit.result.cache
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'no_unreachable_default_argument_value' => true,
'no_useless_return' => true,
'ordered_imports' => [
'sortAlgorithm' => 'length',
'sort_algorithm' => 'length',
],
'phpdoc_align' => [
'align' => 'left',
Expand Down
1 change: 1 addition & 0 deletions app/Console/Commands/Environment/AppSettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public function handle()
foreach ($validator->errors()->all() as $error) {
$this->output->error($error);
}

return 1;
}

Expand Down
10 changes: 7 additions & 3 deletions app/Console/Commands/Node/MakeNodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class MakeNodeCommand extends Command
*/
protected $description = 'Creates a new node on the system via the CLI.';


/**
* Handle the command execution process.
*
Expand All @@ -62,13 +61,18 @@ public function handle(NodeCreationService $creationService)
$data['fqdn'] = $this->option('fqdn') ?? $this->ask('Enter a domain name (e.g node.example.com) to be used for connecting to the daemon. An IP address may only be used if you are not using SSL for this node');
if (!filter_var(gethostbyname($data['fqdn']), FILTER_VALIDATE_IP)) {
$this->error('The FQDN or IP address provided does not resolve to a valid IP address.');

return;
}
$data['public'] = $this->option('public') ?? $this->confirm('Should this node be public? As a note, setting a node to private you will be denying the ability to auto-deploy to this node.', true);
$data['scheme'] = $this->option('scheme') ?? $this->anticipate('Please either enter https for SSL or http for a non-ssl connection',
["https","http",],"https");
$data['scheme'] = $this->option('scheme') ?? $this->anticipate(
'Please either enter https for SSL or http for a non-ssl connection',
['https', 'http'],
'https'
);
if (filter_var($data['fqdn'], FILTER_VALIDATE_IP) && $data['scheme'] === 'https') {
$this->error('A fully qualified domain name that resolves to a public IP address is required in order to use SSL for this node.');

return;
}
$data['behind_proxy'] = $this->option('proxy') ?? $this->confirm('Is your FQDN behind a proxy?');
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Schedule/ProcessRunnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function processSchedule(Schedule $schedule)
'schedule' => $schedule->name,
'hash' => $schedule->hashid,
]));
} catch (Throwable | Exception $exception) {
} catch (Throwable|Exception $exception) {
Log::error($exception, ['schedule_id' => $schedule->id]);

$this->error("An error was encountered while processing Schedule #{$schedule->id}: " . $exception->getMessage());
Expand Down
1 change: 1 addition & 0 deletions app/Console/Commands/UpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function handle()

if (!$this->confirm('Are you sure you want to run the upgrade process for your Panel?')) {
$this->warn('Upgrade process terminated by user.');

return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ public function failure(string $uuid)
/**
* The daemon notifies us about a transfer success.
*
* @return \Illuminate\Http\JsonResponse
*
* @throws \Throwable
*/
public function success(string $uuid): JsonResponse
Expand Down
3 changes: 0 additions & 3 deletions app/Http/Controllers/Auth/AbstractLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ protected function sendLoginResponse(User $user, Request $request): JsonResponse

/**
* Determine if the user is logging in using an email or username,.
*
* @param string|null $input
* @return string
*/
protected function getField(string $input = null): string
{
Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/Auth/LoginCheckpointController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Pterodactyl\Http\Controllers\Auth;

use Carbon\CarbonInterface;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Pterodactyl\Models\User;
use Illuminate\Http\JsonResponse;
use PragmaRX\Google2FA\Google2FA;
Expand Down Expand Up @@ -110,9 +110,6 @@ protected function isValidRecoveryToken(User $user, string $value)
* Determines if the data provided from the session is valid or not. This
* will return false if the data is invalid, or if more time has passed than
* was configured when the session was written.
*
* @param array $data
* @return bool
*/
protected function hasValidSessionData(array $data): bool
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class VerifyCsrfToken extends BaseVerifier
* to using Sanctum for the API endpoints, which handles that for us automatically.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*
* @throws \Illuminate\Session\TokenMismatchException
Expand Down
4 changes: 1 addition & 3 deletions app/Services/Servers/BuildModificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class BuildModificationService
* BuildModificationService constructor.
*
* @param \Pterodactyl\Services\Servers\ServerConfigurationStructureService $structureService
* @param \Illuminate\Database\ConnectionInterface $connection
* @param \Pterodactyl\Repositories\Wings\DaemonServerRepository $daemonServerRepository
*/
public function __construct(
ServerConfigurationStructureService $structureService,
Expand All @@ -57,7 +55,7 @@ public function __construct(
public function handle(Server $server, array $data)
{
/** @var \Pterodactyl\Models\Server $server */
$server = $this->connection->transaction(function() use ($server, $data) {
$server = $this->connection->transaction(function () use ($server, $data) {
$this->processAllocations($server, $data);

if (isset($data['allocation_id']) && $data['allocation_id'] != $server->allocation_id) {
Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"barryvdh/laravel-ide-helper": "^2.12",
"facade/ignition": "^2.17",
"fakerphp/faker": "^1.19",
"friendsofphp/php-cs-fixer": "^2.19",
"friendsofphp/php-cs-fixer": "^3.8",
"laravel/dusk": "^6.23",
"mockery/mockery": "^1.5",
"nunomaduro/collision": "^5.11",
Expand All @@ -70,7 +70,8 @@
}
},
"scripts": {
"php-cs-fixer": "php-cs-fixer fix --diff --diff-format=udiff --config=./.php_cs.dist",
"cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff --verbose",
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
Expand All @@ -84,6 +85,9 @@
},
"prefer-stable": true,
"config": {
"platform": {
"php": "7.4.0"
},
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": false
Expand Down
Loading

0 comments on commit 34ffaeb

Please sign in to comment.