Skip to content

Commit 488c534

Browse files
committed
Merge branch 'master' of github.com:php-enqueue/enqueue-dev
2 parents b57feb7 + 5e6a299 commit 488c534

16 files changed

+47
-15
lines changed

pkg/amqp-ext/AmqpConnectionFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(array $config)
5555
public function createContext()
5656
{
5757
if ($this->config['lazy']) {
58-
return new AmqpContext(function() {
58+
return new AmqpContext(function () {
5959
return new \AMQPChannel($this->establishConnection());
6060
});
6161
}

pkg/amqp-ext/Tests/AmqpConnectionFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ public function testShouldCreateLazyContext()
6161
$this->assertInstanceOf(AmqpContext::class, $context);
6262

6363
$this->assertAttributeEquals(null, 'extChannel', $context);
64-
$this->assertTrue(is_callable($this->readAttribute($context, 'extChannelFactory')));
64+
$this->assertInternalType('callable', $this->readAttribute($context, 'extChannelFactory'));
6565
}
6666
}

pkg/enqueue/Client/MessageProducer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private function prepareBody(Message $message)
5858
$body = $message->getBody();
5959
$contentType = $message->getContentType();
6060

61-
if (is_scalar($body) || is_null($body)) {
61+
if (is_scalar($body) || null === $body) {
6262
$contentType = $contentType ?: 'text/plain';
6363
$body = (string) $body;
6464
} elseif (is_array($body)) {
@@ -68,7 +68,7 @@ private function prepareBody(Message $message)
6868

6969
// only array of scalars is allowed.
7070
array_walk_recursive($body, function ($value) {
71-
if (!is_scalar($value) && !is_null($value)) {
71+
if (!is_scalar($value) && null !== $value) {
7272
throw new \LogicException(sprintf(
7373
'The message\'s body must be an array of scalars. Found not scalar in the array: %s',
7474
is_object($value) ? get_class($value) : gettype($value)

pkg/enqueue/Client/SimpleClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public function __construct(AmqpContext $context, Config $config = null)
7171
}
7272

7373
/**
74-
* @param string $topic
75-
* @param string $processorName
74+
* @param string $topic
75+
* @param string $processorName
7676
* @param callback $processor
7777
*/
7878
public function bind($topic, $processorName, callable $processor)

pkg/enqueue/Tests/Client/MessageProducerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,4 +414,4 @@ public function jsonSerialize()
414414
{
415415
return ['foo' => 'fooVal'];
416416
}
417-
};
417+
}

pkg/enqueue/Tests/Consumption/QueueConsumerTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,8 +955,9 @@ public function testShouldCallEachQueueOneByOne()
955955
}
956956

957957
/**
958+
* @param null|mixed $message
959+
*
958960
* @return \PHPUnit_Framework_MockObject_MockObject|Consumer
959-
* @param null|mixed $message
960961
*/
961962
protected function createMessageConsumerStub($message = null)
962963
{
@@ -971,8 +972,9 @@ protected function createMessageConsumerStub($message = null)
971972
}
972973

973974
/**
975+
* @param null|mixed $messageConsumer
976+
*
974977
* @return \PHPUnit_Framework_MockObject_MockObject|PsrContext
975-
* @param null|mixed $messageConsumer
976978
*/
977979
protected function createPsrContextStub($messageConsumer = null)
978980
{

pkg/enqueue/Tests/Symfony/Client/Meta/QueuesCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ protected function executeCommand(Command $command, array $arguments = [])
9090
}
9191

9292
/**
93+
* @param mixed $destinations
94+
*
9395
* @return \PHPUnit_Framework_MockObject_MockObject|QueueMetaRegistry
94-
* @param mixed $destinations
9596
*/
9697
protected function createQueueMetaRegistryStub($destinations = [])
9798
{

pkg/enqueue/Tests/Util/JSONTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function nonStringDataProvider()
3737

3838
/**
3939
* @dataProvider nonStringDataProvider
40+
*
4041
* @param mixed $value
4142
*/
4243
public function testShouldThrowExceptionIfInputIsNotString($value)

pkg/enqueue/Tests/Util/VarExportTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public function testCouldBeConstructedWithValueAsArgument()
1313

1414
/**
1515
* @dataProvider provideValues
16+
*
1617
* @param mixed $value
1718
* @param mixed $expected
1819
*/

pkg/fs/Client/FsDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function getConfig()
173173
private function createRouterTopic()
174174
{
175175
return $this->context->createTopic(
176-
$this->config->createTransportRouterTopicName($this->config->getRouterTopicName())
176+
$this->config->createTransportQueueName($this->config->getRouterTopicName())
177177
);
178178
}
179179
}

pkg/fs/Tests/Driver/FsDriverTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,18 @@ public function testShouldSendMessageToRouter()
145145
{
146146
$topic = new FsDestination(TempFile::generate());
147147
$transportMessage = new FsMessage();
148+
$config = $this->createConfigMock();
149+
150+
$config
151+
->expects($this->once())
152+
->method('getRouterTopicName')
153+
->willReturn('topicName');
154+
155+
$config
156+
->expects($this->once())
157+
->method('createTransportQueueName')
158+
->with('topicName')
159+
->willReturn('app.topicName');
148160

149161
$producer = $this->createPsrProducerMock();
150162
$producer
@@ -156,6 +168,7 @@ public function testShouldSendMessageToRouter()
156168
$context
157169
->expects($this->once())
158170
->method('createTopic')
171+
->with('app.topicName')
159172
->willReturn($topic)
160173
;
161174
$context
@@ -171,7 +184,7 @@ public function testShouldSendMessageToRouter()
171184

172185
$driver = new FsDriver(
173186
$context,
174-
new Config('', '', '', '', '', ''),
187+
$config,
175188
$this->createQueueMetaRegistryMock()
176189
);
177190

@@ -344,4 +357,12 @@ private function createQueueMetaRegistryMock()
344357
{
345358
return $this->createMock(QueueMetaRegistry::class);
346359
}
360+
361+
/**
362+
* @return \PHPUnit_Framework_MockObject_MockObject|Config
363+
*/
364+
private function createConfigMock()
365+
{
366+
return $this->createMock(Config::class);
367+
}
347368
}

pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function stopStatusProvider()
2424

2525
/**
2626
* @dataProvider stopStatusProvider
27+
*
2728
* @param mixed $status
2829
*/
2930
public function testShouldDoNothingIfRootJobHasStopState($status)
@@ -73,6 +74,7 @@ public function testShouldCalculateRootJobStatus()
7374

7475
/**
7576
* @dataProvider stopStatusProvider
77+
*
7678
* @param mixed $stopStatus
7779
*/
7880
public function testShouldCalculateRootJobStatusAndSetStoppedAtTimeIfGotStopStatus($stopStatus)

pkg/stomp/StompConnectionFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(array $config)
4343
public function createContext()
4444
{
4545
if ($this->config['lazy']) {
46-
return new StompContext(function() {
46+
return new StompContext(function () {
4747
return $this->establishConnection();
4848
});
4949
}

pkg/stomp/Tests/StompConnectionFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ public function testShouldCreateLazyContext()
5959
$this->assertInstanceOf(StompContext::class, $context);
6060

6161
$this->assertAttributeEquals(null, 'stomp', $context);
62-
$this->assertTrue(is_callable($this->readAttribute($context, 'stompFactory')));
62+
$this->assertInternalType('callable', $this->readAttribute($context, 'stompFactory'));
6363
}
6464
}

pkg/stomp/Tests/StompContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testCouldBeCreatedWithRequiredArguments()
2929

3030
public function testCouldBeConstructedWithExtChannelCallbackFactoryAsFirstArgument()
3131
{
32-
new StompContext(function() {
32+
new StompContext(function () {
3333
return $this->createStompClientMock();
3434
});
3535
}

pkg/stomp/Tests/StompHeadersEncoderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function propertyValuesDataProvider()
3232

3333
/**
3434
* @dataProvider headerValuesDataProvider
35+
*
3536
* @param mixed $originalValue
3637
* @param mixed $encodedValue
3738
*/
@@ -42,6 +43,7 @@ public function testShouldEncodeHeaders($originalValue, $encodedValue)
4243

4344
/**
4445
* @dataProvider propertyValuesDataProvider
46+
*
4547
* @param mixed $originalValue
4648
* @param mixed $encodedValue
4749
*/
@@ -52,6 +54,7 @@ public function testShouldEncodeProperties($originalValue, $encodedValue)
5254

5355
/**
5456
* @dataProvider headerValuesDataProvider
57+
*
5558
* @param mixed $originalValue
5659
* @param mixed $encodedValue
5760
*/
@@ -62,6 +65,7 @@ public function testShouldDecodeHeaders($originalValue, $encodedValue)
6265

6366
/**
6467
* @dataProvider propertyValuesDataProvider
68+
*
6569
* @param mixed $originalValue
6670
* @param mixed $encodedValue
6771
*/

0 commit comments

Comments
 (0)