Raise PHPStan level tp 7
This commit is contained in:
parent
07745b170e
commit
12beec83c8
5 changed files with 15 additions and 2 deletions
|
|
@ -7,6 +7,7 @@
|
|||
use App\Models\PlatformChannel;
|
||||
use App\Services\RoutingValidationService;
|
||||
use App\Exceptions\RoutingMismatchException;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
|
@ -52,7 +53,10 @@ public function store(Request $request): RedirectResponse
|
|||
'filters' => 'nullable|string'
|
||||
]);
|
||||
|
||||
/** @var Feed $feed */
|
||||
$feed = Feed::findOrFail($validated['feed_id']);
|
||||
|
||||
/** @var Collection<int, PlatformChannel> $channels */
|
||||
$channels = PlatformChannel::findMany($validated['channel_ids']);
|
||||
$priority = $validated['priority'] ?? 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Feed;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateFeedRequest extends FormRequest
|
||||
|
|
@ -18,7 +19,7 @@ public function rules(): array
|
|||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'url' => 'required|url|unique:feeds,url,' . $this->route('feed')?->id,
|
||||
'url' => 'required|url|unique:feeds,url,' . ($this->route('feed') instanceof Feed ? (string)$this->route('feed')->id : (string)$this->route('feed')),
|
||||
'type' => 'required|in:website,rss',
|
||||
'language_id' => 'required|exists:languages,id',
|
||||
'description' => 'nullable|string',
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ public static function getSupportedSources(): array
|
|||
}, self::$parsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<ArticleParserInterface> $parserClass
|
||||
*/
|
||||
public static function registerParser(string $parserClass): void
|
||||
{
|
||||
if (!in_array($parserClass, self::$parsers)) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ includes:
|
|||
- vendor/larastan/larastan/extension.neon
|
||||
|
||||
parameters:
|
||||
level: 6
|
||||
level: 7
|
||||
paths:
|
||||
- app/
|
||||
- tests/
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
use App\Models\Feed;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Illuminate\Testing\PendingCommand;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ArticleDiscoveryCommandTest extends TestCase
|
||||
|
|
@ -20,6 +21,7 @@ public function test_command_runs_successfully_when_feeds_exist(): void
|
|||
Feed::factory()->create(['is_active' => true]);
|
||||
|
||||
// Act & Assert
|
||||
/** @var PendingCommand $exitCode */
|
||||
$exitCode = $this->artisan('article:refresh');
|
||||
$exitCode->assertSuccessful();
|
||||
|
||||
|
|
@ -34,6 +36,7 @@ public function test_command_does_not_dispatch_jobs_when_no_active_feeds_exist()
|
|||
// No active feeds created
|
||||
|
||||
// Act
|
||||
/** @var PendingCommand $exitCode */
|
||||
$exitCode = $this->artisan('article:refresh');
|
||||
|
||||
// Assert
|
||||
|
|
@ -48,6 +51,7 @@ public function test_command_does_not_dispatch_jobs_when_only_inactive_feeds_exi
|
|||
Feed::factory()->create(['is_active' => false]);
|
||||
|
||||
// Act
|
||||
/** @var PendingCommand $exitCode */
|
||||
$exitCode = $this->artisan('article:refresh');
|
||||
|
||||
// Assert
|
||||
|
|
@ -61,6 +65,7 @@ public function test_command_logs_when_no_feeds_available(): void
|
|||
Queue::fake();
|
||||
|
||||
// Act
|
||||
/** @var PendingCommand $exitCode */
|
||||
$exitCode = $this->artisan('article:refresh');
|
||||
|
||||
// Assert
|
||||
|
|
|
|||
Loading…
Reference in a new issue