Upgrade to Laravel 9 (#4413)

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
Matthew Penner 2022-10-14 10:59:20 -06:00 committed by GitHub
parent 95e15d2c8a
commit cbcf62086f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
573 changed files with 4387 additions and 9411 deletions

View file

@ -9,17 +9,11 @@ use Pterodactyl\Services\Servers\ServerConfigurationStructureService;
class EggConfigurationService
{
/**
* @var \Pterodactyl\Services\Servers\ServerConfigurationStructureService
*/
private $configurationStructureService;
/**
* EggConfigurationService constructor.
*/
public function __construct(ServerConfigurationStructureService $configurationStructureService)
public function __construct(private ServerConfigurationStructureService $configurationStructureService)
{
$this->configurationStructureService = $configurationStructureService;
}
/**
@ -41,10 +35,8 @@ class EggConfigurationService
/**
* Convert the "done" variable into an array if it is not currently one.
*
* @return array
*/
protected function convertStartupToNewFormat(array $startup)
protected function convertStartupToNewFormat(array $startup): array
{
$done = Arr::get($startup, 'done');
@ -85,10 +77,7 @@ class EggConfigurationService
];
}
/**
* @return array
*/
protected function replacePlaceholders(Server $server, object $configs)
protected function replacePlaceholders(Server $server, object $configs): array
{
// Get the legacy configuration structure for the server so that we
// can property map the egg placeholders to values.
@ -161,20 +150,15 @@ class EggConfigurationService
case 'env.SERVER_PORT':
$replace = 'server.build.default.port';
break;
// By default we don't need to change anything, only if we ended up matching a specific legacy item.
default:
// By default, we don't need to change anything, only if we ended up matching a specific legacy item.
$replace = $key;
}
return str_replace("{{{$key}}}", "{{{$replace}}}", $value);
}
/**
* @param mixed $value
*
* @return mixed|null
*/
protected function matchAndReplaceKeys($value, array $structure)
protected function matchAndReplaceKeys(mixed $value, array $structure): mixed
{
preg_match_all('/{{(?<key>[\w.-]*)}}/', $value, $matches);
@ -229,12 +213,8 @@ class EggConfigurationService
* Iterates over a set of "find" values for a given file in the parser configuration. If
* the value of the line match is something iterable, continue iterating, otherwise perform
* a match & replace.
*
* @param mixed $data
*
* @return mixed
*/
private function iterate($data, array $structure)
private function iterate(mixed $data, array $structure): mixed
{
if (!is_iterable($data) && !is_object($data)) {
return $data;