Release v1.2.0 #87

Merged
myrmidex merged 9 commits from release/v1.2.0 into main 2026-03-08 21:30:58 +01:00
15 changed files with 154 additions and 38 deletions
Showing only changes of commit 675802e8e5 - Show all commits

View file

@ -48,7 +48,7 @@ public static function fetchMultipleUrls(array $urls): array
->reject(fn ($response, $index) => $response instanceof Exception)
->map(function ($response, $index) use ($urls) {
$url = $urls[$index];
/** @var \Illuminate\Http\Client\Response $response */
try {
if ($response->successful()) {
return [

115
phpstan-baseline.neon Normal file
View file

@ -0,0 +1,115 @@
parameters:
ignoreErrors:
-
message: '#^Call to an undefined static method App\\Models\\Feed\:\:withTrashed\(\)\.$#'
identifier: staticMethod.notFound
count: 1
path: tests/Feature/DatabaseIntegrationTest.php
-
message: '#^Access to an undefined property App\\Models\\PlatformAccount\:\:\$pivot\.$#'
identifier: property.notFound
count: 1
path: tests/Unit/Actions/CreateChannelActionTest.php
-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with int will always evaluate to false\.$#'
identifier: method.impossibleType
count: 1
path: tests/Unit/Actions/CreateChannelActionTest.php
-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with string will always evaluate to false\.$#'
identifier: method.impossibleType
count: 2
path: tests/Unit/Actions/CreateFeedActionTest.php
-
message: '#^Access to an undefined property App\\Models\\Route\:\:\$id\.$#'
identifier: property.notFound
count: 2
path: tests/Unit/Actions/CreateRouteActionTest.php
-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertFalse\(\) with false will always evaluate to false\.$#'
identifier: method.impossibleType
count: 1
path: tests/Unit/Enums/LogLevelEnumTest.php
-
message: '#^Strict comparison using \=\=\= between App\\Enums\\LogLevelEnum\:\:DEBUG and App\\Enums\\LogLevelEnum\:\:DEBUG will always evaluate to true\.$#'
identifier: identical.alwaysTrue
count: 1
path: tests/Unit/Enums/LogLevelEnumTest.php
-
message: '#^Strict comparison using \=\=\= between App\\Enums\\LogLevelEnum\:\:DEBUG and App\\Enums\\LogLevelEnum\:\:INFO will always evaluate to false\.$#'
identifier: identical.alwaysFalse
count: 1
path: tests/Unit/Enums/LogLevelEnumTest.php
-
message: '#^Strict comparison using \=\=\= between App\\Enums\\PlatformEnum\:\:LEMMY and App\\Enums\\PlatformEnum\:\:LEMMY will always evaluate to true\.$#'
identifier: identical.alwaysTrue
count: 1
path: tests/Unit/Enums/PlatformEnumTest.php
-
message: '#^Access to an undefined property App\\Models\\PlatformChannel\:\:\$pivot\.$#'
identifier: property.notFound
count: 2
path: tests/Unit/Models/FeedTest.php
-
message: '#^Right side of \|\| is always true\.$#'
identifier: booleanOr.rightAlwaysTrue
count: 1
path: tests/Unit/Models/FeedTest.php
-
message: '#^Access to an undefined property App\\Models\\PlatformChannel\:\:\$pivot\.$#'
identifier: property.notFound
count: 6
path: tests/Unit/Models/PlatformAccountTest.php
-
message: '#^Access to an undefined property App\\Models\\Feed\:\:\$pivot\.$#'
identifier: property.notFound
count: 2
path: tests/Unit/Models/PlatformChannelTest.php
-
message: '#^Access to an undefined property App\\Models\\PlatformAccount\:\:\$pivot\.$#'
identifier: property.notFound
count: 6
path: tests/Unit/Models/PlatformChannelTest.php
-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertIsString\(\) with int will always evaluate to false\.$#'
identifier: method.impossibleType
count: 1
path: tests/Unit/Models/PlatformChannelTest.php
-
message: '#^Access to an undefined property App\\Models\\Language\:\:\$pivot\.$#'
identifier: property.notFound
count: 7
path: tests/Unit/Models/PlatformInstanceTest.php
-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with string will always evaluate to false\.$#'
identifier: method.impossibleType
count: 1
path: tests/Unit/Models/PlatformInstanceTest.php
-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with string will always evaluate to false\.$#'
identifier: method.impossibleType
count: 1
path: tests/Unit/Models/RouteTest.php
-
message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with int will always evaluate to false\.$#'
identifier: method.impossibleType
count: 1
path: tests/Unit/Services/ArticleFetcherTest.php

View file

@ -1,6 +1,7 @@
includes:
- vendor/larastan/larastan/extension.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- phpstan-baseline.neon
parameters:
level: 7

View file

@ -327,7 +327,7 @@ public function test_model_soft_deletes_work_correctly(): void
// Should find with withTrashed if model uses soft deletes
if (method_exists($feed, 'withTrashed')) {
$this->assertNotNull(Feed::withTrashed()->find($feedId)); // @phpstan-ignore staticMethod.notFound
$this->assertNotNull(Feed::withTrashed()->find($feedId));
}
}

View file

@ -44,7 +44,7 @@ public function test_creates_channel_and_attaches_account(): void
// Verify account is attached
$this->assertTrue($channel->platformAccounts->contains($account));
$this->assertEquals(1, $channel->platformAccounts->first()->pivot->priority); // @phpstan-ignore property.notFound
$this->assertEquals(1, $channel->platformAccounts->first()->pivot->priority);
}
public function test_creates_channel_without_language(): void
@ -57,7 +57,7 @@ public function test_creates_channel_without_language(): void
$channel = $this->action->execute('test_community', $instance->id);
$this->assertNull($channel->language_id); // @phpstan-ignore method.impossibleType
$this->assertNull($channel->language_id);
}
public function test_fails_when_no_active_accounts(): void

View file

@ -45,7 +45,7 @@ public function test_creates_belga_feed_with_correct_url(): void
$this->assertEquals('https://www.belganewsagency.eu/', $feed->url);
$this->assertEquals('website', $feed->type);
$this->assertEquals('belga', $feed->provider);
$this->assertNull($feed->description); // @phpstan-ignore method.impossibleType
$this->assertNull($feed->description);
}
public function test_creates_guardian_feed_with_correct_url(): void
@ -57,7 +57,7 @@ public function test_creates_guardian_feed_with_correct_url(): void
$this->assertEquals('https://www.theguardian.com/international/rss', $feed->url);
$this->assertEquals('rss', $feed->type);
$this->assertEquals('guardian', $feed->provider);
$this->assertNull($feed->description); // @phpstan-ignore method.impossibleType
$this->assertNull($feed->description);
}
public function test_creates_vrt_feed_with_dutch_language(): void

View file

@ -69,7 +69,7 @@ public function test_returns_existing_route_for_duplicate_feed_channel_pair(): v
$first = $this->action->execute($feed->id, $channel->id, 10);
$second = $this->action->execute($feed->id, $channel->id, 99);
$this->assertEquals($first->id, $second->id); // @phpstan-ignore property.notFound, property.notFound
$this->assertEquals($first->id, $second->id);
$this->assertEquals(10, $second->priority);
$this->assertDatabaseCount('routes', 1);
}

View file

@ -83,8 +83,8 @@ public function test_enum_can_be_compared(): void
$debug2 = LogLevelEnum::DEBUG;
$info = LogLevelEnum::INFO;
$this->assertTrue($debug1 === $debug2); // @phpstan-ignore identical.alwaysTrue
$this->assertFalse($debug1 === $info); // @phpstan-ignore identical.alwaysFalse, method.impossibleType
$this->assertTrue($debug1 === $debug2);
$this->assertFalse($debug1 === $info);
}
public function test_enum_can_be_used_in_match_expression(): void

View file

@ -54,7 +54,7 @@ public function test_enum_can_be_compared(): void
$lemmy1 = PlatformEnum::LEMMY;
$lemmy2 = PlatformEnum::LEMMY;
$this->assertTrue($lemmy1 === $lemmy2); // @phpstan-ignore identical.alwaysTrue
$this->assertTrue($lemmy1 === $lemmy2);
}
public function test_enum_can_be_used_in_match_expression(): void

View file

@ -171,8 +171,8 @@ public function test_belongs_to_many_channels_relationship(): void
// Test pivot data
$channel1FromRelation = $channels->find($channel1->id);
$this->assertEquals(1, $channel1FromRelation->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertEquals(100, $channel1FromRelation->pivot->priority); // @phpstan-ignore property.notFound
$this->assertEquals(1, $channel1FromRelation->pivot->is_active);
$this->assertEquals(100, $channel1FromRelation->pivot->priority);
}
public function test_active_channels_relationship(): void
@ -226,7 +226,7 @@ public function test_feed_creation_with_factory(): void
$this->assertIsString($feed->url);
$this->assertIsString($feed->type);
// Language ID may be null as it's nullable in the database
$this->assertTrue($feed->language_id === null || is_int($feed->language_id)); // @phpstan-ignore booleanOr.rightAlwaysTrue
$this->assertTrue($feed->language_id === null || is_int($feed->language_id));
$this->assertIsBool($feed->is_active);
$this->assertIsArray($feed->settings);
}

View file

@ -196,12 +196,12 @@ public function test_belongs_to_many_channels_relationship(): void
// Test pivot data
$channel1FromRelation = $channels->find($channel1->id);
$this->assertEquals(1, $channel1FromRelation->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertEquals(100, $channel1FromRelation->pivot->priority); // @phpstan-ignore property.notFound
$this->assertEquals(1, $channel1FromRelation->pivot->is_active);
$this->assertEquals(100, $channel1FromRelation->pivot->priority);
$channel2FromRelation = $channels->find($channel2->id);
$this->assertEquals(0, $channel2FromRelation->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertEquals(50, $channel2FromRelation->pivot->priority); // @phpstan-ignore property.notFound
$this->assertEquals(0, $channel2FromRelation->pivot->is_active);
$this->assertEquals(50, $channel2FromRelation->pivot->priority);
}
public function test_active_channels_relationship(): void
@ -392,8 +392,8 @@ public function test_account_can_have_multiple_channels_with_different_prioritie
// Test that we can access pivot data
foreach ($allChannels as $channel) {
$this->assertNotNull($channel->pivot->priority); // @phpstan-ignore property.notFound
$this->assertIsInt($channel->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertNotNull($channel->pivot->priority);
$this->assertIsInt($channel->pivot->is_active);
}
}

View file

@ -89,12 +89,12 @@ public function test_belongs_to_many_platform_accounts_relationship(): void
// Test pivot data
$account1FromRelation = $accounts->find($account1->id);
$this->assertEquals(1, $account1FromRelation->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertEquals(100, $account1FromRelation->pivot->priority); // @phpstan-ignore property.notFound
$this->assertEquals(1, $account1FromRelation->pivot->is_active);
$this->assertEquals(100, $account1FromRelation->pivot->priority);
$account2FromRelation = $accounts->find($account2->id);
$this->assertEquals(0, $account2FromRelation->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertEquals(50, $account2FromRelation->pivot->priority); // @phpstan-ignore property.notFound
$this->assertEquals(0, $account2FromRelation->pivot->is_active);
$this->assertEquals(50, $account2FromRelation->pivot->priority);
}
public function test_active_platform_accounts_relationship(): void
@ -168,8 +168,8 @@ public function test_belongs_to_many_feeds_relationship(): void
// Test pivot data
$feed1FromRelation = $feeds->find($feed1->id);
$this->assertEquals(1, $feed1FromRelation->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertEquals(100, $feed1FromRelation->pivot->priority); // @phpstan-ignore property.notFound
$this->assertEquals(1, $feed1FromRelation->pivot->is_active);
$this->assertEquals(100, $feed1FromRelation->pivot->priority);
}
public function test_active_feeds_relationship(): void
@ -221,7 +221,7 @@ public function test_channel_creation_with_factory(): void
$this->assertInstanceOf(PlatformChannel::class, $channel);
$this->assertNotNull($channel->platform_instance_id);
$this->assertIsString($channel->name);
$this->assertIsString($channel->channel_id); // @phpstan-ignore method.impossibleType
$this->assertIsString($channel->channel_id);
$this->assertIsBool($channel->is_active);
}
@ -331,8 +331,8 @@ public function test_channel_can_have_multiple_accounts_with_different_prioritie
// Test that we can access pivot data
foreach ($allAccounts as $account) {
$this->assertNotNull($account->pivot->priority); // @phpstan-ignore property.notFound
$this->assertIsInt($account->pivot->is_active); // @phpstan-ignore property.notFound
$this->assertNotNull($account->pivot->priority);
$this->assertIsInt($account->pivot->is_active);
}
}
}

View file

@ -95,12 +95,12 @@ public function test_belongs_to_many_languages_relationship(): void
// Test pivot data
$language1FromRelation = $languages->find($language1->id);
$this->assertEquals(1, $language1FromRelation->pivot->platform_language_id); // @phpstan-ignore property.notFound
$this->assertEquals(1, $language1FromRelation->pivot->is_default); // @phpstan-ignore property.notFound
$this->assertEquals(1, $language1FromRelation->pivot->platform_language_id);
$this->assertEquals(1, $language1FromRelation->pivot->is_default);
$language2FromRelation = $languages->find($language2->id);
$this->assertEquals(2, $language2FromRelation->pivot->platform_language_id); // @phpstan-ignore property.notFound
$this->assertEquals(0, $language2FromRelation->pivot->is_default); // @phpstan-ignore property.notFound
$this->assertEquals(2, $language2FromRelation->pivot->platform_language_id);
$this->assertEquals(0, $language2FromRelation->pivot->is_default);
}
public function test_find_by_url_static_method(): void
@ -219,7 +219,7 @@ public function test_instance_can_have_null_description(): void
{
$instance = PlatformInstance::factory()->create(['description' => null]);
$this->assertNull($instance->description); // @phpstan-ignore method.impossibleType
$this->assertNull($instance->description);
}
public function test_instance_can_have_empty_description(): void
@ -274,12 +274,12 @@ public function test_instance_can_have_multiple_languages(): void
// Test that we can access pivot data
foreach ($languages as $language) {
$this->assertNotNull($language->pivot->platform_language_id); // @phpstan-ignore property.notFound
$this->assertContains($language->pivot->is_default, [0, 1, true, false]); // @phpstan-ignore property.notFound
$this->assertNotNull($language->pivot->platform_language_id);
$this->assertContains($language->pivot->is_default, [0, 1, true, false]);
}
// Only one should be default
$defaultLanguages = $languages->filter(fn ($lang) => $lang->pivot->is_default); // @phpstan-ignore property.notFound
$defaultLanguages = $languages->filter(fn ($lang) => $lang->pivot->is_default);
$this->assertCount(1, $defaultLanguages);
}

View file

@ -47,7 +47,7 @@ public function test_primary_key_configuration(): void
{
$route = new Route;
$this->assertNull($route->getKeyName()); // @phpstan-ignore method.impossibleType
$this->assertNull($route->getKeyName());
$this->assertFalse($route->getIncrementing());
}

View file

@ -261,7 +261,7 @@ public function test_save_article_without_feed_id(): void
$this->assertInstanceOf(Article::class, $article);
$this->assertEquals($url, $article->url);
$this->assertNull($article->feed_id); // @phpstan-ignore method.impossibleType
$this->assertNull($article->feed_id);
$this->assertDatabaseHas('articles', ['url' => $url, 'feed_id' => null]);
}