From f82b419d47bf1082d1a3d8a82a9048ba9d3df35a Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 13 May 2018 12:19:35 -0400 Subject: [PATCH 1/4] Update php doc blocks --- .../Controllers/Admin/Nests/EggVariableController.php | 3 ++- app/Http/Controllers/Admin/ServersController.php | 6 ++++-- .../Controllers/Admin/Settings/AdvancedController.php | 2 ++ .../Controllers/Admin/Settings/IndexController.php | 2 ++ .../Controllers/Admin/Settings/MailController.php | 4 +++- app/Models/EggVariable.php | 1 + app/Providers/AuthServiceProvider.php | 1 - app/Repositories/Daemon/CommandRepository.php | 1 + app/Repositories/Daemon/ConfigurationRepository.php | 1 + app/Repositories/Daemon/FileRepository.php | 8 ++++---- app/Repositories/Daemon/PowerRepository.php | 3 ++- app/Repositories/Daemon/ServerRepository.php | 11 +++++++++-- app/Services/Acl/Api/AdminAcl.php | 1 + .../Api/Application/AllocationTransformer.php | 2 ++ .../Api/Application/DatabaseHostTransformer.php | 1 + app/Transformers/Api/Application/EggTransformer.php | 3 +++ app/Transformers/Api/Application/NodeTransformer.php | 3 +++ .../Api/Application/ServerDatabaseTransformer.php | 1 + .../Api/Application/ServerVariableTransformer.php | 1 + 19 files changed, 43 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Admin/Nests/EggVariableController.php b/app/Http/Controllers/Admin/Nests/EggVariableController.php index 8b68743fc..df29de5ae 100644 --- a/app/Http/Controllers/Admin/Nests/EggVariableController.php +++ b/app/Http/Controllers/Admin/Nests/EggVariableController.php @@ -90,10 +90,11 @@ class EggVariableController extends Controller * Handle a request to create a new Egg variable. * * @param \Pterodactyl\Http\Requests\Admin\Egg\EggVariableFormRequest $request - * @param \Pterodactyl\Models\Egg $egg + * @param \Pterodactyl\Models\Egg $egg * * @return \Illuminate\Http\RedirectResponse * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\BadValidationRuleException * @throws \Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException */ public function store(EggVariableFormRequest $request, Egg $egg): RedirectResponse diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 8adff82d4..d2396236e 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -462,6 +462,7 @@ class ServersController extends Controller * * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function rebuildContainer(Server $server) { @@ -536,11 +537,12 @@ class ServersController extends Controller /** * Update the startup command as well as variables. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request * @param \Pterodactyl\Models\Server $server * @return \Illuminate\Http\RedirectResponse * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws \Illuminate\Validation\ValidationException + * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ diff --git a/app/Http/Controllers/Admin/Settings/AdvancedController.php b/app/Http/Controllers/Admin/Settings/AdvancedController.php index f8249acd3..f32517e7a 100644 --- a/app/Http/Controllers/Admin/Settings/AdvancedController.php +++ b/app/Http/Controllers/Admin/Settings/AdvancedController.php @@ -76,6 +76,8 @@ class AdvancedController extends Controller /** * @param \Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest $request * @return \Illuminate\Http\RedirectResponse + * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function update(AdvancedSettingsFormRequest $request): RedirectResponse { diff --git a/app/Http/Controllers/Admin/Settings/IndexController.php b/app/Http/Controllers/Admin/Settings/IndexController.php index 604684da4..bb9aef3e4 100644 --- a/app/Http/Controllers/Admin/Settings/IndexController.php +++ b/app/Http/Controllers/Admin/Settings/IndexController.php @@ -74,6 +74,8 @@ class IndexController extends Controller * * @param \Pterodactyl\Http\Requests\Admin\Settings\BaseSettingsFormRequest $request * @return \Illuminate\Http\RedirectResponse + * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function update(BaseSettingsFormRequest $request): RedirectResponse { diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index 0e5a1d737..f0b4495a4 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -83,7 +83,9 @@ class MailController extends Controller * @param \Pterodactyl\Http\Requests\Admin\Settings\MailSettingsFormRequest $request * @return \Illuminate\Http\RedirectResponse * - * @throws \Pterodactyl\Exceptions\DisplayException + * @throws DisplayException + * @throws \Pterodactyl\Exceptions\Model\DataValidationException + * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function update(MailSettingsFormRequest $request): RedirectResponse { diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index 293b86c4b..bfc9ac64f 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -82,6 +82,7 @@ class EggVariable extends Model implements CleansAttributes, ValidableContract ]; /** + * @param $value * @return bool */ public function getRequiredAttribute($value) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 947750ae8..0a5e3d564 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -18,7 +18,6 @@ class AuthServiceProvider extends ServiceProvider /** * Register any application authentication / authorization services. * - * @param \Illuminate\Contracts\Auth\Access\Gate $gate */ public function boot() { diff --git a/app/Repositories/Daemon/CommandRepository.php b/app/Repositories/Daemon/CommandRepository.php index 7b7577b32..cd123cd89 100644 --- a/app/Repositories/Daemon/CommandRepository.php +++ b/app/Repositories/Daemon/CommandRepository.php @@ -12,6 +12,7 @@ class CommandRepository extends BaseRepository implements CommandRepositoryInter * * @param string $command * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function send(string $command): ResponseInterface { diff --git a/app/Repositories/Daemon/ConfigurationRepository.php b/app/Repositories/Daemon/ConfigurationRepository.php index ff44e3031..3905335a5 100644 --- a/app/Repositories/Daemon/ConfigurationRepository.php +++ b/app/Repositories/Daemon/ConfigurationRepository.php @@ -12,6 +12,7 @@ class ConfigurationRepository extends BaseRepository implements ConfigurationRep * * @param array $overrides * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function update(array $overrides = []): ResponseInterface { diff --git a/app/Repositories/Daemon/FileRepository.php b/app/Repositories/Daemon/FileRepository.php index 8350e402f..3c9d80581 100644 --- a/app/Repositories/Daemon/FileRepository.php +++ b/app/Repositories/Daemon/FileRepository.php @@ -14,7 +14,7 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface * @param string $path * @return \stdClass * - * @throws \GuzzleHttp\Exception\RequestException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function getFileStat(string $path): stdClass { @@ -35,7 +35,7 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface * @param string $path * @return string * - * @throws \GuzzleHttp\Exception\RequestException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function getContent(string $path): string { @@ -57,7 +57,7 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface * @param string $content * @return \Psr\Http\Message\ResponseInterface * - * @throws \GuzzleHttp\Exception\RequestException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function putContent(string $path, string $content): ResponseInterface { @@ -78,7 +78,7 @@ class FileRepository extends BaseRepository implements FileRepositoryInterface * @param string $path * @return array * - * @throws \GuzzleHttp\Exception\RequestException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function getDirectory(string $path): array { diff --git a/app/Repositories/Daemon/PowerRepository.php b/app/Repositories/Daemon/PowerRepository.php index 20fc79338..d7ce8d5e5 100644 --- a/app/Repositories/Daemon/PowerRepository.php +++ b/app/Repositories/Daemon/PowerRepository.php @@ -14,7 +14,8 @@ class PowerRepository extends BaseRepository implements PowerRepositoryInterface * @param string $signal * @return \Psr\Http\Message\ResponseInterface * - * @throws \Pterodactyl\Exceptions\Repository\Daemon\InvalidPowerSignalException + * @throws InvalidPowerSignalException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function sendSignal(string $signal): ResponseInterface { diff --git a/app/Repositories/Daemon/ServerRepository.php b/app/Repositories/Daemon/ServerRepository.php index cf5a5a69a..2dfb7bb69 100644 --- a/app/Repositories/Daemon/ServerRepository.php +++ b/app/Repositories/Daemon/ServerRepository.php @@ -15,7 +15,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * @param array $overrides * @return \Psr\Http\Message\ResponseInterface * - * @throws \GuzzleHttp\Exception\RequestException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function create(array $structure, array $overrides = []): ResponseInterface { @@ -33,6 +33,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * * @param array $data * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function update(array $data): ResponseInterface { @@ -46,6 +47,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * * @param array|null $data * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function reinstall(array $data = null): ResponseInterface { @@ -58,6 +60,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * Mark a server as needing a container rebuild the next time the server is booted. * * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function rebuild(): ResponseInterface { @@ -68,6 +71,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * Suspend a server on the daemon. * * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function suspend(): ResponseInterface { @@ -78,6 +82,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * Un-suspend a server on the daemon. * * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function unsuspend(): ResponseInterface { @@ -88,6 +93,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * Delete a server on the daemon. * * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function delete(): ResponseInterface { @@ -98,6 +104,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * Return detials on a specific server. * * @return \Psr\Http\Message\ResponseInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function details(): ResponseInterface { @@ -110,7 +117,7 @@ class ServerRepository extends BaseRepository implements ServerRepositoryInterfa * @param string|array $key * @return \Psr\Http\Message\ResponseInterface * - * @throws \GuzzleHttp\Exception\RequestException + * @throws \GuzzleHttp\Exception\GuzzleException */ public function revokeAccessKey($key): ResponseInterface { diff --git a/app/Services/Acl/Api/AdminAcl.php b/app/Services/Acl/Api/AdminAcl.php index 54bd594fd..adc956413 100644 --- a/app/Services/Acl/Api/AdminAcl.php +++ b/app/Services/Acl/Api/AdminAcl.php @@ -70,6 +70,7 @@ class AdminAcl * Return a list of all resource constants defined in this ACL. * * @return array + * @throws \ReflectionException */ public static function getResourceList(): array { diff --git a/app/Transformers/Api/Application/AllocationTransformer.php b/app/Transformers/Api/Application/AllocationTransformer.php index cce6acc86..f1a35f4f2 100644 --- a/app/Transformers/Api/Application/AllocationTransformer.php +++ b/app/Transformers/Api/Application/AllocationTransformer.php @@ -46,6 +46,7 @@ class AllocationTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Allocation $allocation * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNode(Allocation $allocation) { @@ -65,6 +66,7 @@ class AllocationTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Allocation $allocation * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServer(Allocation $allocation) { diff --git a/app/Transformers/Api/Application/DatabaseHostTransformer.php b/app/Transformers/Api/Application/DatabaseHostTransformer.php index ef7d575bf..3ef10e8ad 100644 --- a/app/Transformers/Api/Application/DatabaseHostTransformer.php +++ b/app/Transformers/Api/Application/DatabaseHostTransformer.php @@ -55,6 +55,7 @@ class DatabaseHostTransformer extends BaseTransformer * * @param \Pterodactyl\Models\DatabaseHost $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeDatabases(DatabaseHost $model) { diff --git a/app/Transformers/Api/Application/EggTransformer.php b/app/Transformers/Api/Application/EggTransformer.php index baaf1a154..98765bf4c 100644 --- a/app/Transformers/Api/Application/EggTransformer.php +++ b/app/Transformers/Api/Application/EggTransformer.php @@ -70,6 +70,7 @@ class EggTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeNest(Egg $model) { @@ -87,6 +88,7 @@ class EggTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Egg $model) { @@ -154,6 +156,7 @@ class EggTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Egg $model * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeVariables(Egg $model) { diff --git a/app/Transformers/Api/Application/NodeTransformer.php b/app/Transformers/Api/Application/NodeTransformer.php index d47183fc7..d9b8b61f3 100644 --- a/app/Transformers/Api/Application/NodeTransformer.php +++ b/app/Transformers/Api/Application/NodeTransformer.php @@ -52,6 +52,7 @@ class NodeTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeAllocations(Node $node) { @@ -71,6 +72,7 @@ class NodeTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeLocation(Node $node) { @@ -90,6 +92,7 @@ class NodeTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Node $node * @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeServers(Node $node) { diff --git a/app/Transformers/Api/Application/ServerDatabaseTransformer.php b/app/Transformers/Api/Application/ServerDatabaseTransformer.php index c71627296..1cdced612 100644 --- a/app/Transformers/Api/Application/ServerDatabaseTransformer.php +++ b/app/Transformers/Api/Application/ServerDatabaseTransformer.php @@ -85,6 +85,7 @@ class ServerDatabaseTransformer extends BaseTransformer * * @param \Pterodactyl\Models\Database $model * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeHost(Database $model) { diff --git a/app/Transformers/Api/Application/ServerVariableTransformer.php b/app/Transformers/Api/Application/ServerVariableTransformer.php index 5ce592b5f..73cd169b2 100644 --- a/app/Transformers/Api/Application/ServerVariableTransformer.php +++ b/app/Transformers/Api/Application/ServerVariableTransformer.php @@ -40,6 +40,7 @@ class ServerVariableTransformer extends BaseTransformer * * @param \Pterodactyl\Models\ServerVariable $variable * @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource + * @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException */ public function includeParent(ServerVariable $variable) { From 3bc2397795bcc9e9144b309203d8059a3e88011d Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 13 May 2018 12:27:16 -0400 Subject: [PATCH 2/4] Library doesn't exist anymore --- app/Http/Controllers/Admin/LocationController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/Http/Controllers/Admin/LocationController.php b/app/Http/Controllers/Admin/LocationController.php index fbdf64003..9239889cc 100644 --- a/app/Http/Controllers/Admin/LocationController.php +++ b/app/Http/Controllers/Admin/LocationController.php @@ -103,7 +103,6 @@ class LocationController extends Controller * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable - * @throws \Watson\Validating\ValidationException */ public function create(LocationFormRequest $request) { @@ -121,7 +120,6 @@ class LocationController extends Controller * @return \Illuminate\Http\RedirectResponse * * @throws \Throwable - * @throws \Watson\Validating\ValidationException */ public function update(LocationFormRequest $request, Location $location) { From 71257c67bf16d456e7ba2fae7f3caf3518a918bf Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 13 May 2018 12:30:53 -0400 Subject: [PATCH 3/4] Add more throwing --- app/Console/Commands/Environment/EmailSettingsCommand.php | 1 + app/Http/Controllers/Admin/ApiController.php | 1 + app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php | 2 ++ 3 files changed, 4 insertions(+) diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index 0403d7f11..0a29f2da2 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -59,6 +59,7 @@ class EmailSettingsCommand extends Command /** * Handle command execution. + * @throws \Pterodactyl\Exceptions\PterodactylException */ public function handle() { diff --git a/app/Http/Controllers/Admin/ApiController.php b/app/Http/Controllers/Admin/ApiController.php index bbf4bcbf8..2fa541bc7 100644 --- a/app/Http/Controllers/Admin/ApiController.php +++ b/app/Http/Controllers/Admin/ApiController.php @@ -65,6 +65,7 @@ class ApiController extends Controller * Render view allowing an admin to create a new application API key. * * @return \Illuminate\View\View + * @throws \ReflectionException */ public function create(): View { diff --git a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php index 372dd115d..241c2096d 100644 --- a/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php +++ b/app/Http/Requests/Admin/Api/StoreApplicationApiKeyRequest.php @@ -10,6 +10,8 @@ class StoreApplicationApiKeyRequest extends AdminFormRequest { /** * @return array + * @throws \ReflectionException + * @throws \ReflectionException */ public function rules() { From b232055676637f5da5bca218faa56d7ca0f622ed Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sun, 13 May 2018 12:43:59 -0400 Subject: [PATCH 4/4] Fix style change --- app/Providers/AuthServiceProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 0a5e3d564..e147736ed 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -17,7 +17,6 @@ class AuthServiceProvider extends ServiceProvider /** * Register any application authentication / authorization services. - * */ public function boot() {