Skip to content

Commit 2e576d5

Browse files
committed
fix(ci): fix PHPStan nullsafe error and DescribeDatabaseToolTest constructor
- Replace nullsafe ?-> with explicit null check for _auth->getUser() - Pass ResourceConnection mock to SqlSandbox in DescribeDatabaseToolTest
1 parent 7b0399d commit 2e576d5

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Controller/Adminhtml/Assistant/Chat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function execute(): Json
8080

8181
private function checkRateLimit(): ?string
8282
{
83-
$adminId = (string) ($this->_auth->getUser()?->getId() ?? 'unknown');
83+
$adminId = (string) $this->_auth->getUser()->getId();
8484
$cacheKey = 'ai_assistant_rate_' . $adminId;
8585

8686
$count = (int) ($this->cache->load($cacheKey) ?: 0);

Test/Unit/Model/Assistant/Tool/DescribeDatabaseToolTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ final class DescribeDatabaseToolTest extends TestCase
1919
protected function setUp(): void
2020
{
2121
$this->resource = $this->createMock(ResourceConnection::class);
22-
$this->sandbox = new SqlSandbox();
22+
$this->resource->method('getTableName')->willReturnArgument(0);
23+
24+
$this->sandbox = new SqlSandbox($this->resource);
2325

2426
$this->sut = new DescribeDatabaseTool(
2527
$this->resource,

0 commit comments

Comments
 (0)