Fix: hook for ActivityPub transformer might also return null (#81)
All checks were successful
PHP Code Checker / PHP Code Checker (push) Successful in 51s
PHPUnit / PHPUnit – PHP 7.4 (push) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.0 (push) Successful in 59s
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 58s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 1m1s

Reviewed-on: #81
Co-authored-by: André Menrath <andre.menrath@posteo.de>
Co-committed-by: André Menrath <andre.menrath@posteo.de>
This commit is contained in:
André Menrath 2024-11-24 10:19:46 +01:00 committed by André Menrath
parent 7eb011859a
commit dddd3e395f
3 changed files with 13 additions and 1 deletions

View file

@ -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/), 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). 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 ## [0.2.1] - 2024-11-16
### Added ### Added

View file

@ -100,6 +100,12 @@ We're always interested in your feedback. Feel free to reach out to us via [E-Ma
## Changelog ## ## Changelog ##
## Unreleased
### Fixed
* Fixed that transformer hook function might also return `null`.
### [0.2.1] 2024-11-16 ### ### [0.2.1] 2024-11-16 ###
* Initial release on https://wordpress.org/ * Initial release on https://wordpress.org/

View file

@ -252,7 +252,7 @@ class Setup {
* *
* @return \Activitypub\Transformer\Base|null * @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 the current WordPress object is not a post (e.g., a WP_Comment), don't change the transformer.
if ( 'WP_Post' !== $object_class ) { if ( 'WP_Post' !== $object_class ) {
return $transformer; return $transformer;