Raise PHPStan level tp 4

This commit is contained in:
myrmidex 2025-07-06 20:45:40 +02:00
parent 26187e2dd9
commit c851c2292c
7 changed files with 13 additions and 14 deletions

View file

@ -8,7 +8,6 @@
use App\Services\Publishing\ArticlePublishingService;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use RuntimeException;
class PublishToLemmyJob implements ShouldQueue
{
@ -29,7 +28,7 @@ public function handle(): void
try {
$publishingService->publishToRoutedChannels($this->article, $extractedData);
} catch (PublishException|RuntimeException $e) {
} catch (PublishException $e) {
$this->fail($e);
}
}

View file

@ -40,9 +40,9 @@ public function handle(): void
{
LogSaver::info('Starting channel posts sync job', $this->channel);
if ($this->channel->platformInstance->platform === PlatformEnum::LEMMY) {
$this->syncLemmyChannelPosts();
}
match ($this->channel->platformInstance->platform) {
PlatformEnum::LEMMY => $this->syncLemmyChannelPosts(),
};
LogSaver::info('Channel posts sync job completed', $this->channel);
}

View file

@ -16,11 +16,11 @@
* @property string $url
* @property string $type
* @property int $language_id
* @property Language $language
* @property Language|null $language
* @property string $description
* @property array $settings
* @property bool $is_active
* @property Carbon $last_fetched_at
* @property Carbon|null $last_fetched_at
* @property Carbon $created_at
* @property Carbon $updated_at
* @method static create(array $validated)

View file

@ -2,6 +2,7 @@
namespace App\Models;
use App\Enums\PlatformEnum;
use Database\Factories\PlatformChannelFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -17,7 +18,7 @@
* @property integer $channel_id
* @property string $name
* @property int $language_id
* @property Language $language
* @property Language|null $language
* @property boolean $is_active
*/
class PlatformChannel extends Model
@ -60,9 +61,8 @@ public function activePlatformAccounts(): BelongsToMany
public function getFullNameAttribute(): string
{
// For Lemmy, use /c/ prefix. Other platforms may use different formats
$prefix = $this->platformInstance->platform === 'lemmy' ? '/c/' : '/';
return $this->platformInstance->url . $prefix . $this->name;
// For Lemmy, use /c/ prefix
return $this->platformInstance->url . '/c/' . $this->name;
}
public function feeds(): BelongsToMany

View file

@ -8,7 +8,7 @@ public static function extractArticleUrls(string $html): array
{
preg_match_all('/href="(https:\/\/www\.belganewsagency\.eu\/[a-z0-9-]+)"/', $html, $matches);
$urls = collect($matches[1] ?? [])
$urls = collect($matches[1])
->unique()
->toArray();

View file

@ -9,7 +9,7 @@ public static function extractArticleUrls(string $html): array
// Extract article links using regex
preg_match_all('/href="(\/vrtnws\/en\/\d{4}\/\d{2}\/\d{2}\/[^"]+)"/', $html, $matches);
$urls = collect($matches[1] ?? [])
$urls = collect($matches[1])
->unique()
->map(fn ($path) => 'https://www.vrt.be' . $path)
->toArray();

View file

@ -2,7 +2,7 @@ includes:
- vendor/larastan/larastan/extension.neon
parameters:
level: 2
level: 4
paths:
- app/
- tests/