From 1fb07bd02af59ab2f991c23c29158f063b624e04 Mon Sep 17 00:00:00 2001 From: Alwin Drenth Date: Tue, 6 Jul 2021 13:40:56 +0200 Subject: [PATCH 1/5] Fix error when performing a migration rollback --- updates/20200206_0006_remove_unique_constraint_from_items.php | 2 +- updates/version.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/updates/20200206_0006_remove_unique_constraint_from_items.php b/updates/20200206_0006_remove_unique_constraint_from_items.php index ca1fd35..93e36bd 100644 --- a/updates/20200206_0006_remove_unique_constraint_from_items.php +++ b/updates/20200206_0006_remove_unique_constraint_from_items.php @@ -19,7 +19,7 @@ public function up(): void public function down(): void { - Schema::table('vdlp_rssfetcher_sources', static function (Blueprint $table) { + Schema::table('vdlp_rssfetcher_items', static function (Blueprint $table) { $table->unique('item_id', 'item_id_unique'); }); } diff --git a/updates/version.yaml b/updates/version.yaml index 128a72e..c74bcb8 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -19,3 +19,4 @@ - "Replace Zend Framework with Laminas and added events" 2.1.0: "Fix Author parsing for Atom/RSS feeds" 2.2.0: Update plugin dependencies (minimum required PHP version 7.3) +2.2.1: "Fix error when performing a migration rollback" From 98b526116a7bc0e915009f4df358d825ac06ed44 Mon Sep 17 00:00:00 2001 From: Alwin Drenth Date: Tue, 6 Jul 2021 13:41:12 +0200 Subject: [PATCH 2/5] Improve code of migration files --- updates/20180718_0001_create_sources_table.php | 2 +- updates/20180718_0002_create_items_table.php | 2 +- updates/20180718_0003_seed_feeds_table.php | 2 +- updates/20180718_0004_seed_sources_table.php | 8 ++++---- ...81012_0005_move_publish_new_items_to_sources_table.php | 2 +- .../20200206_0006_remove_unique_constraint_from_items.php | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/updates/20180718_0001_create_sources_table.php b/updates/20180718_0001_create_sources_table.php index 7b36d66..332abd1 100644 --- a/updates/20180718_0001_create_sources_table.php +++ b/updates/20180718_0001_create_sources_table.php @@ -6,7 +6,7 @@ use Illuminate\Database\Schema\Blueprint; use October\Rain\Database\Updates\Migration; -use Schema; +use October\Rain\Support\Facades\Schema; class CreateSourcesTable extends Migration { diff --git a/updates/20180718_0002_create_items_table.php b/updates/20180718_0002_create_items_table.php index dd7aae6..7dbac1a 100644 --- a/updates/20180718_0002_create_items_table.php +++ b/updates/20180718_0002_create_items_table.php @@ -6,7 +6,7 @@ use Illuminate\Database\Schema\Blueprint; use October\Rain\Database\Updates\Migration; -use Schema; +use October\Rain\Support\Facades\Schema; class CreateItemsTable extends Migration { diff --git a/updates/20180718_0003_seed_feeds_table.php b/updates/20180718_0003_seed_feeds_table.php index 311b802..70aae28 100644 --- a/updates/20180718_0003_seed_feeds_table.php +++ b/updates/20180718_0003_seed_feeds_table.php @@ -6,7 +6,7 @@ use Illuminate\Database\Schema\Blueprint; use October\Rain\Database\Updates\Migration; -use Schema; +use October\Rain\Support\Facades\Schema; class CreateFeedsTable extends Migration { diff --git a/updates/20180718_0004_seed_sources_table.php b/updates/20180718_0004_seed_sources_table.php index 47cd661..48a594a 100644 --- a/updates/20180718_0004_seed_sources_table.php +++ b/updates/20180718_0004_seed_sources_table.php @@ -14,28 +14,28 @@ public function run(): void Source::create([ 'name' => 'NU.nl | Algemeen nieuws', 'description' => 'NU.nl | Algemeen nieuws', - 'source_url' => 'http://www.nu.nl/rss/Algemeen', + 'source_url' => 'https://www.nu.nl/rss/Algemeen', 'max_items' => 10, 'is_enabled' => true, ]); Source::create([ 'name' => 'NU.nl | Internet', 'description' => 'NU.nl | Internet', - 'source_url' => 'http://www.nu.nl/rss/Internet', + 'source_url' => 'https://www.nu.nl/rss/Internet', 'max_items' => 10, 'is_enabled' => true, ]); Source::create([ 'name' => 'Tweakers.net', 'description' => 'Tweakers.net is sinds 1998 de grootste website in Nederland over technologie en elektronica met nieuws, reviews en de bekroonde Pricewatch.', - 'source_url' => 'http://feeds.feedburner.com/tweakers/mixed', + 'source_url' => 'https://feeds.feedburner.com/tweakers/mixed', 'max_items' => 10, 'is_enabled' => true, ]); Source::create([ 'name' => 'Laravel News Blog', 'description' => 'Laravel News Blog', - 'source_url' => 'http://feed.laravel-news.com/', + 'source_url' => 'https://feed.laravel-news.com/', 'max_items' => 10, 'is_enabled' => true, ]); diff --git a/updates/20181012_0005_move_publish_new_items_to_sources_table.php b/updates/20181012_0005_move_publish_new_items_to_sources_table.php index ab1d872..762f7da 100644 --- a/updates/20181012_0005_move_publish_new_items_to_sources_table.php +++ b/updates/20181012_0005_move_publish_new_items_to_sources_table.php @@ -6,7 +6,7 @@ use Illuminate\Database\Schema\Blueprint; use October\Rain\Database\Updates\Migration; -use Schema; +use October\Rain\Support\Facades\Schema; class MovePublishNewItemsToSourcesTable extends Migration { diff --git a/updates/20200206_0006_remove_unique_constraint_from_items.php b/updates/20200206_0006_remove_unique_constraint_from_items.php index 93e36bd..d153ed0 100644 --- a/updates/20200206_0006_remove_unique_constraint_from_items.php +++ b/updates/20200206_0006_remove_unique_constraint_from_items.php @@ -6,7 +6,7 @@ use Illuminate\Database\Schema\Blueprint; use October\Rain\Database\Updates\Migration; -use Schema; +use October\Rain\Support\Facades\Schema; class RemoveUniqueConstraintFromItems extends Migration { From 6578e50ca4e747edd625d781e32e47264efe8434 Mon Sep 17 00:00:00 2001 From: Alwin Drenth Date: Tue, 6 Jul 2021 13:41:19 +0200 Subject: [PATCH 3/5] Apply code formatting to composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 0ad9416..1ff2a59 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "vdlp/oc-rssfetcher-plugin", - "description": "Fetches RSS headlines from various sources to put on your website", + "description": "Fetches RSS headlines from various sources to put on your website.", "type": "october-plugin", "keywords": ["october", "cms", "rss", "plugin"], "license": "GPL-2.0", @@ -15,7 +15,7 @@ } ], "require": { - "php": "^7.3||^8.0", + "php": "^7.3 || ^8.0", "laminas/laminas-feed": "^2.14", "laminas/laminas-http": "^2.14", "composer/installers": "^1.0" From 4518aaf5d342c8adac9ae70fa5264ffe55d22dc7 Mon Sep 17 00:00:00 2001 From: Alwin Drenth Date: Tue, 6 Jul 2021 13:50:46 +0200 Subject: [PATCH 4/5] Code readability improvements --- classes/RssFetcher.php | 21 ------------- commands/FetchRssCommand.php | 28 +++++------------ components/Items.php | 18 ----------- components/PaginatableItems.php | 16 ---------- components/Sources.php | 13 -------- composer.json | 7 +++++ controllers/Feeds.php | 18 ----------- controllers/Items.php | 38 ---------------------- controllers/Sources.php | 40 ------------------------ exceptions/SourceNotEnabledException.php | 4 +-- formwidgets/TextWithPrefix.php | 15 --------- models/Feed.php | 6 ---- models/Item.php | 23 +++----------- models/Source.php | 19 +++-------- models/SourceExport.php | 6 ---- models/SourceImport.php | 6 ---- reportwidgets/Headlines.php | 13 -------- 17 files changed, 26 insertions(+), 265 deletions(-) diff --git a/classes/RssFetcher.php b/classes/RssFetcher.php index 5b39b7b..46a0d75 100644 --- a/classes/RssFetcher.php +++ b/classes/RssFetcher.php @@ -33,20 +33,12 @@ final class RssFetcher */ private $dispatcher; - /** - * {@inheritDoc} - */ protected function init(): void { $this->log = resolve(LoggerInterface::class); $this->dispatcher = resolve(Dispatcher::class); } - /** - * Run the fetching logic. - * - * @param int|null $sourceId - */ public function fetch(int $sourceId = null): void { $sources = $this->getSourceCollection($sourceId); @@ -59,10 +51,6 @@ public function fetch(int $sourceId = null): void }); } - /** - * @param Source $source - * @throws Exception - */ private function fetchSource(Source $source): void { $channel = Reader::import($source->getAttribute('source_url')); @@ -127,11 +115,6 @@ private function fetchSource(Source $source): void $source->save(); } - /** - * @param FeedInterface $feed - * @param EntryInterface $entry - * @return string|null - */ private function getAuthor(FeedInterface $feed, EntryInterface $entry): ?string { $result = null; @@ -150,10 +133,6 @@ private function getAuthor(FeedInterface $feed, EntryInterface $entry): ?string return $result; } - /** - * @param int|null $sourceId - * @return Collection - */ private function getSourceCollection(int $sourceId = null): Collection { $sources = new Collection(); diff --git a/commands/FetchRssCommand.php b/commands/FetchRssCommand.php index 4e47163..0e14c53 100644 --- a/commands/FetchRssCommand.php +++ b/commands/FetchRssCommand.php @@ -1,7 +1,5 @@ name = 'vdlp:fetch-rss'; + $this->description = 'Fetches RSS data from various sources.'; + + parent::__construct(); + } + public function handle(): void { $sourceId = (int) $this->argument('source'); @@ -34,9 +25,6 @@ public function handle(): void RssFetcher::instance()->fetch($sourceId > 0 ? $sourceId : null); } - /** - * {@inheritDoc} - */ protected function getArguments(): array { return [ diff --git a/components/Items.php b/components/Items.php index 9cb326e..98f0af1 100644 --- a/components/Items.php +++ b/components/Items.php @@ -1,7 +1,5 @@ property('sourceId'); @@ -61,13 +50,6 @@ public function onRun(): void ); } - /** - * Load Items - * - * @param int $maxItems - * @param int $sourceId - * @return array - */ public static function loadItems(int $maxItems, int $sourceId = null): array { try { diff --git a/components/PaginatableItems.php b/components/PaginatableItems.php index 7863582..bb89406 100644 --- a/components/PaginatableItems.php +++ b/components/PaginatableItems.php @@ -1,7 +1,5 @@ items = $this->loadItems(); } - /** - * Load Items - * - * @return LengthAwarePaginator - */ protected function loadItems(): LengthAwarePaginator { try { diff --git a/components/Sources.php b/components/Sources.php index 9a9216d..8c4e7ba 100644 --- a/components/Sources.php +++ b/components/Sources.php @@ -1,7 +1,5 @@ sources = $this->page['sources'] = self::loadSources(); } - /** - * Load Sources - * - * @return array - */ public static function loadSources(): array { try { diff --git a/composer.json b/composer.json index 1ff2a59..4b9e679 100644 --- a/composer.json +++ b/composer.json @@ -19,5 +19,12 @@ "laminas/laminas-feed": "^2.14", "laminas/laminas-http": "^2.14", "composer/installers": "^1.0" + }, + "archive": { + "exclude": [ + ".gitignore", + ".idea/", + ".github/" + ] } } diff --git a/controllers/Feeds.php b/controllers/Feeds.php index 493db13..f5bbe2b 100644 --- a/controllers/Feeds.php +++ b/controllers/Feeds.php @@ -10,38 +10,20 @@ use Backend\Classes\NavigationManager; /** - * Class Feeds * @mixin FormController * @mixin ListController */ class Feeds extends Controller { - /** - * {@inheritDoc} - */ public $implement = [ FormController::class, ListController::class, ]; - /** - * {@inheritDoc} - */ public $formConfig = 'config_form.yaml'; - - /** - * {@inheritDoc} - */ public $listConfig = 'config_list.yaml'; - - /** - * {@inheritDoc} - */ protected $requiredPermissions = ['vdlp.rssfetcher.access_feeds']; - /** - * {@inheritDoc} - */ public function __construct() { parent::__construct(); diff --git a/controllers/Items.php b/controllers/Items.php index 1ed8432..372accb 100644 --- a/controllers/Items.php +++ b/controllers/Items.php @@ -8,42 +8,23 @@ use Backend\Behaviors\ListController; use Backend\Classes\Controller; use Backend\Classes\NavigationManager; -use Exception; use Vdlp\RssFetcher\Models\Item; /** - * Class Items * @mixin FormController * @mixin ListController */ class Items extends Controller { - /** - * {@inheritDoc} - */ public $implement = [ FormController::class, ListController::class, ]; - /** - * {@inheritDoc} - */ public $listConfig = 'config_list.yaml'; - - /** - * {@inheritDoc} - */ public $formConfig = 'config_form.yaml'; - - /** - * {@inheritDoc} - */ protected $requiredPermissions = ['vdlp.rssfetcher.access_items']; - /** - * {@inheritDoc} - */ public function __construct() { parent::__construct(); @@ -53,10 +34,6 @@ public function __construct() // @codingStandardsIgnoreStart - /** - * @return array - * @throws Exception - */ public function index_onDelete(): array { foreach ($this->getCheckedIds() as $sourceId) { @@ -70,17 +47,11 @@ public function index_onDelete(): array return $this->listRefresh(); } - /** - * @return array - */ public function index_onPublish(): array { return $this->publishItem(true); } - /** - * @return array - */ public function index_onUnpublish(): array { return $this->publishItem(false); @@ -88,10 +59,6 @@ public function index_onUnpublish(): array // @codingStandardsIgnoreEnd - /** - * @param $publish - * @return array - */ private function publishItem($publish): array { foreach ($this->getCheckedIds() as $sourceId) { @@ -105,11 +72,6 @@ private function publishItem($publish): array return $this->listRefresh(); } - /** - * Check checked ID's from POST request. - * - * @return array - */ private function getCheckedIds(): array { if (($checkedIds = post('checked')) diff --git a/controllers/Sources.php b/controllers/Sources.php index 5184e63..d877983 100644 --- a/controllers/Sources.php +++ b/controllers/Sources.php @@ -18,40 +18,21 @@ use Vdlp\RssFetcher\Models\Source; /** - * Sources Back-end Controller * @mixin FormController * @mixin ListController * @mixin ImportExportController */ class Sources extends Controller { - /** - * {@inheritDoc} - */ public $implement = [ FormController::class, ListController::class, ImportExportController::class, ]; - /** - * {@inheritDoc} - */ public $formConfig = 'config_form.yaml'; - - /** - * {@inheritDoc} - */ public $listConfig = 'config_list.yaml'; - - /** - * {@inheritDoc} - */ public $importExportConfig = 'config_import_export.yaml'; - - /** - * {@inheritDoc} - */ protected $requiredPermissions = ['vdlp.rssfetcher.access_sources']; /** @@ -64,9 +45,6 @@ class Sources extends Controller */ private $translator; - /** - * {@inheritDoc} - */ public function __construct() { parent::__construct(); @@ -77,12 +55,6 @@ public function __construct() NavigationManager::instance()->setContext('Vdlp.RssFetcher', 'rssfetcher', 'sources'); } - /** - * Fetches RSS items from source - * - * @throws ApplicationException - * @return array - */ public function onFetch(): array { try { @@ -112,9 +84,6 @@ public function onFetch(): array // @codingStandardsIgnoreStart - /** - * @return array - */ public function index_onBulkFetch(): array { foreach ($this->getCheckedIds() as $sourceId) { @@ -136,10 +105,6 @@ public function index_onBulkFetch(): array return $this->listRefresh(); } - /** - * @return array - * @throws Exception - */ public function index_onDelete(): array { foreach ($this->getCheckedIds() as $sourceId) { @@ -155,11 +120,6 @@ public function index_onDelete(): array // @codingStandardsIgnoreEnd - /** - * Check checked ID's from POST request. - * - * @return array - */ private function getCheckedIds(): array { if (($checkedIds = post('checked')) diff --git a/exceptions/SourceNotEnabledException.php b/exceptions/SourceNotEnabledException.php index d640717..a052c0e 100644 --- a/exceptions/SourceNotEnabledException.php +++ b/exceptions/SourceNotEnabledException.php @@ -4,9 +4,9 @@ namespace Vdlp\RssFetcher\Exceptions; -use Exception; +use RuntimeException; -class SourceNotEnabledException extends Exception +class SourceNotEnabledException extends RuntimeException { } diff --git a/formwidgets/TextWithPrefix.php b/formwidgets/TextWithPrefix.php index 7b5b72b..3fd8a28 100644 --- a/formwidgets/TextWithPrefix.php +++ b/formwidgets/TextWithPrefix.php @@ -1,7 +1,5 @@ formField->config['prefix'] = '/feeds/'; } - /** - * {@inheritDoc} - * @throws SystemException - */ public function render() { $this->prepareVars(); @@ -35,9 +23,6 @@ public function render() return $this->makePartial('textwithprefix'); } - /** - * Prepares the form widget view data - */ public function prepareVars(): void { $this->vars['name'] = $this->formField->getName(); diff --git a/models/Feed.php b/models/Feed.php index b29bbe4..6209f8d 100644 --- a/models/Feed.php +++ b/models/Feed.php @@ -11,14 +11,8 @@ class Feed extends Model { use Validation; - /** - * {@inheritDoc} - */ public $table = 'vdlp_rssfetcher_feeds'; - /** - * {@inheritDoc} - */ public $belongsToMany = [ 'sources' => [ Source::class, diff --git a/models/Item.php b/models/Item.php index 70af195..1bc5a21 100644 --- a/models/Item.php +++ b/models/Item.php @@ -9,14 +9,12 @@ class Item extends Model { - /** - * {@inheritDoc} - */ public $table = 'vdlp_rssfetcher_items'; - /** - * {@inheritDoc} - */ + public $belongsTo = [ + 'source' => Source::class + ]; + protected $fillable = [ 'source_id', 'item_id', @@ -33,27 +31,14 @@ class Item extends Model 'is_published', ]; - /** - * {@inheritDoc} - */ protected $casts = [ 'enclosure_length' => 'integer' ]; - /** - * {@inheritDoc} - */ protected $dates = [ 'pub_date' ]; - /** - * {@inheritDoc} - */ - public $belongsTo = [ - 'source' => Source::class - ]; - /** * Allows filtering for specific sources * diff --git a/models/Source.php b/models/Source.php index de8aa9e..2ddd675 100644 --- a/models/Source.php +++ b/models/Source.php @@ -11,18 +11,8 @@ class Source extends Model { use Validation; - /** - * {@inheritDoc} - */ public $table = 'vdlp_rssfetcher_sources'; - /** - * {@inheritDoc} - */ - protected $dates = [ - 'fetched_at', - ]; - /** * @var array */ @@ -31,9 +21,6 @@ class Source extends Model 'source_url' => 'required', ]; - /** - * {@inheritDoc} - */ public $hasMany = [ 'items' => [ Item::class, @@ -41,6 +28,10 @@ class Source extends Model 'items_count' => [ Item::class, 'count' => true, - ] + ], + ]; + + protected $dates = [ + 'fetched_at', ]; } diff --git a/models/SourceExport.php b/models/SourceExport.php index deae5ff..d76bc1c 100644 --- a/models/SourceExport.php +++ b/models/SourceExport.php @@ -8,14 +8,8 @@ class SourceExport extends ExportModel { - /** - * {@inheritDoc} - */ public $table = 'vdlp_rssfetcher_sources'; - /** - * {@inheritDoc} - */ public function exportData($columns, $sessionKey = null): array { return self::make()->query()->get()->toArray(); diff --git a/models/SourceImport.php b/models/SourceImport.php index 651f4be..b06603a 100644 --- a/models/SourceImport.php +++ b/models/SourceImport.php @@ -9,9 +9,6 @@ class SourceImport extends ImportModel { - /** - * {@inheritDoc} - */ public $table = 'vdlp_rssfetcher_sources'; /** @@ -22,9 +19,6 @@ class SourceImport extends ImportModel 'source_url' => 'required', ]; - /** - * {@inheritDoc} - */ public function importData($results, $sessionKey = null) { foreach ((array) $results as $row => $data) { diff --git a/reportwidgets/Headlines.php b/reportwidgets/Headlines.php index 1de6c20..177c62d 100644 --- a/reportwidgets/Headlines.php +++ b/reportwidgets/Headlines.php @@ -1,21 +1,15 @@ vars['title'] = $this->property('title'); From 9f55ea5022975acc68917326667d5258b58d63a1 Mon Sep 17 00:00:00 2001 From: Alwin Drenth Date: Tue, 6 Jul 2021 14:16:38 +0200 Subject: [PATCH 5/5] Upgrade code to fully support PHP 7.4 --- .github/workflows/php.yml | 2 +- CHANGELOG.md | 10 +++- Plugin.php | 23 +------- classes/RssFetcher.php | 33 ++++------- commands/FetchRssCommand.php | 2 +- components/Items.php | 9 +-- components/PaginatableItems.php | 10 ++-- components/Sources.php | 7 +-- composer.json | 2 +- controllers/Feeds.php | 6 +- controllers/Items.php | 43 ++++++++------- controllers/Sources.php | 55 ++++++++----------- formwidgets/TextWithPrefix.php | 2 +- http/controllers/FeedController.php | 35 ++++-------- models/Feed.php | 7 +-- models/Item.php | 17 ++---- models/Source.php | 7 +-- models/SourceExport.php | 2 +- models/SourceImport.php | 7 +-- reportwidgets/Headlines.php | 4 +- .../20180718_0001_create_sources_table.php | 2 +- updates/20180718_0002_create_items_table.php | 2 +- updates/20180718_0003_seed_feeds_table.php | 4 +- updates/20180718_0004_seed_sources_table.php | 3 + ...ove_publish_new_items_to_sources_table.php | 8 +-- ...06_remove_unique_constraint_from_items.php | 4 +- updates/version.yaml | 1 + 27 files changed, 124 insertions(+), 183 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 0423d3f..b1c4618 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: true matrix: - php: [ 8.0, 7.4, 7.3 ] + php: [ 8.0, 7.4 ] stability: [ prefer-lowest, prefer-stable ] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e318d78..53a1dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ +# 3.0.0 + +- Drop support for PHP 7.4 (minimum required PHP version 7.4). + +# 2.2.1 + +- Fix error when performing a migration rollback. + # 2.2.0 -- Update plugin dependencies (minimum required PHP version 7.3) +- Update plugin dependencies (minimum required PHP version 7.3). # 2.1.0 diff --git a/Plugin.php b/Plugin.php index 4147ba8..fae284c 100644 --- a/Plugin.php +++ b/Plugin.php @@ -9,9 +9,6 @@ class Plugin extends PluginBase { - /** - * {@inheritDoc} - */ public function pluginDetails(): array { return [ @@ -23,17 +20,11 @@ public function pluginDetails(): array ]; } - /** - * {@inheritDoc} - */ public function register(): void { $this->registerConsoleCommand('Vdlp.RssFetcher', Commands\FetchRssCommand::class); } - /** - * {@inheritDoc} - */ public function registerComponents(): array { return [ @@ -43,22 +34,16 @@ public function registerComponents(): array ]; } - /** - * {@inheritDoc} - */ public function registerReportWidgets(): array { return [ ReportWidgets\Headlines::class => [ 'label' => 'RSS Headlines', 'code' => 'headlines', - ] + ], ]; } - /** - * {@inheritDoc} - */ public function registerPermissions(): array { return [ @@ -81,9 +66,6 @@ public function registerPermissions(): array ]; } - /** - * {@inheritDoc} - */ public function registerNavigation(): array { /** @var BackendHelper $backendHelper */ @@ -120,9 +102,6 @@ public function registerNavigation(): array ]; } - /** - * {@inheritDoc} - */ public function registerFormWidgets(): array { return [ diff --git a/classes/RssFetcher.php b/classes/RssFetcher.php index 46a0d75..f914199 100644 --- a/classes/RssFetcher.php +++ b/classes/RssFetcher.php @@ -5,13 +5,12 @@ namespace Vdlp\RssFetcher\Classes; use Carbon\Carbon; -use Exception; -use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Support\Collection; use Laminas\Feed\Reader\Entry\EntryInterface; use Laminas\Feed\Reader\Entry\Rss; use Laminas\Feed\Reader\Feed\FeedInterface; use Laminas\Feed\Reader\Reader; +use October\Rain\Support\Facades\Event; use October\Rain\Support\Traits\Singleton; use Psr\Log\LoggerInterface; use stdClass; @@ -23,26 +22,18 @@ final class RssFetcher { use Singleton; - /** - * @var LoggerInterface - */ - private $log; - - /** - * @var Dispatcher - */ - private $dispatcher; + private LoggerInterface $log; protected function init(): void { $this->log = resolve(LoggerInterface::class); - $this->dispatcher = resolve(Dispatcher::class); } - public function fetch(int $sourceId = null): void + public function fetch(?int $sourceId = null): void { $sources = $this->getSourceCollection($sourceId); - $sources->each(function (Source $source) { + + $sources->each(function (Source $source): void { try { $this->fetchSource($source); } catch (Throwable $e) { @@ -65,13 +56,13 @@ private function fetchSource(Source $source): void $dateCreated = $item->getDateCreated(); $title = $item->getTitle(); - $this->dispatcher->fire('vdlp.rssfetcher.item.processTitle', [&$title]); + Event::dispatch('vdlp.rssfetcher.item.processTitle', [&$title]); $content = $item->getContent(); - $this->dispatcher->fire('vdlp.rssfetcher.item.processContent', [&$content]); + Event::dispatch('vdlp.rssfetcher.item.processContent', [&$content]); $link = $item->getLink(); - $this->dispatcher->fire('vdlp.rssfetcher.item.processLink', [&$link]); + Event::dispatch('vdlp.rssfetcher.item.processLink', [&$link]); $attributes = [ 'item_id' => $item->getId(), @@ -81,7 +72,7 @@ private function fetchSource(Source $source): void 'description' => $content, 'category' => implode(', ', $item->getCategories()->getValues()), 'comments' => $item->getCommentLink(), - 'pub_date' => $dateCreated !== null ? $item->getDateCreated()->format('Y-m-d H:i:s') : null, + 'pub_date' => $dateCreated !== null ? $dateCreated->format('Y-m-d H:i:s') : null, 'is_published' => (bool) $source->getAttribute('publish_new_items'), 'author' => $this->getAuthor($channel, $item), ]; @@ -120,7 +111,7 @@ private function getAuthor(FeedInterface $feed, EntryInterface $entry): ?string $result = null; $author = $entry->getAuthor(); - if ($author === null || empty($author)) { + if ($author === null || count($author) === 0) { $author = $feed->getAuthor(); } @@ -133,7 +124,7 @@ private function getAuthor(FeedInterface $feed, EntryInterface $entry): ?string return $result; } - private function getSourceCollection(int $sourceId = null): Collection + private function getSourceCollection(?int $sourceId = null): Collection { $sources = new Collection(); @@ -143,7 +134,7 @@ private function getSourceCollection(int $sourceId = null): Collection ->where('is_enabled', '=', true) ->first(); - if ($source) { + if ($source !== null) { $sources = new Collection([$source]); } } else { diff --git a/commands/FetchRssCommand.php b/commands/FetchRssCommand.php index 0e14c53..05bd856 100644 --- a/commands/FetchRssCommand.php +++ b/commands/FetchRssCommand.php @@ -8,7 +8,7 @@ use Symfony\Component\Console\Input\InputArgument; use Vdlp\RssFetcher\Classes\RssFetcher; -class FetchRssCommand extends Command +final class FetchRssCommand extends Command { public function __construct() { diff --git a/components/Items.php b/components/Items.php index 98f0af1..0187091 100644 --- a/components/Items.php +++ b/components/Items.php @@ -9,12 +9,9 @@ use Throwable; use Vdlp\RssFetcher\Models\Item; -class Items extends ComponentBase +final class Items extends ComponentBase { - /** - * @var Collection - */ - public $items; + public ?Collection $items = null; public function componentDetails(): array { @@ -45,7 +42,7 @@ public function onRun(): void $sourceId = (int) $this->property('sourceId'); $this->items = self::loadItems( - (int) $this->property('maxItems', 10), + (int) $this->property('maxItems', '10'), $sourceId > 0 ? $sourceId : null ); } diff --git a/components/PaginatableItems.php b/components/PaginatableItems.php index bb89406..a3c9c4c 100644 --- a/components/PaginatableItems.php +++ b/components/PaginatableItems.php @@ -5,16 +5,14 @@ namespace Vdlp\RssFetcher\Components; use Cms\Classes\ComponentBase; +use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Pagination\LengthAwarePaginator; use Throwable; use Vdlp\RssFetcher\Models\Item; -class PaginatableItems extends ComponentBase +final class PaginatableItems extends ComponentBase { - /** - * @var LengthAwarePaginator - */ - public $items; + public ?Paginator $items = null; public function componentDetails(): array { @@ -42,7 +40,7 @@ public function onRun(): void $this->items = $this->loadItems(); } - protected function loadItems(): LengthAwarePaginator + private function loadItems(): Paginator { try { $items = Item::query() diff --git a/components/Sources.php b/components/Sources.php index 8c4e7ba..1b1a356 100644 --- a/components/Sources.php +++ b/components/Sources.php @@ -9,12 +9,9 @@ use Throwable; use Vdlp\RssFetcher\Models\Source; -class Sources extends ComponentBase +final class Sources extends ComponentBase { - /** - * @var Collection - */ - public $sources; + public ?Collection $sources = null; public function componentDetails(): array { diff --git a/composer.json b/composer.json index 4b9e679..230c4df 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "laminas/laminas-feed": "^2.14", "laminas/laminas-http": "^2.14", "composer/installers": "^1.0" diff --git a/controllers/Feeds.php b/controllers/Feeds.php index f5bbe2b..8af2503 100644 --- a/controllers/Feeds.php +++ b/controllers/Feeds.php @@ -13,15 +13,15 @@ * @mixin FormController * @mixin ListController */ -class Feeds extends Controller +final class Feeds extends Controller { public $implement = [ FormController::class, ListController::class, ]; - public $formConfig = 'config_form.yaml'; - public $listConfig = 'config_list.yaml'; + public string $formConfig = 'config_form.yaml'; + public string $listConfig = 'config_list.yaml'; protected $requiredPermissions = ['vdlp.rssfetcher.access_feeds']; public function __construct() diff --git a/controllers/Items.php b/controllers/Items.php index 372accb..96160d9 100644 --- a/controllers/Items.php +++ b/controllers/Items.php @@ -14,15 +14,15 @@ * @mixin FormController * @mixin ListController */ -class Items extends Controller +final class Items extends Controller { public $implement = [ FormController::class, ListController::class, ]; - public $listConfig = 'config_list.yaml'; - public $formConfig = 'config_form.yaml'; + public string $listConfig = 'config_list.yaml'; + public string $formConfig = 'config_form.yaml'; protected $requiredPermissions = ['vdlp.rssfetcher.access_items']; public function __construct() @@ -32,41 +32,43 @@ public function __construct() NavigationManager::instance()->setContext('Vdlp.RssFetcher', 'rssfetcher', 'items'); } - // @codingStandardsIgnoreStart - - public function index_onDelete(): array + public function onDelete(): array { - foreach ($this->getCheckedIds() as $sourceId) { - if (!$source = Item::query()->find($sourceId)) { + foreach ($this->getCheckedIds() as $itemId) { + /** @var ?Item $item */ + $item = Item::query()->find($itemId); + + if ($item === null) { continue; } - $source->delete(); + $item->delete(); } return $this->listRefresh(); } - public function index_onPublish(): array + public function onPublish(): array { return $this->publishItem(true); } - public function index_onUnpublish(): array + public function onUnpublish(): array { return $this->publishItem(false); } - // @codingStandardsIgnoreEnd - - private function publishItem($publish): array + private function publishItem(bool $publish): array { - foreach ($this->getCheckedIds() as $sourceId) { - if (!$source = Item::query()->find($sourceId)) { + foreach ($this->getCheckedIds() as $itemId) { + /** @var ?Item $item */ + $item = Item::query()->find($itemId); + + if ($item === null) { continue; } - $source->update(['is_published' => $publish]); + $item->update(['is_published' => $publish]); } return $this->listRefresh(); @@ -74,10 +76,9 @@ private function publishItem($publish): array private function getCheckedIds(): array { - if (($checkedIds = post('checked')) - && is_array($checkedIds) - && count($checkedIds) - ) { + $checkedIds = post('checked'); + + if (is_array($checkedIds) && count($checkedIds) > 0) { return $checkedIds; } diff --git a/controllers/Sources.php b/controllers/Sources.php index d877983..55d6de1 100644 --- a/controllers/Sources.php +++ b/controllers/Sources.php @@ -9,10 +9,10 @@ use Backend\Behaviors\ListController; use Backend\Classes\Controller; use Backend\Classes\NavigationManager; -use Exception; use October\Rain\Exception\ApplicationException; use October\Rain\Flash\FlashBag; use October\Rain\Translation\Translator; +use Throwable; use Vdlp\RssFetcher\Classes\RssFetcher; use Vdlp\RssFetcher\Exceptions\SourceNotEnabledException; use Vdlp\RssFetcher\Models\Source; @@ -22,7 +22,7 @@ * @mixin ListController * @mixin ImportExportController */ -class Sources extends Controller +final class Sources extends Controller { public $implement = [ FormController::class, @@ -30,20 +30,12 @@ class Sources extends Controller ImportExportController::class, ]; - public $formConfig = 'config_form.yaml'; - public $listConfig = 'config_list.yaml'; - public $importExportConfig = 'config_import_export.yaml'; + public string $formConfig = 'config_form.yaml'; + public string $listConfig = 'config_list.yaml'; + public string $importExportConfig = 'config_import_export.yaml'; protected $requiredPermissions = ['vdlp.rssfetcher.access_sources']; - - /** - * @var FlashBag - */ - private $flashBag; - - /** - * @var Translator - */ - private $translator; + private FlashBag $flashBag; + private Translator $translator; public function __construct() { @@ -60,7 +52,7 @@ public function onFetch(): array try { $source = Source::query()->findOrFail($this->params[0]); - if ($source instanceof Source && !$source->getAttribute('is_enabled')) { + if ($source instanceof Source && $source->getAttribute('is_enabled') === false) { throw new SourceNotEnabledException( $this->translator->trans('vdlp.rssfetcher::lang.source.source_not_enabled') ); @@ -71,7 +63,7 @@ public function onFetch(): array $this->flashBag->success($this->translator->trans('vdlp.rssfetcher::lang.source.items_fetch_success')); } catch (SourceNotEnabledException $e) { $this->flashBag->warning($e->getMessage()); - } catch (Exception $e) { + } catch (Throwable $e) { throw new ApplicationException( $this->translator->trans('vdlp.rssfetcher::lang.source.items_fetch_fail', [ 'error' => $e->getMessage() @@ -82,22 +74,23 @@ public function onFetch(): array return $this->listRefresh(); } - // @codingStandardsIgnoreStart - - public function index_onBulkFetch(): array + public function onBulkFetch(): array { foreach ($this->getCheckedIds() as $sourceId) { - if (!$source = Source::query()->find($sourceId)) { + /** @var ?Source $source */ + $source = Source::query()->find($sourceId); + + if ($source === null) { continue; } - if (!$source->getAttribute('is_enabled')) { + if ($source->getAttribute('is_enabled') === false) { continue; } try { RssFetcher::instance()->fetch((int) $source->getKey()); - } catch (Exception $e) { + } catch (Throwable $e) { $this->flashBag->error($e->getMessage()); } } @@ -105,10 +98,13 @@ public function index_onBulkFetch(): array return $this->listRefresh(); } - public function index_onDelete(): array + public function onDelete(): array { foreach ($this->getCheckedIds() as $sourceId) { - if (!$source = Source::query()->find($sourceId)) { + /** @var ?Source $source */ + $source = Source::query()->find($sourceId); + + if ($source === null) { continue; } @@ -118,14 +114,11 @@ public function index_onDelete(): array return $this->listRefresh(); } - // @codingStandardsIgnoreEnd - private function getCheckedIds(): array { - if (($checkedIds = post('checked')) - && is_array($checkedIds) - && count($checkedIds) - ) { + $checkedIds = post('checked'); + + if (is_array($checkedIds) && count($checkedIds) > 0) { return $checkedIds; } diff --git a/formwidgets/TextWithPrefix.php b/formwidgets/TextWithPrefix.php index 3fd8a28..9b8c04d 100644 --- a/formwidgets/TextWithPrefix.php +++ b/formwidgets/TextWithPrefix.php @@ -7,7 +7,7 @@ use Backend\Classes\FormWidgetBase; use SystemException; -class TextWithPrefix extends FormWidgetBase +final class TextWithPrefix extends FormWidgetBase { protected $defaultAlias = 'vdlp_rssfetcher_text_with_prefix'; diff --git a/http/controllers/FeedController.php b/http/controllers/FeedController.php index bdf6f0f..1c2ed0d 100644 --- a/http/controllers/FeedController.php +++ b/http/controllers/FeedController.php @@ -17,37 +17,24 @@ use Vdlp\RssFetcher\Models\Item; use Vdlp\RssFetcher\Models\Source; -class FeedController +final class FeedController { - /** - * @var UrlGenerator - */ - private $urlGenerator; - - /** - * @var ResponseFactory - */ - private $responseFactory; - - /** - * @param UrlGenerator $urlGenerator - * @param ResponseFactory $responseFactory - */ + private UrlGenerator $urlGenerator; + private ResponseFactory $responseFactory; + public function __construct(UrlGenerator $urlGenerator, ResponseFactory $responseFactory) { $this->urlGenerator = $urlGenerator; $this->responseFactory = $responseFactory; } - /** - * @param string $path - * @return Response - * @throws InvalidArgumentException - */ public function all(string $path): Response { - /** @var FeedModel $model */ - $model = FeedModel::query()->where('path', '=', $path)->first(); + /** @var ?FeedModel $model */ + $model = FeedModel::query() + ->where('path', '=', $path) + ->first(); + if ($model === null) { return $this->responseFactory->make('Not Found', 404); } @@ -68,7 +55,7 @@ public function all(string $path): Response $ids = Arr::pluck($sources->toArray(), 'id'); $items = []; - Source::with(['items' => static function (HasMany $builder) use (&$items, $model) { + Source::with(['items' => static function (HasMany $builder) use (&$items, $model): void { $items = $builder->where('is_published', '=', 1) ->whereDate('pub_date', '<=', date('Y-m-d')) ->orderBy('pub_date', 'desc') @@ -90,11 +77,13 @@ public function all(string $path): Response ->setDateModified($item->getAttribute('pub_date')); $comments = $item->getAttribute('comments'); + if (!empty($comments)) { $entry->setCommentLink($comments); } $category = $item->getAttribute('category'); + if (!empty($category)) { $entry->addCategory(['term' => $category]); } diff --git a/models/Feed.php b/models/Feed.php index 6209f8d..23dcf49 100644 --- a/models/Feed.php +++ b/models/Feed.php @@ -7,7 +7,7 @@ use October\Rain\Database\Model; use October\Rain\Database\Traits\Validation; -class Feed extends Model +final class Feed extends Model { use Validation; @@ -21,10 +21,7 @@ class Feed extends Model ], ]; - /** - * @var array - */ - public $rules = [ + public array $rules = [ 'title' => 'required', 'description' => 'required', 'path' => [ diff --git a/models/Item.php b/models/Item.php index 1bc5a21..e7def86 100644 --- a/models/Item.php +++ b/models/Item.php @@ -7,12 +7,12 @@ use October\Rain\Database\Builder; use October\Rain\Database\Model; -class Item extends Model +final class Item extends Model { public $table = 'vdlp_rssfetcher_items'; public $belongsTo = [ - 'source' => Source::class + 'source' => Source::class, ]; protected $fillable = [ @@ -32,23 +32,16 @@ class Item extends Model ]; protected $casts = [ - 'enclosure_length' => 'integer' + 'enclosure_length' => 'integer', ]; protected $dates = [ - 'pub_date' + 'pub_date', ]; - /** - * Allows filtering for specific sources - * - * @param Builder $query - * @param array $sources List of source ids - * @return Builder - */ public function scopeFilterSources(Builder $query, array $sources = []): Builder { - return $query->whereHas('source', static function (Builder $q) use ($sources) { + return $query->whereHas('source', static function (Builder $q) use ($sources): void { $q->whereIn('id', $sources); }); } diff --git a/models/Source.php b/models/Source.php index 2ddd675..3855e46 100644 --- a/models/Source.php +++ b/models/Source.php @@ -7,16 +7,13 @@ use October\Rain\Database\Model; use October\Rain\Database\Traits\Validation; -class Source extends Model +final class Source extends Model { use Validation; public $table = 'vdlp_rssfetcher_sources'; - /** - * @var array - */ - public $rules = [ + public array $rules = [ 'name' => 'required', 'source_url' => 'required', ]; diff --git a/models/SourceExport.php b/models/SourceExport.php index d76bc1c..1d6091d 100644 --- a/models/SourceExport.php +++ b/models/SourceExport.php @@ -6,7 +6,7 @@ use Backend\Models\ExportModel; -class SourceExport extends ExportModel +final class SourceExport extends ExportModel { public $table = 'vdlp_rssfetcher_sources'; diff --git a/models/SourceImport.php b/models/SourceImport.php index b06603a..b8afcbb 100644 --- a/models/SourceImport.php +++ b/models/SourceImport.php @@ -7,14 +7,11 @@ use Backend\Models\ImportModel; use Throwable; -class SourceImport extends ImportModel +final class SourceImport extends ImportModel { public $table = 'vdlp_rssfetcher_sources'; - /** - * @var array - */ - public $rules = [ + public array $rules = [ 'name' => 'required', 'source_url' => 'required', ]; diff --git a/reportwidgets/Headlines.php b/reportwidgets/Headlines.php index 177c62d..e9a2d8f 100644 --- a/reportwidgets/Headlines.php +++ b/reportwidgets/Headlines.php @@ -8,7 +8,7 @@ use October\Rain\Translation\Translator; use Vdlp\RssFetcher\Components\Items; -class Headlines extends ReportWidgetBase +final class Headlines extends ReportWidgetBase { public function widgetDetails(): array { @@ -49,7 +49,7 @@ public function defineProperties(): array public function render(): string { $this->vars['title'] = $this->property('title'); - $this->vars['items'] = Items::loadItems((int) $this->property('maxItems', 10)); + $this->vars['items'] = Items::loadItems((int) $this->property('maxItems', '10')); $this->vars['dateFormat'] = $this->property('dateFormat'); return $this->makePartial('widget'); diff --git a/updates/20180718_0001_create_sources_table.php b/updates/20180718_0001_create_sources_table.php index 332abd1..5dabe0f 100644 --- a/updates/20180718_0001_create_sources_table.php +++ b/updates/20180718_0001_create_sources_table.php @@ -12,7 +12,7 @@ class CreateSourcesTable extends Migration { public function up(): void { - Schema::create('vdlp_rssfetcher_sources', static function (Blueprint $table) { + Schema::create('vdlp_rssfetcher_sources', static function (Blueprint $table): void { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('name', 40)->nullable(); diff --git a/updates/20180718_0002_create_items_table.php b/updates/20180718_0002_create_items_table.php index 7dbac1a..e67d4dc 100644 --- a/updates/20180718_0002_create_items_table.php +++ b/updates/20180718_0002_create_items_table.php @@ -12,7 +12,7 @@ class CreateItemsTable extends Migration { public function up(): void { - Schema::create('vdlp_rssfetcher_items', static function (Blueprint $table) { + Schema::create('vdlp_rssfetcher_items', static function (Blueprint $table): void { $table->engine = 'InnoDB'; $table->increments('id'); $table->unsignedInteger('source_id'); diff --git a/updates/20180718_0003_seed_feeds_table.php b/updates/20180718_0003_seed_feeds_table.php index 70aae28..dcd695c 100644 --- a/updates/20180718_0003_seed_feeds_table.php +++ b/updates/20180718_0003_seed_feeds_table.php @@ -12,7 +12,7 @@ class CreateFeedsTable extends Migration { public function up(): void { - Schema::create('vdlp_rssfetcher_feeds', static function (Blueprint $table) { + Schema::create('vdlp_rssfetcher_feeds', static function (Blueprint $table): void { $table->engine = 'InnoDB'; $table->increments('id'); $table->enum('type', ['rss', 'atom']); @@ -24,7 +24,7 @@ public function up(): void $table->timestamps(); }); - Schema::create('vdlp_rssfetcher_feeds_sources', static function (Blueprint $table) { + Schema::create('vdlp_rssfetcher_feeds_sources', static function (Blueprint $table): void { $table->engine = 'InnoDB'; $table->unsignedInteger('feed_id'); $table->unsignedInteger('source_id'); diff --git a/updates/20180718_0004_seed_sources_table.php b/updates/20180718_0004_seed_sources_table.php index 48a594a..b02cd16 100644 --- a/updates/20180718_0004_seed_sources_table.php +++ b/updates/20180718_0004_seed_sources_table.php @@ -18,6 +18,7 @@ public function run(): void 'max_items' => 10, 'is_enabled' => true, ]); + Source::create([ 'name' => 'NU.nl | Internet', 'description' => 'NU.nl | Internet', @@ -25,6 +26,7 @@ public function run(): void 'max_items' => 10, 'is_enabled' => true, ]); + Source::create([ 'name' => 'Tweakers.net', 'description' => 'Tweakers.net is sinds 1998 de grootste website in Nederland over technologie en elektronica met nieuws, reviews en de bekroonde Pricewatch.', @@ -32,6 +34,7 @@ public function run(): void 'max_items' => 10, 'is_enabled' => true, ]); + Source::create([ 'name' => 'Laravel News Blog', 'description' => 'Laravel News Blog', diff --git a/updates/20181012_0005_move_publish_new_items_to_sources_table.php b/updates/20181012_0005_move_publish_new_items_to_sources_table.php index 762f7da..f99efd9 100644 --- a/updates/20181012_0005_move_publish_new_items_to_sources_table.php +++ b/updates/20181012_0005_move_publish_new_items_to_sources_table.php @@ -12,11 +12,11 @@ class MovePublishNewItemsToSourcesTable extends Migration { public function up(): void { - Schema::table('vdlp_rssfetcher_items', function (Blueprint $table) { + Schema::table('vdlp_rssfetcher_items', static function (Blueprint $table): void { $table->dropColumn('publish_new_items'); }); - Schema::table('vdlp_rssfetcher_sources', function (Blueprint $table) { + Schema::table('vdlp_rssfetcher_sources', static function (Blueprint $table): void { $table->boolean('publish_new_items') ->after('is_enabled') ->default(true); @@ -25,11 +25,11 @@ public function up(): void public function down(): void { - Schema::table('vdlp_rssfetcher_sources', function (Blueprint $table) { + Schema::table('vdlp_rssfetcher_sources', static function (Blueprint $table): void { $table->dropColumn('publish_new_items'); }); - Schema::table('vdlp_rssfetcher_items', function (Blueprint $table) { + Schema::table('vdlp_rssfetcher_items', static function (Blueprint $table): void { $table->boolean('publish_new_items') ->after('is_published') ->default(true); diff --git a/updates/20200206_0006_remove_unique_constraint_from_items.php b/updates/20200206_0006_remove_unique_constraint_from_items.php index d153ed0..5fb8b99 100644 --- a/updates/20200206_0006_remove_unique_constraint_from_items.php +++ b/updates/20200206_0006_remove_unique_constraint_from_items.php @@ -12,14 +12,14 @@ class RemoveUniqueConstraintFromItems extends Migration { public function up(): void { - Schema::table('vdlp_rssfetcher_items', static function (Blueprint $table) { + Schema::table('vdlp_rssfetcher_items', static function (Blueprint $table): void { $table->dropUnique('item_id_unique'); }); } public function down(): void { - Schema::table('vdlp_rssfetcher_items', static function (Blueprint $table) { + Schema::table('vdlp_rssfetcher_items', static function (Blueprint $table): void { $table->unique('item_id', 'item_id_unique'); }); } diff --git a/updates/version.yaml b/updates/version.yaml index c74bcb8..c1f0568 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -20,3 +20,4 @@ 2.1.0: "Fix Author parsing for Atom/RSS feeds" 2.2.0: Update plugin dependencies (minimum required PHP version 7.3) 2.2.1: "Fix error when performing a migration rollback" +3.0.0: Drop support for PHP 7.4 (minimum required PHP version 7.4)