From a6c14243c1fdc0203e4c2b1a1c7813ce73684155 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 4 Sep 2025 14:51:12 +0200 Subject: [PATCH] Remove unnecessary setAccessible(true) calls In PHP 8.1+, ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible() became no-ops and have no effect. Since this project requires PHP 8.2+, these calls are unnecessary and can be removed. --- src/platform/tests/Bridge/HuggingFace/ModelClientTest.php | 2 -- .../tests/Bridge/LmStudio/Completions/ModelClientTest.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/platform/tests/Bridge/HuggingFace/ModelClientTest.php b/src/platform/tests/Bridge/HuggingFace/ModelClientTest.php index ce84aef84..c124702a4 100644 --- a/src/platform/tests/Bridge/HuggingFace/ModelClientTest.php +++ b/src/platform/tests/Bridge/HuggingFace/ModelClientTest.php @@ -37,7 +37,6 @@ public function testGetUrlForDifferentInputsAndTasks(?string $task, string $expe { $reflection = new \ReflectionClass(ModelClient::class); $getUrlMethod = $reflection->getMethod('getUrl'); - $getUrlMethod->setAccessible(true); $model = new Model('test-model'); $httpClient = new MockHttpClient(); @@ -87,7 +86,6 @@ public function testGetPayloadForDifferentInputsAndTasks(object|array|string $in $reflection = new \ReflectionClass(ModelClient::class); $getPayloadMethod = $reflection->getMethod('getPayload'); - $getPayloadMethod->setAccessible(true); $httpClient = new MockHttpClient(); $modelClient = new ModelClient($httpClient, 'test-provider', 'test-api-key'); diff --git a/src/platform/tests/Bridge/LmStudio/Completions/ModelClientTest.php b/src/platform/tests/Bridge/LmStudio/Completions/ModelClientTest.php index b543f29ac..160587ed0 100644 --- a/src/platform/tests/Bridge/LmStudio/Completions/ModelClientTest.php +++ b/src/platform/tests/Bridge/LmStudio/Completions/ModelClientTest.php @@ -92,7 +92,6 @@ public function testItUsesEventSourceHttpClient() $client = new ModelClient($httpClient, 'http://localhost:1234'); $reflection = new \ReflectionProperty($client, 'httpClient'); - $reflection->setAccessible(true); $this->assertInstanceOf(EventSourceHttpClient::class, $reflection->getValue($client)); } @@ -103,7 +102,6 @@ public function testItKeepsExistingEventSourceHttpClient() $client = new ModelClient($eventSourceHttpClient, 'http://localhost:1234'); $reflection = new \ReflectionProperty($client, 'httpClient'); - $reflection->setAccessible(true); $this->assertSame($eventSourceHttpClient, $reflection->getValue($client)); }