Hi 馃憢
When running this library on PHP 8.1, several deprecation warnings appear related to JsonSerializable::jsonSerialize() return types:
Environment:
- Moodle 4.5.7
- PHP 8.1.30
- logstore_caliper 4.5.4 (2025060500)
PHP Deprecated: Return type of IMSGlobal\Caliper\events\Event::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /export/html/admin/tool/log/store/caliper/vendor/imsglobal/caliper/src/events/Event.php on line 40
PHP Deprecated: Return type of IMSGlobal\Caliper\entities\Entity::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /export/html/admin/tool/log/store/caliper/vendor/imsglobal/caliper/src/entities/Entity.php on line 33
PHP Deprecated: Return type of IMSGlobal\Caliper\request\Envelope::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /export/html/admin/tool/log/store/caliper/vendor/imsglobal/caliper/src/request/Envelope.php on line 21
PHP Deprecated: Return type of IMSGlobal\Caliper\util\BasicEnum::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /export/html/admin/tool/log/store/caliper/vendor/imsglobal/caliper/src/util/BasicEnum.php on line
Updating the methods to specify a return type of mixed resolves the issue.
For example:
// Before
function jsonSerialize() {
return $this->getValue();
}
// After
function jsonSerialize(): mixed {
return $this->getValue();
}
Do you have any plans to update this library for PHP 8.1 compatibility?
Thanks for maintaining this project!
Hi 馃憢
When running this library on PHP 8.1, several deprecation warnings appear related to JsonSerializable::jsonSerialize() return types:
Environment:
Updating the methods to specify a return type of
mixedresolves the issue.For example:
Do you have any plans to update this library for PHP 8.1 compatibility?
Thanks for maintaining this project!