Skip to content

Commit 8cdbc1b

Browse files
authored
Merge pull request #1373 from JimTools/bugfix/static-drift
Bugfix/static drift
2 parents fcaa718 + a6d8669 commit 8cdbc1b

18 files changed

+29
-39
lines changed

phpstan.neon

-7
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,3 @@ parameters:
1414
- pkg/enqueue-bundle/DependencyInjection/Configuration.php
1515
- pkg/enqueue/Tests/Symfony/DependencyInjection/TransportFactoryTest.php
1616
- pkg/simple-client/SimpleClient.php
17-
ignoreErrors:
18-
-
19-
message: '#Class Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy not found#'
20-
path: %currentWorkingDirectory%/*
21-
-
22-
message: '#.*Symfony\\Contracts\\EventDispatcher\\Event.*#'
23-
path: %currentWorkingDirectory%/*

pkg/enqueue/Client/Config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static function create(
163163
array $transportConfig = [],
164164
array $driverConfig = [],
165165
): self {
166-
return new static(
166+
return new self(
167167
$prefix ?: '',
168168
$separator ?: '.',
169169
$app ?: '',

pkg/enqueue/Client/Driver/StompManagementClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(Client $client, string $vhost = '/')
2424

2525
public static function create(string $vhost = '/', string $host = 'localhost', int $port = 15672, string $login = 'guest', string $password = 'guest'): self
2626
{
27-
return new static(new Client(null, 'http://'.$host.':'.$port, $login, $password), $vhost);
27+
return new self(new Client(null, 'http://'.$host.':'.$port, $login, $password), $vhost);
2828
}
2929

3030
public function declareQueue(string $name, array $options)

pkg/enqueue/Consumption/Exception/InvalidArgumentException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class InvalidArgumentException extends \InvalidArgumentException implements Exce
1212
public static function assertInstanceOf($argument, $class)
1313
{
1414
if (false == $argument instanceof $class) {
15-
throw new static(sprintf('The argument must be an instance of %s but got %s.', $class, is_object($argument) ? $argument::class : gettype($argument)));
15+
throw new self(sprintf('The argument must be an instance of %s but got %s.', $class, is_object($argument) ? $argument::class : gettype($argument)));
1616
}
1717
}
1818
}

pkg/enqueue/Consumption/Result.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function setReply(?InteropMessage $reply = null)
8989
*/
9090
public static function ack($reason = '')
9191
{
92-
return new static(self::ACK, $reason);
92+
return new self(self::ACK, $reason);
9393
}
9494

9595
/**
@@ -99,7 +99,7 @@ public static function ack($reason = '')
9999
*/
100100
public static function reject($reason)
101101
{
102-
return new static(self::REJECT, $reason);
102+
return new self(self::REJECT, $reason);
103103
}
104104

105105
/**
@@ -109,7 +109,7 @@ public static function reject($reason)
109109
*/
110110
public static function requeue($reason = '')
111111
{
112-
return new static(self::REQUEUE, $reason);
112+
return new self(self::REQUEUE, $reason);
113113
}
114114

115115
/**
@@ -122,7 +122,7 @@ public static function reply(InteropMessage $replyMessage, $status = self::ACK,
122122
{
123123
$status = null === $status ? self::ACK : $status;
124124

125-
$result = new static($status, $reason);
125+
$result = new self($status, $reason);
126126
$result->setReply($replyMessage);
127127

128128
return $result;

pkg/enqueue/Rpc/TimeoutException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ class TimeoutException extends \LogicException
1212
*/
1313
public static function create($timeout, $correlationId)
1414
{
15-
return new static(sprintf('Rpc call timeout is reached without receiving a reply message. Timeout: %s, CorrelationId: %s', $timeout, $correlationId));
15+
return new self(sprintf('Rpc call timeout is reached without receiving a reply message. Timeout: %s, CorrelationId: %s', $timeout, $correlationId));
1616
}
1717
}

pkg/enqueue/Symfony/Client/SetupBrokerExtensionCommandTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ protected function configureSetupBrokerExtension()
1818
}
1919

2020
/**
21-
* @return ExtensionInterface
21+
* @return ExtensionInterface|null
2222
*/
2323
protected function getSetupBrokerExtension(InputInterface $input, DriverInterface $driver)
2424
{

pkg/enqueue/Symfony/DiUtils.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(string $moduleName, string $configName)
2727

2828
public static function create(string $moduleName, string $configName): self
2929
{
30-
return new static($moduleName, $configName);
30+
return new self($moduleName, $configName);
3131
}
3232

3333
public function getModuleName(): string

pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php

+2-18
Original file line numberDiff line numberDiff line change
@@ -147,34 +147,18 @@ public function testShouldConsumeMessagesFromTwoQueuesInExpectedOrder()
147147
$fourthMessage = $this->createMessageStub('fourth');
148148
$fifthMessage = $this->createMessageStub('fifth');
149149

150-
$fooMessages = [null, $firstMessage, null, $secondMessage, $thirdMessage];
151-
152150
$fooConsumer = $this->createConsumerStub('foo_queue');
153151
$fooConsumer
154152
->expects($this->any())
155153
->method('receiveNoWait')
156-
->willReturnCallback(function () use (&$fooMessages) {
157-
if (empty($fooMessages)) {
158-
return null;
159-
}
160-
161-
return array_shift($fooMessages);
162-
})
154+
->willReturnOnConsecutiveCalls(null, $firstMessage, null, $secondMessage, $thirdMessage)
163155
;
164156

165-
$barMessages = [$fourthMessage, null, null, $fifthMessage];
166-
167157
$barConsumer = $this->createConsumerStub('bar_queue');
168158
$barConsumer
169159
->expects($this->any())
170160
->method('receiveNoWait')
171-
->willReturnCallback(function () use (&$barMessages) {
172-
if (empty($barMessages)) {
173-
return null;
174-
}
175-
176-
return array_shift($barMessages);
177-
})
161+
->willReturnOnConsecutiveCalls($fourthMessage, null, null, $fifthMessage)
178162
;
179163

180164
$actualOrder = [];

pkg/enqueue/Tests/Mocks/JsonSerializableObject.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
class JsonSerializableObject implements \JsonSerializable
66
{
7-
public function jsonSerialize()
7+
#[\ReturnTypeWillChange]
8+
public function jsonSerialize(): array
89
{
910
return ['foo' => 'fooVal'];
1011
}

pkg/enqueue/Tests/Symfony/Client/DependencyInjection/BuildCommandSubscriberRoutesPassTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ private function createCommandSubscriberProcessor($commandSubscriberReturns = ['
443443

444444
public function process(InteropMessage $message, Context $context)
445445
{
446+
return self::ACK;
446447
}
447448

448449
public static function getSubscribedCommand()

pkg/enqueue/Tests/Symfony/Client/DependencyInjection/BuildTopicSubscriberRoutesPassTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ private function createTopicSubscriberProcessor($topicSubscriberReturns = ['aTop
407407

408408
public function process(InteropMessage $message, Context $context)
409409
{
410+
return self::ACK;
410411
}
411412

412413
public static function getSubscribedTopics()

pkg/enqueue/Tests/Symfony/Consumption/Mock/QueueSubscriberProcessor.php

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class QueueSubscriberProcessor implements Processor, QueueSubscriberInterface
1111
{
1212
public function process(InteropMessage $message, Context $context)
1313
{
14+
return self::ACK;
1415
}
1516

1617
public static function getSubscribedQueues()

pkg/enqueue/Tests/Util/Fixtures/JsonSerializableClass.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ class JsonSerializableClass implements \JsonSerializable
66
{
77
public $keyPublic = 'public';
88

9-
public function jsonSerialize()
9+
#[\ReturnTypeWillChange]
10+
public function jsonSerialize(): array
1011
{
1112
return [
1213
'key' => 'value',

pkg/enqueue/Util/Stringify.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public function __toString(): string
2525

2626
public static function that($value): self
2727
{
28-
return new static($value);
28+
return new self($value);
2929
}
3030
}

pkg/job-queue/Test/DbalPersistedConnection.php

+6
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,22 @@ public function connect()
4141
public function beginTransaction()
4242
{
4343
$this->wrapTransactionNestingLevel('beginTransaction');
44+
45+
return true;
4446
}
4547

4648
public function commit()
4749
{
4850
$this->wrapTransactionNestingLevel('commit');
51+
52+
return true;
4953
}
5054

5155
public function rollBack()
5256
{
5357
$this->wrapTransactionNestingLevel('rollBack');
58+
59+
return true;
5460
}
5561

5662
/**

pkg/monitoring/InfluxDbStorage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static function createWithClient(Client $client, $config = 'influxdb:'):
109109
}
110110
$config['client'] = $client;
111111

112-
return new static($config);
112+
return new self($config);
113113
}
114114

115115
public function pushConsumerStats(ConsumerStats $stats): void

pkg/rdkafka/RdKafkaProducer.php

+2
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,7 @@ public function flush(int $timeout): ?int
121121
if (method_exists($this->producer, 'flush')) {
122122
return $this->producer->flush($timeout);
123123
}
124+
125+
return null;
124126
}
125127
}

0 commit comments

Comments
 (0)