Skip to content

Commit 54d7c65

Browse files
committed
refactor: fix TypeError in SQLSRV/Connection.php
3) CodeIgniter\Database\Live\FabricatorLiveTest::testCreateAddsToDatabase TypeError: CodeIgniter\Database\SQLSRV\Connection::insertID(): Return value must be of type int, string returned /home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/SQLSRV/Connection.php:195 /home/runner/work/CodeIgniter4/CodeIgniter4/system/Model.php:328 /home/runner/work/CodeIgniter4/CodeIgniter4/system/BaseModel.php:782 /home/runner/work/CodeIgniter4/CodeIgniter4/system/Model.php:707 /home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/Fabricator.php:475 /home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/Live/FabricatorLiveTest.php:41
1 parent 6f70eca commit 54d7c65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

system/Database/SQLSRV/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ protected function _escapeString(string $str): string
190190
*/
191191
public function insertID(): int
192192
{
193-
return $this->query('SELECT SCOPE_IDENTITY() AS insert_id')->getRow()->insert_id ?? 0;
193+
return (int) ($this->query('SELECT SCOPE_IDENTITY() AS insert_id')->getRow()->insert_id ?? 0);
194194
}
195195

196196
/**

0 commit comments

Comments
 (0)