refactor: remove or implement empty register() methods in Boot classes #17

Open
opened 2026-02-20 02:41:25 +00:00 by Clotho · 0 comments
Member

Issue

Two Boot service provider classes have empty register() methods.

Affected Files

1. src/Mod/Hub/Boot.php (lines 213-216)

public function register(): void
{
    //
}

2. src/Website/Hub/Boot.php (lines 61-64)

public function register(): void
{
    //
}

Laravel Service Provider Convention

From Laravel docs:

  • register() - Bind services into service container
  • boot() - Perform actions after all services registered

If register() is not needed, it can be omitted entirely.

Recommendation

Option A: Remove Empty Methods

If no container bindings needed:

class Boot extends ServiceProvider
{
    // Remove empty register() method entirely
    // Only keep boot() and other methods
}

Option B: Add PHPDoc

If intentionally empty for future use:

/**
 * Register services.
 * 
 * Currently no services to register - all registration handled in boot().
 */
public function register(): void
{
    // Intentionally empty
}

Option C: Move Bindings from boot() to register()

If there are service container bindings in boot() that should be in register():

  • Move singleton/bind calls to register()
  • Keep event listeners, routes, views in boot()

Analysis

Checking both files:

Mod/Hub/Boot.php:

  • Has event listeners in boot()
  • Registers Livewire components
  • Registers admin menu items
  • Correctly using boot() for these

Website/Hub/Boot.php:

  • Registers routes in boot()
  • Registers Blade components
  • Correctly using boot() for these

Verdict

Remove empty methods - They serve no purpose and add clutter.

Priority

Low - Code quality/cleanup, no functional impact.

Discovered by

Automatic codebase scan (issue #3)

## Issue Two Boot service provider classes have empty `register()` methods. ## Affected Files ### 1. src/Mod/Hub/Boot.php (lines 213-216) ```php public function register(): void { // } ``` ### 2. src/Website/Hub/Boot.php (lines 61-64) ```php public function register(): void { // } ``` ## Laravel Service Provider Convention From Laravel docs: - `register()` - Bind services into service container - `boot()` - Perform actions after all services registered If `register()` is not needed, it can be omitted entirely. ## Recommendation **Option A: Remove Empty Methods** If no container bindings needed: ```php class Boot extends ServiceProvider { // Remove empty register() method entirely // Only keep boot() and other methods } ``` **Option B: Add PHPDoc** If intentionally empty for future use: ```php /** * Register services. * * Currently no services to register - all registration handled in boot(). */ public function register(): void { // Intentionally empty } ``` **Option C: Move Bindings from boot() to register()** If there are service container bindings in `boot()` that should be in `register()`: - Move singleton/bind calls to `register()` - Keep event listeners, routes, views in `boot()` ## Analysis Checking both files: **Mod/Hub/Boot.php:** - Has event listeners in `boot()` - Registers Livewire components - Registers admin menu items - ✅ Correctly using `boot()` for these **Website/Hub/Boot.php:** - Registers routes in `boot()` - Registers Blade components - ✅ Correctly using `boot()` for these ## Verdict **Remove empty methods** - They serve no purpose and add clutter. ## Priority **Low** - Code quality/cleanup, no functional impact. ## Discovered by Automatic codebase scan (issue #3)
Clotho added the
discovery
label 2026-02-20 02:41:25 +00:00
Charon added
PHP
refactor
P2
and removed
discovery
labels 2026-02-20 12:16:53 +00:00
Clotho was assigned by Charon 2026-02-20 12:20:54 +00:00
Charon added the
agent-ready
label 2026-02-21 01:30:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: core/php-admin#17
No description provided.