-
Notifications
You must be signed in to change notification settings - Fork 0
Session 7: Add Return Type Declarations to Actions & Jobs #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PHPStan Error Resolution Session 7: Return Type Declarations ## Summary - Baseline: 6,805 errors - After: 6,726 errors - Reduction: 79 errors ## Changes Made ### Database Actions (13 files) - StartClickhouse, StartDragonfly, StartKeydb, StartMariadb, StartMongodb, StartMysql, StartPostgresql, StartRedis: Added Activity return types and PHPDoc annotations for array return types on helper methods - RestartDatabase, StartDatabase: Added string|Activity|null return types - StopDatabase: Already had return types (verified) - StartDatabaseProxy, StopDatabaseProxy: Added void return types ### Application Actions (5 files) - GenerateConfig: Added string|array return type - LoadComposeFile: Added void return type - StopApplication, StopApplicationOneServer: Added ?string return types - IsHorizonQueueEmpty: Added bool return type ### Service Actions (4 files) - StartService, RestartService: Added Activity return types - StopService: Added ?string return type - DeleteService: Added void return type ### Server Actions (14 files) - CheckUpdates: Added array return type with PHPDoc - CleanupDocker: Added array return type with PHPDoc - DeleteServer, ResourcesCheck, RestartContainer, StopSentinel, StartSentinel, UpdateCoolify: Added void return types - InstallDocker, InstallPrerequisites, RunCommand: Added Activity return types - StartLogDrain: Added string|Activity return type - StopLogDrain: Added ?string return type - ValidateServer: Added string return type ### Proxy Actions (1 file) - StopProxy: Added void return type ### Shared Actions (1 file) - ComplexStatusCheck: Added void return type ### Jobs (16 files) - Added void return types to all Job handle() methods - Fixed return statements in void functions (changed 'return value' to 'return') ## Technical Notes - Used Spatie\Activitylog\Contracts\Activity for remote_process() returns - Nullable return types (?Activity) used where SSL errors cause early returns - PHPDoc @return annotations added for complex array types Relates to #203
WalkthroughThis PR systematically adds explicit return type declarations to numerous Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~35 minutes Key areas requiring attention during review:
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
app/Actions/Server/StartLogDrain.php (1)
15-221: Incorrect return type: removeActivityfrom the union type.The method declares
string|Activityas the return type, but this is inaccurate:
instant_remote_process()returns?string(seebootstrap/helpers/remoteProcess.php:121), notActivityhandleError()returns mixed string/void types, notActivity- Line 33 returns a string literal
'No log drain is enabled.'The
Activitytype is never actually returned. The correct return type should be?stringto accurately reflect thatinstant_remote_process()can return either a string or null.Change the method signature to:
public function handle(Server $server): ?stringapp/Jobs/ApplicationPullRequestUpdateJob.php (1)
32-67:handle(): voidcannotreturn $efrom the catch blockWith the
handle(): voidsignature, line 66 is invalid:return $e;PHP does not allow returning a value from a void function. To maintain proper Laravel job semantics (exceptions mark the job as failed), rethrow the exception:
} catch (\Throwable $e) { - return $e; + throw $e; + }If you need to log or notify before failing, do so before rethrowing.
app/Jobs/ServerStorageCheckJob.php (1)
31-64: Remove return values fromhandle(): voidmethod—they will cause runtime TypeErrorsThe
handle()method declares avoidreturn type but returns string values and the result ofhandleError($e). PHP 7.1+ strictly enforces this and will throw a TypeError at runtime.Queued jobs don't consume return values anyway. Simply remove the returned values while preserving early exits:
public function handle(): void { try { if ($this->server->isFunctional() === false) { - return 'Server is not functional.'; + return; } $team = data_get($this->server, 'team'); $serverDiskUsageNotificationThreshold = data_get($this->server, 'settings.server_disk_usage_notification_threshold'); if (is_null($this->percentage)) { $this->percentage = $this->server->storageCheck(); } if (! $this->percentage) { - return 'No percentage could be retrieved.'; + return; } if ($this->percentage > $serverDiskUsageNotificationThreshold) { $executed = RateLimiter::attempt( 'high-disk-usage:'.$this->server->id, $maxAttempts = 0, function () use ($team, $serverDiskUsageNotificationThreshold) { $team->notify(new HighDiskUsage($this->server, $this->percentage, $serverDiskUsageNotificationThreshold)); }, $decaySeconds = 3600, ); if (! $executed) { - return 'Too many messages sent!'; + return; } } else { RateLimiter::hit('high-disk-usage:'.$this->server->id, 600); } } catch (\Throwable $e) { - return handleError($e); + handleError($e); } }app/Jobs/ServerLimitCheckJob.php (1)
28-52: Removereturnstatement from voidhandle()methodThe
handle()method is declared asvoid(line 28), but line 52 attempts toreturn handleError($e);. A void function cannot return a value in PHP, and sincehandleError()returns a string for exceptions likeTooManyRequestsExceptionandUniqueConstraintViolationException, this will cause a fatal error at runtime.Remove the
returnkeyword:} catch (\Throwable $e) { send_internal_notification('ServerLimitCheckJob failed with: '.$e->getMessage()); - - return handleError($e); + + handleError($e); }app/Actions/Server/DeleteServer.php (1)
16-27: Fix null dereference risk in Hetzner deletion when server record is missingThe
voidreturn type at line 16 is appropriate for this action pattern, but there is a critical bug in the Hetzner deletion logic (lines 21–26).When
$serverisnullbut$hetznerServerIdis provided, the code attempts to pass$teamId ?? $server->team_idtodeleteFromHetznerById(). If both$teamIdand$serverarenull, this expression evaluates tonull. However,deleteFromHetznerById()expects$teamIdto be a non-nullableint, causing aTypeError.Scenario: Call
handle(serverId=999, deleteFromHetzner=true, hetznerServerId=123, teamId=null)where server 999 is already deleted. The condition at line 21 passes, but$server->team_idon a null object crashes.Use null-safe access and validate derived IDs before calling the method:
if ($deleteFromHetzner && ($hetznerServerId || ($server && $server->hetzner_server_id))) { $effectiveHetznerId = $hetznerServerId ?? $server?->hetzner_server_id; $effectiveTokenId = $cloudProviderTokenId ?? $server?->cloud_provider_token_id; $effectiveTeamId = $teamId ?? $server?->team_id; if ($effectiveHetznerId && $effectiveTeamId) { $this->deleteFromHetznerById($effectiveHetznerId, $effectiveTokenId, $effectiveTeamId); } }
🧹 Nitpick comments (7)
app/Jobs/CleanupStaleMultiplexedConnections.php (1)
25-81: Add return & parameter types to private methods for full guideline complianceTo fully align with the project rule “always add explicit return type declarations for methods and functions” under
app/**/*.php, consider adding types to the helper methods as well:
cleanupStaleConnections(): voidcleanupNonExistentServerConnections(): voidextractServerUuidFromMuxFile(string $muxFile): stringremoveMultiplexFile(string $muxFile): voidExample patch:
- private function cleanupStaleConnections() + private function cleanupStaleConnections(): void @@ - private function cleanupNonExistentServerConnections() + private function cleanupNonExistentServerConnections(): void @@ - private function extractServerUuidFromMuxFile($muxFile) + private function extractServerUuidFromMuxFile(string $muxFile): string @@ - private function removeMultiplexFile($muxFile) + private function removeMultiplexFile(string $muxFile): voidThis keeps the file consistent with the PR’s goal of tightening return types and the app-level coding guidelines.
As per coding guidelines, …
app/Actions/Server/ValidateServer.php (1)
26-77: Return type is consistent; consider call‑site expectations and minor duplicationThe
handle(Server $server): stringsignature matches the implementation: every non-error path now returns the literal'OK', while all failure paths throw after updatingvalidation_logs, so there are no missing-return branches.Two minor follow-ups to keep in mind:
- If any existing callers relied on the previous
void/implicit return (e.g., never inspected the result), they’re still fine, but please double‑check that no code expects a different return type (likeboolor an array) fromValidateServer::run()or equivalent.- The “Docker Engine is not installed...” message is duplicated in the checks at Lines 61 and 72; you could optionally extract this into a local variable or helper to avoid divergence in future edits.
app/Actions/Server/CleanupDocker.php (1)
14-17: Return type + PHPDoc look correct for the cleanup log structureThe explicit
: arrayreturn type and the PHPDoc shapearray<int, array{command: string, output: string|null}>line up with the$cleanupLogstructure and with howCleanupDocker::run(...)is consumed inDockerCleanupJob. If you want PHPStan to infer an even narrower type, you could changeoutput: string|nulltooutput: stringsince you only append entries when$commandOutput !== null, but the current annotation is still safe and accurate enough for this PR. Based on learnings, this also aligns with the guideline to always add explicit return types underapp/**/*.php.app/Jobs/DeleteResourceJob.php (1)
116-203: Consider addingvoidreturn types to private helpers for consistencyBoth
deleteApplicationPreviewandstopPreviewContainersperform side effects only and never return a value. You could tighten their signatures to:- private function deleteApplicationPreview() + private function deleteApplicationPreview(): void @@ - private function stopPreviewContainers(array $containers, $server, int $timeout = 30) + private function stopPreviewContainers(array $containers, $server, int $timeout = 30): voidThis keeps the file fully consistent with the “explicit return types for app methods” convention. As per coding guidelines, ...
app/Actions/Shared/ComplexStatusCheck.php (1)
15-62: ComplexStatusCheck handle(): void matches behavior; consider typing helper as wellThe
handle(Application $application): voidsignature fits this action: it only performs remote checks and status updates, without returning a value. As a follow‑up, you might also add an explicit return type toaggregateContainerStatuses()to fully align with the “explicit return types everywhere” guideline (likely a string status). As per coding guidelines, ...app/Actions/Database/StartDragonfly.php (1)
221-274: Volume and environment helper types are well-specifiedThe new PHPDoc and
arrayreturn types on the volume/environment helpers accurately describe the produced structures (string volume specs and keyed volume definitions), which is helpful for static analysis. The implementations match the documented shapes.Minor nit:
\$container_nameand\$this->configuration_dirare assigned twice inhandle(); if you touch this file again, you could collapse that duplication for clarity, but it’s not functionally problematic.app/Actions/Database/StartDatabase.php (1)
14-15: handle() return type matches delegated Start actions; consider initializing $activity*Typing
handle()asstring|Activity|nullaccurately reflects the string early-return and the variousStart*::run(...)results. To future-proof this a bit, you might want to initialize$activity = null;before theswitchor add a default case that throws, so adding a new database type without updating the switch can’t yield an undefined$activity.public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database): string|Activity|null { $server = $database->destination->server; if (! $server->isFunctional()) { return 'Server is not functional'; } + $activity = null; switch ($database->getMorphClass()) { case \App\Models\StandalonePostgresql::class: $activity = StartPostgresql::run($database); break; // ... }Also applies to: 22-59
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (54)
app/Actions/Application/GenerateConfig.php(1 hunks)app/Actions/Application/IsHorizonQueueEmpty.php(1 hunks)app/Actions/Application/LoadComposeFile.php(1 hunks)app/Actions/Application/StopApplication.php(3 hunks)app/Actions/Application/StopApplicationOneServer.php(2 hunks)app/Actions/Database/RestartDatabase.php(1 hunks)app/Actions/Database/StartClickhouse.php(5 hunks)app/Actions/Database/StartDatabase.php(1 hunks)app/Actions/Database/StartDatabaseProxy.php(1 hunks)app/Actions/Database/StartDragonfly.php(6 hunks)app/Actions/Database/StartKeydb.php(7 hunks)app/Actions/Database/StartMariadb.php(7 hunks)app/Actions/Database/StartMongodb.php(8 hunks)app/Actions/Database/StartMysql.php(7 hunks)app/Actions/Database/StartPostgresql.php(8 hunks)app/Actions/Database/StartRedis.php(7 hunks)app/Actions/Database/StopDatabase.php(1 hunks)app/Actions/Database/StopDatabaseProxy.php(1 hunks)app/Actions/Proxy/StopProxy.php(2 hunks)app/Actions/Server/CheckUpdates.php(1 hunks)app/Actions/Server/CleanupDocker.php(1 hunks)app/Actions/Server/DeleteServer.php(1 hunks)app/Actions/Server/InstallDocker.php(1 hunks)app/Actions/Server/InstallPrerequisites.php(1 hunks)app/Actions/Server/ResourcesCheck.php(2 hunks)app/Actions/Server/RestartContainer.php(1 hunks)app/Actions/Server/RunCommand.php(1 hunks)app/Actions/Server/StartLogDrain.php(1 hunks)app/Actions/Server/StartSentinel.php(1 hunks)app/Actions/Server/StopLogDrain.php(1 hunks)app/Actions/Server/StopSentinel.php(1 hunks)app/Actions/Server/UpdateCoolify.php(2 hunks)app/Actions/Server/ValidateServer.php(1 hunks)app/Actions/Service/DeleteService.php(1 hunks)app/Actions/Service/RestartService.php(1 hunks)app/Actions/Service/StartService.php(2 hunks)app/Actions/Service/StopService.php(2 hunks)app/Actions/Shared/ComplexStatusCheck.php(1 hunks)app/Jobs/ApplicationPullRequestUpdateJob.php(1 hunks)app/Jobs/CleanupStaleMultiplexedConnections.php(1 hunks)app/Jobs/DeleteResourceJob.php(1 hunks)app/Jobs/GithubAppPermissionJob.php(1 hunks)app/Jobs/PushServerUpdateJob.php(1 hunks)app/Jobs/RegenerateSslCertJob.php(1 hunks)app/Jobs/RestartProxyJob.php(2 hunks)app/Jobs/ServerCheckJob.php(2 hunks)app/Jobs/ServerCleanupMux.php(1 hunks)app/Jobs/ServerConnectionCheckJob.php(1 hunks)app/Jobs/ServerFilesFromServerJob.php(1 hunks)app/Jobs/ServerLimitCheckJob.php(1 hunks)app/Jobs/ServerStorageCheckJob.php(1 hunks)app/Jobs/ServerStorageSaveJob.php(1 hunks)app/Jobs/SubscriptionInvoiceFailedJob.php(1 hunks)app/Jobs/VolumeCloneJob.php(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
app/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
app/**/*.php: Always add explicit return type declarations for methods and functions
Use PHP 8 constructor property promotion in __construct() methods
Use curly braces for all control structures, even single-line statements
Use PHPDoc blocks instead of inline comments for documentation
Run vendor/bin/pint --dirty before finalizing code changes to ensure code matches project style
app/**/*.php: For database work, follow Eloquent ORM patterns, migration best practices, relationship definitions, and query optimization documented in.ai/patterns/database-patterns.md
For Laravel-specific development, follow patterns in.ai/development/laravel-boost.mdincluding Laravel 12.4.1, Livewire 3 best practices, and Pest testing patterns
Files:
app/Jobs/ServerFilesFromServerJob.phpapp/Actions/Application/IsHorizonQueueEmpty.phpapp/Actions/Service/DeleteService.phpapp/Jobs/SubscriptionInvoiceFailedJob.phpapp/Actions/Database/StartDatabaseProxy.phpapp/Actions/Service/StartService.phpapp/Actions/Server/CheckUpdates.phpapp/Jobs/CleanupStaleMultiplexedConnections.phpapp/Actions/Server/RunCommand.phpapp/Jobs/ServerConnectionCheckJob.phpapp/Jobs/RestartProxyJob.phpapp/Actions/Server/InstallPrerequisites.phpapp/Actions/Application/LoadComposeFile.phpapp/Actions/Application/StopApplicationOneServer.phpapp/Actions/Database/StopDatabaseProxy.phpapp/Jobs/GithubAppPermissionJob.phpapp/Actions/Server/DeleteServer.phpapp/Jobs/PushServerUpdateJob.phpapp/Jobs/ServerStorageCheckJob.phpapp/Actions/Server/StartSentinel.phpapp/Actions/Application/GenerateConfig.phpapp/Jobs/ServerStorageSaveJob.phpapp/Actions/Database/RestartDatabase.phpapp/Jobs/RegenerateSslCertJob.phpapp/Actions/Server/StopLogDrain.phpapp/Actions/Database/StartMysql.phpapp/Actions/Server/ResourcesCheck.phpapp/Actions/Service/StopService.phpapp/Actions/Server/RestartContainer.phpapp/Actions/Database/StartMariadb.phpapp/Actions/Service/RestartService.phpapp/Actions/Server/ValidateServer.phpapp/Actions/Application/StopApplication.phpapp/Jobs/ApplicationPullRequestUpdateJob.phpapp/Jobs/ServerCheckJob.phpapp/Jobs/ServerLimitCheckJob.phpapp/Actions/Shared/ComplexStatusCheck.phpapp/Actions/Server/CleanupDocker.phpapp/Actions/Server/UpdateCoolify.phpapp/Actions/Database/StartClickhouse.phpapp/Actions/Database/StopDatabase.phpapp/Actions/Database/StartDatabase.phpapp/Actions/Proxy/StopProxy.phpapp/Actions/Database/StartKeydb.phpapp/Actions/Server/StopSentinel.phpapp/Actions/Server/StartLogDrain.phpapp/Actions/Database/StartRedis.phpapp/Jobs/DeleteResourceJob.phpapp/Actions/Database/StartDragonfly.phpapp/Actions/Database/StartPostgresql.phpapp/Actions/Database/StartMongodb.phpapp/Jobs/ServerCleanupMux.phpapp/Jobs/VolumeCloneJob.phpapp/Actions/Server/InstallDocker.php
app/Jobs/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use queued jobs for time-consuming operations with the ShouldQueue interface
Files:
app/Jobs/ServerFilesFromServerJob.phpapp/Jobs/SubscriptionInvoiceFailedJob.phpapp/Jobs/CleanupStaleMultiplexedConnections.phpapp/Jobs/ServerConnectionCheckJob.phpapp/Jobs/RestartProxyJob.phpapp/Jobs/GithubAppPermissionJob.phpapp/Jobs/PushServerUpdateJob.phpapp/Jobs/ServerStorageCheckJob.phpapp/Jobs/ServerStorageSaveJob.phpapp/Jobs/RegenerateSslCertJob.phpapp/Jobs/ApplicationPullRequestUpdateJob.phpapp/Jobs/ServerCheckJob.phpapp/Jobs/ServerLimitCheckJob.phpapp/Jobs/DeleteResourceJob.phpapp/Jobs/ServerCleanupMux.phpapp/Jobs/VolumeCloneJob.php
**/*
📄 CodeRabbit inference engine (.cursor/rules/coolify-ai-docs.mdc)
Reference
.ai/core/technology-stack.mdas the SINGLE SOURCE OF TRUTH for all version numbers and dependencies (never duplicate versions elsewhere)
Files:
app/Jobs/ServerFilesFromServerJob.phpapp/Actions/Application/IsHorizonQueueEmpty.phpapp/Actions/Service/DeleteService.phpapp/Jobs/SubscriptionInvoiceFailedJob.phpapp/Actions/Database/StartDatabaseProxy.phpapp/Actions/Service/StartService.phpapp/Actions/Server/CheckUpdates.phpapp/Jobs/CleanupStaleMultiplexedConnections.phpapp/Actions/Server/RunCommand.phpapp/Jobs/ServerConnectionCheckJob.phpapp/Jobs/RestartProxyJob.phpapp/Actions/Server/InstallPrerequisites.phpapp/Actions/Application/LoadComposeFile.phpapp/Actions/Application/StopApplicationOneServer.phpapp/Actions/Database/StopDatabaseProxy.phpapp/Jobs/GithubAppPermissionJob.phpapp/Actions/Server/DeleteServer.phpapp/Jobs/PushServerUpdateJob.phpapp/Jobs/ServerStorageCheckJob.phpapp/Actions/Server/StartSentinel.phpapp/Actions/Application/GenerateConfig.phpapp/Jobs/ServerStorageSaveJob.phpapp/Actions/Database/RestartDatabase.phpapp/Jobs/RegenerateSslCertJob.phpapp/Actions/Server/StopLogDrain.phpapp/Actions/Database/StartMysql.phpapp/Actions/Server/ResourcesCheck.phpapp/Actions/Service/StopService.phpapp/Actions/Server/RestartContainer.phpapp/Actions/Database/StartMariadb.phpapp/Actions/Service/RestartService.phpapp/Actions/Server/ValidateServer.phpapp/Actions/Application/StopApplication.phpapp/Jobs/ApplicationPullRequestUpdateJob.phpapp/Jobs/ServerCheckJob.phpapp/Jobs/ServerLimitCheckJob.phpapp/Actions/Shared/ComplexStatusCheck.phpapp/Actions/Server/CleanupDocker.phpapp/Actions/Server/UpdateCoolify.phpapp/Actions/Database/StartClickhouse.phpapp/Actions/Database/StopDatabase.phpapp/Actions/Database/StartDatabase.phpapp/Actions/Proxy/StopProxy.phpapp/Actions/Database/StartKeydb.phpapp/Actions/Server/StopSentinel.phpapp/Actions/Server/StartLogDrain.phpapp/Actions/Database/StartRedis.phpapp/Jobs/DeleteResourceJob.phpapp/Actions/Database/StartDragonfly.phpapp/Actions/Database/StartPostgresql.phpapp/Actions/Database/StartMongodb.phpapp/Jobs/ServerCleanupMux.phpapp/Jobs/VolumeCloneJob.phpapp/Actions/Server/InstallDocker.php
**/*.php
📄 CodeRabbit inference engine (.cursor/rules/coolify-ai-docs.mdc)
Always run
./vendor/bin/pintfor code formatting before committing
Files:
app/Jobs/ServerFilesFromServerJob.phpapp/Actions/Application/IsHorizonQueueEmpty.phpapp/Actions/Service/DeleteService.phpapp/Jobs/SubscriptionInvoiceFailedJob.phpapp/Actions/Database/StartDatabaseProxy.phpapp/Actions/Service/StartService.phpapp/Actions/Server/CheckUpdates.phpapp/Jobs/CleanupStaleMultiplexedConnections.phpapp/Actions/Server/RunCommand.phpapp/Jobs/ServerConnectionCheckJob.phpapp/Jobs/RestartProxyJob.phpapp/Actions/Server/InstallPrerequisites.phpapp/Actions/Application/LoadComposeFile.phpapp/Actions/Application/StopApplicationOneServer.phpapp/Actions/Database/StopDatabaseProxy.phpapp/Jobs/GithubAppPermissionJob.phpapp/Actions/Server/DeleteServer.phpapp/Jobs/PushServerUpdateJob.phpapp/Jobs/ServerStorageCheckJob.phpapp/Actions/Server/StartSentinel.phpapp/Actions/Application/GenerateConfig.phpapp/Jobs/ServerStorageSaveJob.phpapp/Actions/Database/RestartDatabase.phpapp/Jobs/RegenerateSslCertJob.phpapp/Actions/Server/StopLogDrain.phpapp/Actions/Database/StartMysql.phpapp/Actions/Server/ResourcesCheck.phpapp/Actions/Service/StopService.phpapp/Actions/Server/RestartContainer.phpapp/Actions/Database/StartMariadb.phpapp/Actions/Service/RestartService.phpapp/Actions/Server/ValidateServer.phpapp/Actions/Application/StopApplication.phpapp/Jobs/ApplicationPullRequestUpdateJob.phpapp/Jobs/ServerCheckJob.phpapp/Jobs/ServerLimitCheckJob.phpapp/Actions/Shared/ComplexStatusCheck.phpapp/Actions/Server/CleanupDocker.phpapp/Actions/Server/UpdateCoolify.phpapp/Actions/Database/StartClickhouse.phpapp/Actions/Database/StopDatabase.phpapp/Actions/Database/StartDatabase.phpapp/Actions/Proxy/StopProxy.phpapp/Actions/Database/StartKeydb.phpapp/Actions/Server/StopSentinel.phpapp/Actions/Server/StartLogDrain.phpapp/Actions/Database/StartRedis.phpapp/Jobs/DeleteResourceJob.phpapp/Actions/Database/StartDragonfly.phpapp/Actions/Database/StartPostgresql.phpapp/Actions/Database/StartMongodb.phpapp/Jobs/ServerCleanupMux.phpapp/Jobs/VolumeCloneJob.phpapp/Actions/Server/InstallDocker.php
app/Actions/**/*.php
📄 CodeRabbit inference engine (CLAUDE.md)
Use Actions pattern for complex business logic in app/Actions/ directory
Files:
app/Actions/Application/IsHorizonQueueEmpty.phpapp/Actions/Service/DeleteService.phpapp/Actions/Database/StartDatabaseProxy.phpapp/Actions/Service/StartService.phpapp/Actions/Server/CheckUpdates.phpapp/Actions/Server/RunCommand.phpapp/Actions/Server/InstallPrerequisites.phpapp/Actions/Application/LoadComposeFile.phpapp/Actions/Application/StopApplicationOneServer.phpapp/Actions/Database/StopDatabaseProxy.phpapp/Actions/Server/DeleteServer.phpapp/Actions/Server/StartSentinel.phpapp/Actions/Application/GenerateConfig.phpapp/Actions/Database/RestartDatabase.phpapp/Actions/Server/StopLogDrain.phpapp/Actions/Database/StartMysql.phpapp/Actions/Server/ResourcesCheck.phpapp/Actions/Service/StopService.phpapp/Actions/Server/RestartContainer.phpapp/Actions/Database/StartMariadb.phpapp/Actions/Service/RestartService.phpapp/Actions/Server/ValidateServer.phpapp/Actions/Application/StopApplication.phpapp/Actions/Shared/ComplexStatusCheck.phpapp/Actions/Server/CleanupDocker.phpapp/Actions/Server/UpdateCoolify.phpapp/Actions/Database/StartClickhouse.phpapp/Actions/Database/StopDatabase.phpapp/Actions/Database/StartDatabase.phpapp/Actions/Proxy/StopProxy.phpapp/Actions/Database/StartKeydb.phpapp/Actions/Server/StopSentinel.phpapp/Actions/Server/StartLogDrain.phpapp/Actions/Database/StartRedis.phpapp/Actions/Database/StartDragonfly.phpapp/Actions/Database/StartPostgresql.phpapp/Actions/Database/StartMongodb.phpapp/Actions/Server/InstallDocker.php
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: johnproblems/topgun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:49:39.698Z
Learning: Applies to app/**/*.php : Always add explicit return type declarations for methods and functions
📚 Learning: 2025-12-03T15:49:39.698Z
Learnt from: CR
Repo: johnproblems/topgun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:49:39.698Z
Learning: Applies to app/**/*.php : Always add explicit return type declarations for methods and functions
Applied to files:
app/Jobs/ServerFilesFromServerJob.phpapp/Actions/Application/IsHorizonQueueEmpty.phpapp/Jobs/ServerConnectionCheckJob.phpapp/Jobs/GithubAppPermissionJob.phpapp/Actions/Application/GenerateConfig.phpapp/Jobs/ServerStorageSaveJob.phpapp/Jobs/RegenerateSslCertJob.phpapp/Jobs/ServerLimitCheckJob.phpapp/Actions/Shared/ComplexStatusCheck.phpapp/Actions/Server/UpdateCoolify.phpapp/Actions/Database/StartClickhouse.php
📚 Learning: 2025-12-03T15:49:39.698Z
Learnt from: CR
Repo: johnproblems/topgun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-03T15:49:39.698Z
Learning: Applies to app/Services/Enterprise/**/*.php : Implement the CapacityManager pattern with canServerHandleDeployment() and selectOptimalServer() methods for capacity-aware deployment decisions
Applied to files:
app/Actions/Application/StopApplication.php
🧬 Code graph analysis (36)
app/Jobs/ServerFilesFromServerJob.php (3)
app/Actions/Application/IsHorizonQueueEmpty.php (1)
handle(12-36)app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)app/Actions/Application/StopApplicationOneServer.php (1)
handle(13-42)
app/Actions/Service/DeleteService.php (2)
app/Actions/Service/StopService.php (1)
handle(17-52)app/Jobs/DeleteResourceJob.php (1)
handle(43-114)
app/Actions/Service/StartService.php (2)
app/Actions/Database/StartMariadb.php (1)
handle(24-222)app/Actions/Database/StartMysql.php (1)
handle(24-225)
app/Actions/Server/CheckUpdates.php (2)
app/Actions/Application/GenerateConfig.php (1)
handle(12-15)app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Jobs/CleanupStaleMultiplexedConnections.php (1)
app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Actions/Server/RunCommand.php (2)
app/Actions/Database/StartMysql.php (1)
handle(24-225)app/Actions/Database/StartRedis.php (1)
handle(25-215)
app/Jobs/ServerConnectionCheckJob.php (13)
app/Actions/Application/GenerateConfig.php (1)
handle(12-15)app/Actions/Application/IsHorizonQueueEmpty.php (1)
handle(12-36)app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)app/Actions/Application/StopApplication.php (1)
handle(16-61)app/Actions/Application/StopApplicationOneServer.php (1)
handle(13-42)app/Actions/Database/RestartDatabase.php (1)
handle(20-29)app/Actions/Database/StartClickhouse.php (1)
handle(20-115)app/Actions/Database/StartDatabase.php (1)
handle(22-59)app/Actions/Database/StartDatabaseProxy.php (1)
handle(23-123)app/Actions/Database/StartMariadb.php (1)
handle(24-222)app/Actions/Database/StartMongodb.php (1)
handle(24-273)app/Actions/Server/DeleteServer.php (1)
handle(16-50)app/Jobs/ServerManagerJob.php (1)
handle(41-63)
app/Jobs/RestartProxyJob.php (2)
app/Actions/Proxy/StopProxy.php (1)
handle(15-50)bootstrap/helpers/shared.php (1)
handleError(191-225)
app/Actions/Server/InstallPrerequisites.php (3)
app/Actions/Database/StartDatabase.php (1)
handle(22-59)app/Actions/Database/StartDragonfly.php (1)
handle(24-202)app/Actions/Server/InstallDocker.php (1)
handle(17-114)
app/Actions/Application/LoadComposeFile.php (13)
app/Actions/Application/GenerateConfig.php (1)
handle(12-15)app/Actions/Application/StopApplication.php (1)
handle(16-61)app/Actions/Application/StopApplicationOneServer.php (1)
handle(13-42)app/Actions/Database/RestartDatabase.php (1)
handle(20-29)app/Actions/Database/StartClickhouse.php (1)
handle(20-115)app/Actions/Database/StartDatabaseProxy.php (1)
handle(23-123)app/Actions/Database/StartDragonfly.php (1)
handle(24-202)app/Actions/Database/StartKeydb.php (1)
handle(25-218)app/Actions/Database/StartMariadb.php (1)
handle(24-222)app/Actions/Database/StartMongodb.php (1)
handle(24-273)app/Actions/Database/StartMysql.php (1)
handle(24-225)app/Actions/Database/StartPostgresql.php (1)
handle(26-236)app/Actions/Database/StartRedis.php (1)
handle(25-215)
app/Actions/Application/StopApplicationOneServer.php (2)
app/Actions/Application/StopApplication.php (1)
handle(16-61)app/Models/Server.php (1)
isSwarm(1086-1089)
app/Actions/Database/StopDatabaseProxy.php (2)
app/Actions/Database/RestartDatabase.php (1)
handle(20-29)app/Actions/Database/StartDatabaseProxy.php (1)
handle(23-123)
app/Jobs/GithubAppPermissionJob.php (2)
app/Actions/Application/GenerateConfig.php (1)
handle(12-15)app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Actions/Application/GenerateConfig.php (3)
app/Actions/Application/StopApplication.php (1)
handle(16-61)app/Actions/Database/StartDatabase.php (1)
handle(22-59)app/Actions/Database/StartMysql.php (1)
handle(24-225)
app/Jobs/ServerStorageSaveJob.php (1)
app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Jobs/RegenerateSslCertJob.php (1)
app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Actions/Database/StartMysql.php (2)
app/Actions/Database/StartClickhouse.php (3)
generate_local_persistent_volumes(120-133)generate_local_persistent_volumes_only_volume_names(138-153)generate_environment_variables(158-176)app/Actions/Database/StartMariadb.php (4)
generate_local_persistent_volumes(227-240)generate_local_persistent_volumes_only_volume_names(245-260)generate_environment_variables(265-290)add_custom_mysql(292-301)
app/Actions/Server/ResourcesCheck.php (1)
bootstrap/helpers/shared.php (1)
handleError(191-225)
app/Actions/Service/StopService.php (2)
app/Actions/Service/DeleteService.php (1)
handle(14-77)app/Jobs/DeleteResourceJob.php (1)
handle(43-114)
app/Actions/Server/RestartContainer.php (2)
app/Actions/Application/IsHorizonQueueEmpty.php (1)
handle(12-36)app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Actions/Service/RestartService.php (4)
app/Actions/Database/RestartDatabase.php (1)
handle(20-29)app/Actions/Database/StartMysql.php (1)
handle(24-225)app/Actions/Database/StartPostgresql.php (1)
handle(26-236)app/Actions/Database/StartRedis.php (1)
handle(25-215)
app/Actions/Server/ValidateServer.php (2)
app/Actions/Server/ValidatePrerequisites.php (1)
handle(19-39)app/Jobs/ValidateAndInstallServerJob.php (1)
handle(32-197)
app/Jobs/ApplicationPullRequestUpdateJob.php (3)
app/Actions/Application/IsHorizonQueueEmpty.php (1)
handle(12-36)app/Actions/Application/StopApplicationOneServer.php (1)
handle(13-42)app/Actions/Database/StartPostgresql.php (1)
handle(26-236)
app/Jobs/ServerCheckJob.php (2)
app/Models/Server.php (2)
isSwarmWorker(1096-1099)isBuildServer(1356-1359)bootstrap/helpers/shared.php (1)
handleError(191-225)
app/Jobs/ServerLimitCheckJob.php (2)
app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)app/Actions/Database/StartDatabaseProxy.php (1)
handle(23-123)
app/Actions/Shared/ComplexStatusCheck.php (2)
app/Actions/Application/GenerateConfig.php (1)
handle(12-15)app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Actions/Server/CleanupDocker.php (3)
app/Actions/Database/StopDatabase.php (1)
handle(21-46)app/Actions/Service/StopService.php (1)
handle(17-52)app/Jobs/DockerCleanupJob.php (1)
handle(44-147)
app/Actions/Database/StopDatabase.php (2)
app/Actions/Application/StopApplication.php (1)
handle(16-61)app/Actions/Service/StopService.php (1)
handle(17-52)
app/Actions/Database/StartDatabase.php (7)
app/Actions/Database/RestartDatabase.php (1)
handle(20-29)app/Actions/Database/StartClickhouse.php (1)
handle(20-115)app/Actions/Database/StartMariadb.php (1)
handle(24-222)app/Actions/Database/StartMongodb.php (1)
handle(24-273)app/Actions/Database/StartMysql.php (1)
handle(24-225)app/Actions/Database/StartPostgresql.php (1)
handle(26-236)app/Actions/Database/StartRedis.php (1)
handle(25-215)
app/Actions/Proxy/StopProxy.php (2)
app/Jobs/RestartProxyJob.php (1)
handle(31-44)bootstrap/helpers/shared.php (1)
handleError(191-225)
app/Actions/Server/StopSentinel.php (1)
app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Actions/Server/StartLogDrain.php (2)
app/Actions/Database/StartMysql.php (1)
handle(24-225)app/Actions/Server/InstallDocker.php (1)
handle(17-114)
app/Actions/Database/StartDragonfly.php (4)
app/Actions/Database/StartClickhouse.php (2)
handle(20-115)generate_local_persistent_volumes(120-133)app/Actions/Database/StartMysql.php (2)
handle(24-225)generate_local_persistent_volumes(230-243)app/Actions/Database/StartPostgresql.php (2)
handle(26-236)generate_local_persistent_volumes(241-254)app/Models/StandaloneDragonfly.php (1)
StandaloneDragonfly(22-377)
app/Jobs/ServerCleanupMux.php (2)
app/Helpers/SshMultiplexingHelper.php (2)
SshMultiplexingHelper(12-311)removeMuxFile(95-109)bootstrap/helpers/shared.php (1)
handleError(191-225)
app/Jobs/VolumeCloneJob.php (2)
app/Actions/Application/IsHorizonQueueEmpty.php (1)
handle(12-36)app/Actions/Application/LoadComposeFile.php (1)
handle(12-15)
app/Actions/Server/InstallDocker.php (2)
app/Actions/Server/InstallPrerequisites.php (1)
handle(15-57)app/Actions/Server/StartLogDrain.php (1)
handle(15-221)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Cursor Bugbot
- GitHub Check: Cursor Bugbot
- GitHub Check: Cursor Bugbot
- GitHub Check: Cursor Bugbot
Summary
Adds explicit return type declarations to Action and Job classes as part of the PHPStan error resolution effort.
Changes
Key Patterns Applied
handle(): ?Activityfor methods callingremote_process()with early returnshandle(): Activityfor methods always returningremote_process()handle(): voidfor Job classesRelated
Verification
Note
Adds explicit return type declarations to Action and Job classes to reduce PHPStan errors and standardize method signatures.
handle()return types acrossApplication,Database,Service,Server,Proxy, andSharedactions (e.g.,Activity,?Activity, orvoidas appropriate).void.handle(): voidfor job classes and fix any methods incorrectly returning values.Written by Cursor Bugbot for commit 0993ba0. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.