Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
parent
95e15d2c8a
commit
cbcf62086f
573 changed files with 4387 additions and 9411 deletions
|
@ -8,7 +8,7 @@ trait EnvironmentWriterTrait
|
|||
{
|
||||
/**
|
||||
* Escapes an environment value by looking for any characters that could
|
||||
* reasonablly cause environment parsing issues. Those values are then wrapped
|
||||
* reasonably cause environment parsing issues. Those values are then wrapped
|
||||
* in quotes before being returned.
|
||||
*/
|
||||
public function escapeEnvironmentValue(string $value): string
|
||||
|
@ -25,7 +25,7 @@ trait EnvironmentWriterTrait
|
|||
*
|
||||
* @throws \Pterodactyl\Exceptions\PterodactylException
|
||||
*/
|
||||
public function writeToEnvironment(array $values = [])
|
||||
public function writeToEnvironment(array $values = []): void
|
||||
{
|
||||
$path = base_path('.env');
|
||||
if (!file_exists($path)) {
|
||||
|
|
|
@ -1,30 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Traits\Controllers;
|
||||
|
||||
use Javascript;
|
||||
use JavaScript;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
trait JavascriptInjection
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Http\Request
|
||||
*/
|
||||
private $request;
|
||||
private Request $request;
|
||||
|
||||
/**
|
||||
* Set the request object to use when injecting JS.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequest(Request $request)
|
||||
public function setRequest(Request $request): self
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
|
@ -33,13 +21,9 @@ trait JavascriptInjection
|
|||
|
||||
/**
|
||||
* Injects the exact array passed in, nothing more.
|
||||
*
|
||||
* @param array $args
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function plainInject($args = [])
|
||||
public function plainInject(array $args = []): string
|
||||
{
|
||||
return Javascript::put($args);
|
||||
return JavaScript::put($args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Stan
|
||||
* Date: 26-5-2018
|
||||
* Time: 20:56.
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Traits\Controllers;
|
||||
|
||||
|
@ -17,6 +11,6 @@ trait PlainJavascriptInjection
|
|||
*/
|
||||
public function injectJavascript($data)
|
||||
{
|
||||
Javascript::put($data);
|
||||
JavaScript::put($data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,23 +7,15 @@ use Illuminate\Filesystem\Filesystem;
|
|||
|
||||
trait AvailableLanguages
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
private $filesystem;
|
||||
private ?ISO639 $iso639 = null;
|
||||
|
||||
private ?Filesystem $filesystem = null;
|
||||
|
||||
/**
|
||||
* @var \Matriphe\ISO639\ISO639
|
||||
*/
|
||||
private $iso639;
|
||||
|
||||
/**
|
||||
* Return all of the available languages on the Panel based on those
|
||||
* Return all the available languages on the Panel based on those
|
||||
* that are present in the language folder.
|
||||
*
|
||||
* @param bool $localize
|
||||
*/
|
||||
public function getAvailableLanguages($localize = false): array
|
||||
public function getAvailableLanguages(bool $localize = false): array
|
||||
{
|
||||
return collect($this->getFilesystemInstance()->directories(resource_path('lang')))->mapWithKeys(function ($path) use ($localize) {
|
||||
$code = basename($path);
|
||||
|
|
|
@ -6,17 +6,12 @@ use Pterodactyl\Models\User;
|
|||
|
||||
trait HasUserLevels
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $userLevel = User::USER_LEVEL_USER;
|
||||
private int $userLevel = User::USER_LEVEL_USER;
|
||||
|
||||
/**
|
||||
* Set the access level for running this function.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUserLevel(int $level)
|
||||
public function setUserLevel(int $level): self
|
||||
{
|
||||
$this->userLevel = $level;
|
||||
|
||||
|
|
|
@ -4,15 +4,9 @@ namespace Pterodactyl\Traits\Services;
|
|||
|
||||
trait ReturnsUpdatedModels
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $updatedModel = false;
|
||||
private bool $updatedModel = false;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getUpdatedModel()
|
||||
public function getUpdatedModel(): bool
|
||||
{
|
||||
return $this->updatedModel;
|
||||
}
|
||||
|
@ -21,10 +15,8 @@ trait ReturnsUpdatedModels
|
|||
* If called a fresh model will be returned from the database. This is used
|
||||
* for API calls, but is unnecessary for UI based updates where the page is
|
||||
* being reloaded and a fresh model will be pulled anyways.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function returnUpdatedModel(bool $toggle = true)
|
||||
public function returnUpdatedModel(bool $toggle = true): self
|
||||
{
|
||||
$this->updatedModel = $toggle;
|
||||
|
||||
|
|
|
@ -4,22 +4,20 @@ namespace Pterodactyl\Traits\Services;
|
|||
|
||||
use BadMethodCallException;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Contracts\Validation\Factory;
|
||||
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
|
||||
use Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException;
|
||||
|
||||
trait ValidatesValidationRules
|
||||
{
|
||||
abstract protected function getValidator(): Factory;
|
||||
abstract protected function getValidator(): ValidationFactory;
|
||||
|
||||
/**
|
||||
* Validate that the rules being provided are valid for Laravel and can
|
||||
* be resolved.
|
||||
*
|
||||
* @param array|string $rules
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException
|
||||
*/
|
||||
public function validateRules($rules)
|
||||
public function validateRules(array|string $rules): void
|
||||
{
|
||||
try {
|
||||
$this->getValidator()->make(['__TEST' => 'test'], ['__TEST' => $rules])->fails();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue