Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
pint:
name: Pint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer:v2
coverage: none

- name: Init composer
run: composer init --no-interaction

- name: Install Laravel Pint
run: composer require "laravel/pint:^1.15.3"

- name: Run Pint
run: vendor/bin/pint --test
phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Clone Pelican Panel
run: git clone --depth=1 https://github.com/pelican-dev/panel pelican

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer:v2
coverage: none

- name: Install panel dependencies
run: |
cd pelican
composer install --no-interaction --no-suggest --no-progress --no-scripts

- name: Install plugin dependencies
run: |
cd pelican
composer require "stripe/stripe-php:^18.0" "kovah/laravel-socialite-oidc:^0.5" "krymosoftware/gameq:^4.0"

- name: Setup .env file
run: cp pelican/.env.example pelican/.env

- name: Move plugin folders and phpstan.neon
run: |
mkdir -p pelican/plugins
rsync -av --progress ./ pelican/plugins/ --exclude=pelican
cp phpstan.neon pelican/phpstan.neon

- name: Run PHPStan Analysis
run: |
cd pelican
vendor/bin/phpstan analyse --memory-limit=-1 --error-format=github

29 changes: 0 additions & 29 deletions .github/workflows/pint.yml

This file was deleted.

2 changes: 1 addition & 1 deletion billing/src/Filament/App/Widgets/ProductWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProductWidget extends Widget implements HasActions, HasSchemas
use InteractsWithActions;
use InteractsWithSchemas;

protected string $view = 'billing::widget';
protected string $view = 'billing::widget'; // @phpstan-ignore property.defaultValue

public ?Product $product = null;

Expand Down
4 changes: 2 additions & 2 deletions billing/src/Models/Coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected static function boot(): void
static::deleted(function (self $model) {
if (!is_null($model->stripe_coupon_id)) {
/** @var StripeClient $stripeClient */
$stripeClient = app(StripeClient::class); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$stripeClient = app(StripeClient::class);

$stripeClient->coupons->delete($model->stripe_coupon_id);
$stripeClient->coupons->delete($model->stripe_promotion_id);
Expand All @@ -65,7 +65,7 @@ protected static function boot(): void
public function sync(): void
{
/** @var StripeClient $stripeClient */
$stripeClient = app(StripeClient::class); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$stripeClient = app(StripeClient::class);

if (is_null($this->stripe_coupon_id)) {
$data = [
Expand Down
12 changes: 6 additions & 6 deletions billing/src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function checkExpire(): bool
if ($this->status === OrderStatus::Active && !is_null($this->expires_at) && now('UTC') >= $this->expires_at) {
try {
if ($this->server) {
app(SuspensionService::class)->handle($this->server, SuspendAction::Suspend); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
app(SuspensionService::class)->handle($this->server, SuspendAction::Suspend);
}
} catch (Exception $exception) {
report($exception);
Expand All @@ -98,7 +98,7 @@ private function expireCheckoutSession(): void
{
if (!is_null($this->stripe_checkout_id)) {
/** @var StripeClient $stripeClient */
$stripeClient = app(StripeClient::class); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$stripeClient = app(StripeClient::class);

$session = $stripeClient->checkout->sessions->retrieve($this->stripe_checkout_id);

Expand All @@ -111,7 +111,7 @@ private function expireCheckoutSession(): void
public function getCheckoutSession(): Session
{
/** @var StripeClient $stripeClient */
$stripeClient = app(StripeClient::class); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$stripeClient = app(StripeClient::class);

if (is_null($this->stripe_checkout_id)) {
$session = $stripeClient->checkout->sessions->create([
Expand Down Expand Up @@ -165,7 +165,7 @@ public function activate(?string $stripePaymentId): void

try {
if ($this->server) {
app(SuspensionService::class)->handle($this->server, SuspendAction::Unsuspend); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
app(SuspensionService::class)->handle($this->server, SuspendAction::Unsuspend);
} else {
$this->createServer();
}
Expand All @@ -178,7 +178,7 @@ public function close(): void
{
try {
if ($this->server) {
app(SuspensionService::class)->handle($this->server, SuspendAction::Suspend); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
app(SuspensionService::class)->handle($this->server, SuspendAction::Suspend);
}
} catch (Exception $exception) {
report($exception);
Expand Down Expand Up @@ -228,7 +228,7 @@ public function createServer(): Server
$object->setTags($product->tags);
$object->setPorts($product->ports);

$server = app(ServerCreationService::class)->handle($data, $object); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$server = app(ServerCreationService::class)->handle($data, $object);

$this->update([
'server_id' => $server->id,
Expand Down
4 changes: 2 additions & 2 deletions billing/src/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected static function boot(): void
static::deleted(function (self $model) {
if (!is_null($model->stripe_id)) {
/** @var StripeClient $stripeClient */
$stripeClient = app(StripeClient::class); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$stripeClient = app(StripeClient::class);

$stripeClient->products->delete($model->stripe_id);
}
Expand All @@ -99,7 +99,7 @@ public function getLabel(): string
public function sync(): void
{
/** @var StripeClient $stripeClient */
$stripeClient = app(StripeClient::class); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$stripeClient = app(StripeClient::class);

if (is_null($this->stripe_id)) {
$stripeProduct = $stripeClient->products->create([
Expand Down
2 changes: 1 addition & 1 deletion billing/src/Models/ProductPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function sync(): void
$this->product->sync();

/** @var StripeClient $stripeClient */
$stripeClient = app(StripeClient::class); // @phpstan-ignore myCustomRules.forbiddenGlobalFunctions
$stripeClient = app(StripeClient::class);

if (is_null($this->stripe_id)) {
$stripePrice = $stripeClient->prices->create([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ protected function setUp(): void
}

$response = Http::withHeaders($headers)
->post('https://pastefox.com/api/pastes', $payload)
->timeout(30)
->connectTimeout(5)
->throw()
->post('https://pastefox.com/api/pastes', $payload)
->json();

if ($response['success']) {
Expand Down
13 changes: 13 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
includes:
- vendor/larastan/larastan/extension.neon

parameters:

paths:
- plugins

level: 6

ignoreErrors:
- identifier: missingType.generics
- identifier: larastan.noEnvCallsOutsideOfConfig
1 change: 1 addition & 0 deletions player-counter/database/Seeders/PlayerCounterSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function run(): void
}
}

// @phpstan-ignore if.alwaysTrue
if ($this->command) {
$this->command->info('Created game query types for minecraft and source');
}
Expand Down
6 changes: 3 additions & 3 deletions player-counter/src/Filament/Server/Pages/PlayersPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function canAccess(): bool
/** @var Server $server */
$server = Filament::getTenant();

return parent::canAccess() && $server->allocation && $server->egg->gameQuery()->exists();
return parent::canAccess() && $server->allocation && $server->egg->gameQuery()->exists(); // @phpstan-ignore method.notFound
}

public static function getNavigationLabel(): string
Expand Down Expand Up @@ -72,7 +72,7 @@ public function table(Table $table): Table
$server = Filament::getTenant();

/** @var ?GameQuery $gameQuery */
$gameQuery = $server->egg->gameQuery;
$gameQuery = $server->egg->gameQuery; // @phpstan-ignore property.notFound

$isMinecraft = $gameQuery?->query_type->isMinecraft();

Expand Down Expand Up @@ -105,7 +105,7 @@ public function table(Table $table): Table
$players = [];

/** @var ?GameQuery $gameQuery */
$gameQuery = $server->egg->gameQuery;
$gameQuery = $server->egg->gameQuery; // @phpstan-ignore property.notFound

if ($gameQuery) {
$data = $gameQuery->runQuery($server->allocation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function canView(): bool
/** @var Server $server */
$server = Filament::getTenant();

return !$server->isInConflictState() && $server->allocation && $server->egg->gameQuery()->exists() && !$server->retrieveStatus()->isOffline();
return !$server->isInConflictState() && $server->allocation && $server->egg->gameQuery()->exists() && !$server->retrieveStatus()->isOffline(); // @phpstan-ignore method.notFound
}

protected function getStats(): array
Expand All @@ -26,7 +26,7 @@ protected function getStats(): array
$server = Filament::getTenant();

/** @var ?GameQuery $gameQuery */
$gameQuery = $server->egg->gameQuery;
$gameQuery = $server->egg->gameQuery; // @phpstan-ignore property.notFound

if (!$gameQuery) {
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected static function getBadgeCount(): int
/** @var Server $server */
$server = Filament::getTenant();

return $server->subdomains->count();
return $server->subdomains->count(); // @phpstan-ignore property.notFound
}

protected static function getBadgeLimit(): int
Expand Down
1 change: 1 addition & 0 deletions subdomains/src/Models/CloudflareDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function subdomains(): HasMany

public function fetchCloudflareId(): void
{
// @phpstan-ignore staticMethod.notFound
$response = Http::cloudflare()->get('zones', [
'name' => $this->name,
])->json();
Expand Down
3 changes: 3 additions & 0 deletions subdomains/src/Models/Subdomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ protected function createOnCloudflare(): void
}

if (!$this->cloudflare_id) {
// @phpstan-ignore staticMethod.notFound
$response = Http::cloudflare()->post("zones/{$this->domain->cloudflare_id}/dns_records", [
'name' => $this->name,
'ttl' => 120,
Expand All @@ -94,6 +95,7 @@ protected function updateOnCloudflare(): void
}

if ($this->cloudflare_id) {
// @phpstan-ignore staticMethod.notFound
Http::cloudflare()->patch("zones/{$this->domain->cloudflare_id}/dns_records/{$this->cloudflare_id}", [
'name' => $this->name,
'ttl' => 120,
Expand All @@ -108,6 +110,7 @@ protected function updateOnCloudflare(): void
protected function deleteOnCloudflare(): void
{
if ($this->cloudflare_id) {
// @phpstan-ignore staticMethod.notFound
Http::cloudflare()->delete("zones/{$this->domain->cloudflare_id}/dns_records/{$this->cloudflare_id}");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function save(): void

try {
/** @var DaemonServerRepository $repository */
$repository = app(DaemonServerRepository::class); // @phpstan-ignore-line
$repository = app(DaemonServerRepository::class);

$repository->setServer($server)->sync();

Expand Down
2 changes: 1 addition & 1 deletion user-creatable-servers/src/Models/UserResourceLimits.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function createServer(string $name, int|Egg $egg, int $cpu, int $memory,
$object->setPorts(array_filter(explode(',', config('user-creatable-servers.deployment_ports'))));

/** @var ServerCreationService $service */
$service = app(ServerCreationService::class); // @phpstan-ignore-line
$service = app(ServerCreationService::class);

return $service->handle($data, $object);
}
Expand Down