Skip to content

Commit a660746

Browse files
Fix coding-standard warnings and pre-existing test fixture mismatch
- Expand empty closures `function () {}` to multi-line form to satisfy the Magento2 coding standard (closing brace must be on its own line) in QueueTest.php and CallbackInvokerTest.php - Update TRemoteService.txt fixture to use nullable type `?int $typeId` matching the TRepositoryInterface source; the old fixture used `int` which caused RemoteServiceGeneratorTest::testGenerate #1 to fail Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3ea0cc0 commit a660746

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

lib/internal/Magento/Framework/Amqp/Test/Unit/QueueTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ public function testSubscribeWithLimitCallsBasicQosAndBasicConsume(): void
9191
->method('getChannel')
9292
->willReturn($amqpChannel);
9393

94-
$this->model->subscribeWithLimit(function () {}, 10);
94+
$this->model->subscribeWithLimit(function () {
95+
}, 10);
9596
}
9697

9798
/**
@@ -103,7 +104,8 @@ public function testSubscribeWithLimitDoesNothingWhenMaxMessagesIsZero(): void
103104
// getChannel must never be called — no AMQP interaction should occur.
104105
$this->config->expects($this->never())->method('getChannel');
105106

106-
$this->model->subscribeWithLimit(function () {}, 0);
107+
$this->model->subscribeWithLimit(function () {
108+
}, 0);
107109
}
108110

109111
/**
@@ -116,7 +118,8 @@ public function testSubscribeWithLimitExitsCleanlyOnAMQPTimeout(): void
116118
$amqpChannel->method('basic_qos');
117119
$amqpChannel->method('basic_consume')
118120
->willReturnCallback(function () use ($amqpChannel) {
119-
$amqpChannel->callbacks = ['test-consumer-tag' => function () {}];
121+
$amqpChannel->callbacks = ['test-consumer-tag' => function () {
122+
}];
120123
return 'test-consumer-tag';
121124
});
122125
$amqpChannel->expects($this->once())
@@ -125,6 +128,7 @@ public function testSubscribeWithLimitExitsCleanlyOnAMQPTimeout(): void
125128
$this->config->method('getChannel')->willReturn($amqpChannel);
126129

127130
// Must not throw; AMQPTimeoutException signals empty queue, not a failure.
128-
$this->model->subscribeWithLimit(function () {}, 10, 1);
131+
$this->model->subscribeWithLimit(function () {
132+
}, 10, 1);
129133
}
130134
}

lib/internal/Magento/Framework/MessageQueue/Test/Unit/CallbackInvokerTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ public function testInvokeUsesSubscribeWithLimitForAmqpQueue(): void
7272
->with($this->isType('callable'), 50, 0);
7373
$queue->expects($this->never())->method('dequeue');
7474

75-
$this->invoker->invoke($queue, 50, function () {});
75+
$this->invoker->invoke($queue, 50, function () {
76+
});
7677
}
7778

7879
/**
@@ -91,7 +92,8 @@ public function testInvokePassesWaitTimeoutOneWhenNotWaitingForMessages(): void
9192
->method('subscribeWithLimit')
9293
->with($this->isType('callable'), 10, 1);
9394

94-
$this->invoker->invoke($queue, 10, function () {});
95+
$this->invoker->invoke($queue, 10, function () {
96+
});
9597
}
9698

9799
/**
@@ -110,7 +112,8 @@ public function testInvokePassesWaitTimeoutZeroWhenWaitingForMessages(): void
110112
->method('subscribeWithLimit')
111113
->with($this->isType('callable'), 10, 0);
112114

113-
$this->invoker->invoke($queue, 10, function () {});
115+
$this->invoker->invoke($queue, 10, function () {
116+
});
114117
}
115118

116119
/**

lib/internal/Magento/Framework/MessageQueue/Test/Unit/Code/Generator/_files/TRemoteService.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TRepositoryInterfaceRemote implements TRepositoryInterface
3636
/**
3737
* @inheritdoc
3838
*/
39-
public function get(string $attribute, int $typeId = null): \Magento\Framework\MessageQueue\Code\Generator\TInterface
39+
public function get(string $attribute, ?int $typeId = null): \Magento\Framework\MessageQueue\Code\Generator\TInterface
4040
{
4141
return $this->publisher->publish(
4242
'magento.framework.messageQueue.code.generator.tRepositoryInterface.get',

0 commit comments

Comments
 (0)