Skip to content

Commit

Permalink
qa: phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckadams committed Jan 19, 2025
1 parent 5cf9598 commit 1e5436c
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 7 deletions.
4 changes: 1 addition & 3 deletions app/Contracts/Repo/PluginRepo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@

use App\Models\WpOrg\Plugin;

/**
* @template-implements Repo<Plugin>
*/
/** @extends Repo<Plugin> */
interface PluginRepo extends Repo {}
5 changes: 4 additions & 1 deletion app/Contracts/Repo/Repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

namespace App\Contracts\Repo;

use App\Models\WpOrg\Plugin;
use App\Models\WpOrg\Theme;

/**
* Represents the general concept of a plugin/theme repository service, in the sense of "the wp.org theme repo"
* or "the github plugin repo" rather than a lower-level Entity/Model Repository, thus the abbreviated "Repo" name.
*
* @template T
* @template T of Plugin|Theme
*/
interface Repo
{
Expand Down
4 changes: 1 addition & 3 deletions app/Contracts/Repo/ThemeRepo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@

use App\Models\WpOrg\Theme;

/**
* @template-implements Repo<Theme>
*/
/** @extends Repo<Theme> */
interface ThemeRepo extends Repo {}
18 changes: 18 additions & 0 deletions app/Data/Props/PluginProps.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@

final class PluginProps extends ModelProps
{
/**
* @param Optional|array<string, mixed>|null $ratings
* @param Optional|array<string, mixed>|null $banners
* @param Optional|array<string, mixed>|null $contributors
* @param Optional|array<string, mixed>|null $icons
* @param Optional|array<string, mixed>|null $source
* @param Optional|array<string, mixed>|null $requires_plugins
* @param Optional|array<string, mixed>|null $compatibility
* @param Optional|array<string, mixed>|null $screenshots
* @param Optional|array<string, mixed>|null $sections
* @param Optional|array<string, mixed>|null $versions
* @param Optional|array<string, mixed>|null $upgrade_notice
* @param Optional|array<string, mixed> $tags
* @param Optional|array<string, mixed>|null $ac_raw_metadata
*/
public function __construct(
#[Uuid]
public readonly Optional|string $id,
Expand Down Expand Up @@ -130,6 +145,9 @@ public function __construct(
public readonly Optional|array|null $ac_raw_metadata,
) {}

/**
* @param array<string, mixed> $extra
*/
public static function make(
string $slug,
string $name,
Expand Down
11 changes: 11 additions & 0 deletions app/Data/Props/ThemeProps.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@

final class ThemeProps extends ModelProps
{
/**
* @param Optional|array<string, mixed>|null $ratings
* @param Optional|array<string, mixed>|null $sections
* @param Optional|array<string, mixed>|null $versions
* @param Optional|array<string, mixed>|null $requires
* @param Optional|array<string, mixed> $tags
* @param Optional|array<string, mixed>|null $ac_raw_metadata
*/
public function __construct(
#[Uuid]
public readonly Optional|string $id,
Expand Down Expand Up @@ -102,6 +110,9 @@ public function __construct(
public readonly Optional|array|null $ac_raw_metadata,
) {}

/**
* @param array<string, mixed> $extra
*/
public static function make(
string $slug,
string $name,
Expand Down
3 changes: 3 additions & 0 deletions app/Models/WpOrg/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ public function tags(): BelongsToMany

//region Constructors

/**
* @param PluginProps|array<string, mixed> $props
*/
public static function create(array|PluginProps $props): self
{
if (is_array($props)) {
Expand Down
4 changes: 4 additions & 0 deletions app/Models/WpOrg/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public function tags(): BelongsToMany
//endregion

//region Constructors

/**
* @param ThemeProps|array<string, mixed> $props
*/
public static function create(array|ThemeProps $props): self
{
if (is_array($props)) {
Expand Down
3 changes: 3 additions & 0 deletions app/Services/Repo/BarePluginRepo.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public function origin(): string
return 'bare';
}

/**
* @param array<string, mixed> $extra
*/
public function createPlugin(
string $slug,
string $name,
Expand Down

0 comments on commit 1e5436c

Please sign in to comment.