Skip to content

Bugfix/static drift #1373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,3 @@ parameters:
- pkg/enqueue-bundle/DependencyInjection/Configuration.php
- pkg/enqueue/Tests/Symfony/DependencyInjection/TransportFactoryTest.php
- pkg/simple-client/SimpleClient.php
ignoreErrors:
-
message: '#Class Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy not found#'
path: %currentWorkingDirectory%/*
-
message: '#.*Symfony\\Contracts\\EventDispatcher\\Event.*#'
path: %currentWorkingDirectory%/*
2 changes: 1 addition & 1 deletion pkg/enqueue/Client/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function create(
array $transportConfig = [],
array $driverConfig = [],
): self {
return new static(
return new self(
$prefix ?: '',
$separator ?: '.',
$app ?: '',
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Client/Driver/StompManagementClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(Client $client, string $vhost = '/')

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

public function declareQueue(string $name, array $options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InvalidArgumentException extends \InvalidArgumentException implements Exce
public static function assertInstanceOf($argument, $class)
{
if (false == $argument instanceof $class) {
throw new static(sprintf('The argument must be an instance of %s but got %s.', $class, is_object($argument) ? $argument::class : gettype($argument)));
throw new self(sprintf('The argument must be an instance of %s but got %s.', $class, is_object($argument) ? $argument::class : gettype($argument)));
}
}
}
8 changes: 4 additions & 4 deletions pkg/enqueue/Consumption/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function setReply(?InteropMessage $reply = null)
*/
public static function ack($reason = '')
{
return new static(self::ACK, $reason);
return new self(self::ACK, $reason);
}

/**
Expand All @@ -99,7 +99,7 @@ public static function ack($reason = '')
*/
public static function reject($reason)
{
return new static(self::REJECT, $reason);
return new self(self::REJECT, $reason);
}

/**
Expand All @@ -109,7 +109,7 @@ public static function reject($reason)
*/
public static function requeue($reason = '')
{
return new static(self::REQUEUE, $reason);
return new self(self::REQUEUE, $reason);
}

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

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

return $result;
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Rpc/TimeoutException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class TimeoutException extends \LogicException
*/
public static function create($timeout, $correlationId)
{
return new static(sprintf('Rpc call timeout is reached without receiving a reply message. Timeout: %s, CorrelationId: %s', $timeout, $correlationId));
return new self(sprintf('Rpc call timeout is reached without receiving a reply message. Timeout: %s, CorrelationId: %s', $timeout, $correlationId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function configureSetupBrokerExtension()
}

/**
* @return ExtensionInterface
* @return ExtensionInterface|null
*/
protected function getSetupBrokerExtension(InputInterface $input, DriverInterface $driver)
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Symfony/DiUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(string $moduleName, string $configName)

public static function create(string $moduleName, string $configName): self
{
return new static($moduleName, $configName);
return new self($moduleName, $configName);
}

public function getModuleName(): string
Expand Down
20 changes: 2 additions & 18 deletions pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,34 +147,18 @@ public function testShouldConsumeMessagesFromTwoQueuesInExpectedOrder()
$fourthMessage = $this->createMessageStub('fourth');
$fifthMessage = $this->createMessageStub('fifth');

$fooMessages = [null, $firstMessage, null, $secondMessage, $thirdMessage];

$fooConsumer = $this->createConsumerStub('foo_queue');
$fooConsumer
->expects($this->any())
->method('receiveNoWait')
->willReturnCallback(function () use (&$fooMessages) {
if (empty($fooMessages)) {
return null;
}

return array_shift($fooMessages);
})
->willReturnOnConsecutiveCalls(null, $firstMessage, null, $secondMessage, $thirdMessage)
;

$barMessages = [$fourthMessage, null, null, $fifthMessage];

$barConsumer = $this->createConsumerStub('bar_queue');
$barConsumer
->expects($this->any())
->method('receiveNoWait')
->willReturnCallback(function () use (&$barMessages) {
if (empty($barMessages)) {
return null;
}

return array_shift($barMessages);
})
->willReturnOnConsecutiveCalls($fourthMessage, null, null, $fifthMessage)
;

$actualOrder = [];
Expand Down
3 changes: 2 additions & 1 deletion pkg/enqueue/Tests/Mocks/JsonSerializableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

class JsonSerializableObject implements \JsonSerializable
{
public function jsonSerialize()
#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return ['foo' => 'fooVal'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ private function createCommandSubscriberProcessor($commandSubscriberReturns = ['

public function process(InteropMessage $message, Context $context)
{
return self::ACK;
}

public static function getSubscribedCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ private function createTopicSubscriberProcessor($topicSubscriberReturns = ['aTop

public function process(InteropMessage $message, Context $context)
{
return self::ACK;
}

public static function getSubscribedTopics()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class QueueSubscriberProcessor implements Processor, QueueSubscriberInterface
{
public function process(InteropMessage $message, Context $context)
{
return self::ACK;
}

public static function getSubscribedQueues()
Expand Down
3 changes: 2 additions & 1 deletion pkg/enqueue/Tests/Util/Fixtures/JsonSerializableClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class JsonSerializableClass implements \JsonSerializable
{
public $keyPublic = 'public';

public function jsonSerialize()
#[\ReturnTypeWillChange]
public function jsonSerialize(): array
{
return [
'key' => 'value',
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Util/Stringify.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public function __toString(): string

public static function that($value): self
{
return new static($value);
return new self($value);
}
}
6 changes: 6 additions & 0 deletions pkg/job-queue/Test/DbalPersistedConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,22 @@ public function connect()
public function beginTransaction()
{
$this->wrapTransactionNestingLevel('beginTransaction');

return true;
}

public function commit()
{
$this->wrapTransactionNestingLevel('commit');

return true;
}

public function rollBack()
{
$this->wrapTransactionNestingLevel('rollBack');

return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitoring/InfluxDbStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static function createWithClient(Client $client, $config = 'influxdb:'):
}
$config['client'] = $client;

return new static($config);
return new self($config);
}

public function pushConsumerStats(ConsumerStats $stats): void
Expand Down
2 changes: 2 additions & 0 deletions pkg/rdkafka/RdKafkaProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@ public function flush(int $timeout): ?int
if (method_exists($this->producer, 'flush')) {
return $this->producer->flush($timeout);
}

return null;
}
}
Loading