Skip to content

Commit 603f1bf

Browse files
committed
fix literal-string
1 parent 03446ed commit 603f1bf

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/Event/Repository/AsynchronousDatabase.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ public function load(int $limit): Collection
2828

2929
$this->db->execute('START TRANSACTION');
3030

31+
/**
32+
* @var literal-string $limit
33+
*/
34+
$limit = strval($limit);
35+
3136
$records = $this->db->execute(
32-
"SELECT * FROM `{$this->db->table('bulkgate_module')}` WHERE `scope` = 'asynchronous' AND `order` = 0 LIMIT {$this->db->escape((string) $limit)} FOR UPDATE"
37+
"SELECT * FROM `{$this->db->table('bulkgate_module')}` WHERE `scope` = 'asynchronous' AND `order` = 0 LIMIT $limit FOR UPDATE"
3338
);
3439

3540
if ($records !== null)

tests/Event/Repository/AsynchronousDatabaseTest.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class AsynchronousDatabaseTest extends TestCase
2121

2222
$db->shouldReceive('table')->with('bulkgate_module')->times(3)->andReturn('bulkgate_module');
2323
$db->shouldReceive('execute')->with('START TRANSACTION')->once()->ordered();
24-
$db->shouldReceive('escape')->with('2')->once()->ordered()->andReturn(2);
2524
$db->shouldReceive('execute')->with("SELECT * FROM `bulkgate_module` WHERE `scope` = 'asynchronous' AND `order` = 0 LIMIT 2 FOR UPDATE")->once()->ordered()->andReturn(new ResultCollection([
2625
['key' => 'task1', 'value' => '{"category": "test", "endpoint": "endpoint1", "variables": {"key": "value"}}', 'datetime' => '456', 'order' => '0'],
2726
['key' => 'task2', 'value' => '{"category": "test", "endpoint": "endpoint2", "variables": {"key2": "value2"}}', 'datetime' => 456, 'order' => 0],
@@ -50,7 +49,6 @@ class AsynchronousDatabaseTest extends TestCase
5049

5150
$db->shouldReceive('table')->once()->andReturn('bulkgate_module');
5251
$db->shouldReceive('execute')->with('START TRANSACTION')->once()->ordered();
53-
$db->shouldReceive('escape')->with('2')->once()->ordered()->andReturn(2);
5452
$db->shouldReceive('execute')->with("SELECT * FROM `bulkgate_module` WHERE `scope` = 'asynchronous' AND `order` = 0 LIMIT 2 FOR UPDATE")->once()->ordered()->andReturnNull();
5553
$db->shouldReceive('execute')->with('ROLLBACK')->once()->ordered();
5654

0 commit comments

Comments
 (0)