diff --git a/.phpcs.xml b/.phpcs.xml index d8870e5..eadd241 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -28,7 +28,7 @@ vendor/ - + diff --git a/README.md b/README.md index 4bf76d4..f6bbb87 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Tags: alleyinteractive, wp-video-sync Stable tag: 0.1.0 -Requires at least: 6.6 +Requires at least: 6.0 Tested up to: 6.6 diff --git a/src/adapters/class-jw-player-7-for-wp.php b/src/adapters/class-jw-player-7-for-wp.php index a3deea1..92db2bc 100644 --- a/src/adapters/class-jw-player-7-for-wp.php +++ b/src/adapters/class-jw-player-7-for-wp.php @@ -18,9 +18,9 @@ class JW_Player_7_For_WP implements Adapter { /** * The date of the last modification to the last batch of videos. * - * @var DateTimeImmutable + * @var ?DateTimeImmutable */ - private DateTimeImmutable $last_modified_date; + private ?DateTimeImmutable $last_modified_date; /** * Fetches the date of the last modification to the last batch of videos. diff --git a/src/class-sync-manager.php b/src/class-sync-manager.php index c5e5a72..35ee1b8 100644 --- a/src/class-sync-manager.php +++ b/src/class-sync-manager.php @@ -28,9 +28,9 @@ class Sync_Manager { /** * The adapter to use for fetching videos. * - * @var Adapter + * @var ?Adapter */ - public Adapter $adapter; + public ?Adapter $adapter; /** * A callback to run for each result when the sync runs. @@ -75,6 +75,11 @@ public function maybe_schedule_sync(): void { * @throws Error If unable to parse the last sync as a DateTimeImmutable object. */ public function sync_videos(): void { + // If there isn't a valid adapter, bail. + if ( ! $this->adapter instanceof Adapter ) { + throw new Error( esc_html__( 'WP Video Sync: Unable to sync videos without a valid adapter.', 'wp-video-sync' ) ); + } + // If there isn't a valid callback, bail. if ( ! is_callable( $this->callback ) ) { throw new Error( esc_html__( 'WP Video Sync: Unable to execute provided callback.', 'wp-video-sync' ) );