From 70044cd4f2606f5318661e912b8c473c7a59648f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kon=C3=A1=C5=A1?= Date: Tue, 2 Jul 2024 18:58:51 +0200 Subject: [PATCH] Fix deprecation notices due to dynamic properties --- src/Kontent/Ai/Delivery/DeliveryClient.php | 18 +++++++++++++++++- .../Ai/Delivery/Models/Items/ContentItem.php | 1 + tests/Official/CodeExampleTest.php | 8 ++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Kontent/Ai/Delivery/DeliveryClient.php b/src/Kontent/Ai/Delivery/DeliveryClient.php index e1b592e..a803d85 100644 --- a/src/Kontent/Ai/Delivery/DeliveryClient.php +++ b/src/Kontent/Ai/Delivery/DeliveryClient.php @@ -7,6 +7,7 @@ use Httpful\Request; use Httpful\Http; +use Httpful\Response; use Kontent\Ai\Delivery\Models\Shared\Pagination; use InvalidArgumentException; use Exception; @@ -72,7 +73,22 @@ class DeliveryClient */ public $modelBinder = null; - /** + /** + * Last request made + * + * @var Request|null + */ + public $lastRequest; + + /** + * Response from last request made + * + * @var Response + */ + public $lastResponse; + + + /** * Creates a new instance of DeliveryClient. * * @param string $projectId Kontent.ai Delivery API Project ID diff --git a/src/Kontent/Ai/Delivery/Models/Items/ContentItem.php b/src/Kontent/Ai/Delivery/Models/Items/ContentItem.php index 676f5c1..001c047 100644 --- a/src/Kontent/Ai/Delivery/Models/Items/ContentItem.php +++ b/src/Kontent/Ai/Delivery/Models/Items/ContentItem.php @@ -8,6 +8,7 @@ /** * Class ContentItem. */ +#[\AllowDynamicProperties] class ContentItem { } diff --git a/tests/Official/CodeExampleTest.php b/tests/Official/CodeExampleTest.php index bcbed7d..cc73b47 100644 --- a/tests/Official/CodeExampleTest.php +++ b/tests/Official/CodeExampleTest.php @@ -8,7 +8,11 @@ class CodeExamplesTests extends TestCase { - protected function setUp(): void + /** @var DeliveryClient */ + private $client; + + + protected function setUp(): void { $this->client = new DeliveryClient('975bf280-fd91-488c-994c-2f04416e5ee3'); } @@ -108,4 +112,4 @@ public function test_getContentInSpecificLanguageNoFallback() $this->assertNotNull($item); } -} \ No newline at end of file +}