ChristophWurst / kitinerary

php integration of KItinerary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Deprecated: Return type of ChristophWurst\KItinerary\Itinerary::jsonSerialize()

arnebr opened this issue · comments

Hi Christoph,
ive got the following error on PHP 8.1:

Deprecated: Return type of ChristophWurst\KItinerary\Itinerary::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/test/vendor/christophwurst/kitinerary/src/Itinerary.php on line 53

That's my code for now:

<?php

require __DIR__ . '/vendor/autoload.php';
use ChristophWurst\KItinerary\ItineraryExtractor;
use ChristophWurst\KItinerary\Exception\KItineraryRuntimeException;
use ChristophWurst\KItinerary\Bin\BinaryAdapter;
$adapter = new BinaryAdapter();
if (!$adapter->isAvailable()) {
    // ...
}
$extractor = new ItineraryExtractor($adapter);

try {
    $itinerary = $extractor->extractFromString('test');
} catch (KItineraryRuntimeException $e) {
    // ...
}

Sorry I just saw you already pushed an update