Skip to content

Commit

Permalink
chore: Fix static analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ollieread committed Nov 17, 2024
1 parent 21b950e commit 3899bfe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/Concerns/HandlesServiceOverrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Sprout\Contracts\ServiceOverride;
use Sprout\Contracts\Tenancy;
use Sprout\Contracts\Tenant;
use Sprout\Overrides\StorageOverride;

trait HandlesServiceOverrides
{
Expand Down Expand Up @@ -39,7 +38,7 @@ trait HandlesServiceOverrides
private array $bootedOverrides = [];

/**
* @var array<string, array<class-string<\Sprout\Contracts\ServiceOverride>>
* @var array<string, array<class-string<\Sprout\Contracts\ServiceOverride>, bool>>
*/
private array $setupOverrides = [];

Expand Down Expand Up @@ -97,6 +96,7 @@ protected function processOverride(string $overrideClass): static

// The override is bootable
if ($override instanceof BootableServiceOverride) {
/** @var class-string<\Sprout\Contracts\BootableServiceOverride> $overrideClass */
// So register it as one
$this->bootableOverrides[$overrideClass] = $override;
$this->bootedOverrides[$overrideClass] = false;
Expand Down Expand Up @@ -203,17 +203,16 @@ public function bootOverrides(): void
/**
* Boot a service override
*
* @template TenantClass of \Sprout\Contracts\Tenant
*
* @param class-string<\Sprout\Contracts\BootableServiceOverride> $overrideClass
*
* @phpstan-param TenantClass $tenant
* @param class-string<\Sprout\Contracts\ServiceOverride> $overrideClass
*
* @return void
*/
protected function bootOverride(string $overrideClass): void
{
$this->overrides[$overrideClass]->boot($this->app, $this);
/** @var \Sprout\Contracts\BootableServiceOverride $override */
$override = $this->overrides[$overrideClass];

$override->boot($this->app, $this);
$this->bootedOverrides[$overrideClass] = true;
}

Expand Down Expand Up @@ -359,11 +358,11 @@ public function hasRegisteredOverride(string $class): bool
/**
* Get all service overrides for a tenancy
*
* @param \Sprout\Contracts\Tenancy|null $tenancy
* @param \Sprout\Contracts\Tenancy<*>|null $tenancy
*
* @return \Sprout\Contracts\ServiceOverride[]|void
* @return array<\Sprout\Contracts\ServiceOverride>
*/
public function getCurrentOverrides(?Tenancy $tenancy = null)
public function getCurrentOverrides(?Tenancy $tenancy = null): array

Check warning on line 365 in src/Concerns/HandlesServiceOverrides.php

View check run for this annotation

Codecov / codecov/patch

src/Concerns/HandlesServiceOverrides.php#L365

Added line #L365 was not covered by tests
{
$tenancy ??= $this->getCurrentTenancy();

Check warning on line 367 in src/Concerns/HandlesServiceOverrides.php

View check run for this annotation

Codecov / codecov/patch

src/Concerns/HandlesServiceOverrides.php#L367

Added line #L367 was not covered by tests

Expand All @@ -376,5 +375,7 @@ function (string $overrideClass) use ($tenancy) {
ARRAY_FILTER_USE_KEY
);

Check warning on line 376 in src/Concerns/HandlesServiceOverrides.php

View check run for this annotation

Codecov / codecov/patch

src/Concerns/HandlesServiceOverrides.php#L369-L376

Added lines #L369 - L376 were not covered by tests
}

return [];

Check warning on line 379 in src/Concerns/HandlesServiceOverrides.php

View check run for this annotation

Codecov / codecov/patch

src/Concerns/HandlesServiceOverrides.php#L379

Added line #L379 was not covered by tests
}
}
1 change: 1 addition & 0 deletions src/Overrides/CacheOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Sprout\Overrides;

use Illuminate\Cache\ApcStore;
use Illuminate\Cache\ApcWrapper;
use Illuminate\Cache\ArrayStore;
use Illuminate\Cache\CacheManager;
Expand Down

0 comments on commit 3899bfe

Please sign in to comment.