From dddd3e395f6f878b0f0d2ce19d1096afed6e4c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sun, 24 Nov 2024 10:19:46 +0100 Subject: [PATCH] Fix: hook for ActivityPub transformer might also return null (#81) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-bridge/pulls/81 Co-authored-by: André Menrath Co-committed-by: André Menrath --- CHANGELOG.md | 6 ++++++ README.md | 6 ++++++ includes/class-setup.php | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1f6405..7a9a38f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +* Fixed that transformer hook function might also return `null`. + ## [0.2.1] - 2024-11-16 ### Added diff --git a/README.md b/README.md index 023e5c2..2e12c7a 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,12 @@ We're always interested in your feedback. Feel free to reach out to us via [E-Ma ## Changelog ## +## Unreleased + +### Fixed + +* Fixed that transformer hook function might also return `null`. + ### [0.2.1] 2024-11-16 ### * Initial release on https://wordpress.org/ diff --git a/includes/class-setup.php b/includes/class-setup.php index 2912002..7d1ddb5 100644 --- a/includes/class-setup.php +++ b/includes/class-setup.php @@ -252,7 +252,7 @@ class Setup { * * @return \Activitypub\Transformer\Base|null */ - public function register_activitypub_event_transformer( $transformer, $wp_object, $object_class ): \Activitypub\Transformer\Base { + public function register_activitypub_event_transformer( $transformer, $wp_object, $object_class ): ?\Activitypub\Transformer\Base { // If the current WordPress object is not a post (e.g., a WP_Comment), don't change the transformer. if ( 'WP_Post' !== $object_class ) { return $transformer;