Skip to content

Commit dd9fa15

Browse files
minor symfony#57868 Remove useless code (alexandre-daubois)
This PR was merged into the 7.2 branch. Discussion ---------- Remove useless code | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT I went through the remaining components and bundles, following my last PRs of this kind. Commits ------- 58941ce Remove useless code
2 parents c9056d0 + 58941ce commit dd9fa15

File tree

30 files changed

+31
-76
lines changed

30 files changed

+31
-76
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private function createFirewalls(array $config, ContainerBuilder $container): vo
307307

308308
$configId = 'security.firewall.map.config.'.$name;
309309

310-
[$matcher, $listeners, $exceptionListener, $logoutListener, $firewallAuthenticators] = $this->createFirewall($container, $name, $firewall, $authenticationProviders, $providerIds, $configId);
310+
[$matcher, $listeners, $exceptionListener, $logoutListener, $firewallAuthenticators] = $this->createFirewall($container, $name, $firewall, $providerIds, $configId);
311311

312312
if (!$firewallAuthenticators) {
313313
$authenticators[$name] = null;
@@ -348,7 +348,7 @@ private function createFirewalls(array $config, ContainerBuilder $container): vo
348348
}
349349
}
350350

351-
private function createFirewall(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, array $providerIds, string $configId): array
351+
private function createFirewall(ContainerBuilder $container, string $id, array $firewall, array $providerIds, string $configId): array
352352
{
353353
$config = $container->setDefinition($configId, new ChildDefinition('security.firewall.config'));
354354
$config->replaceArgument(0, $id);

src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
6060

6161
if ('single_text' === $options['widget']) {
6262
$builder->addEventListener(FormEvents::PRE_SUBMIT, static function (FormEvent $e) use ($options) {
63-
/** @var PreSubmitEvent $event */
6463
$data = $e->getData();
6564
if ($data && preg_match('/^(?P<hours>\d{2}):(?P<minutes>\d{2})(?::(?P<seconds>\d{2})(?:\.\d+)?)?$/', $data, $matches)) {
6665
if ($options['with_seconds']) {

src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ protected function generateDataForRoot(BundleEntryReaderInterface $reader, strin
121121

122122
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
123123
{
124-
$rootBundle = $reader->read($tempDir, 'root');
125-
126124
$this->zoneIds = array_unique($this->zoneIds);
127125

128126
sort($this->zoneIds);

src/Symfony/Component/Lock/Store/PostgreSqlStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function exists(Key $key): bool
169169
$stmt = $this->getConnection()->prepare($sql);
170170

171171
$stmt->bindValue(':key', $this->getHashedKey($key));
172-
$result = $stmt->execute();
172+
$stmt->execute();
173173

174174
if ($stmt->fetchColumn() > 0) {
175175
// connection is locked, check for lock in internal store

src/Symfony/Component/Mailer/Bridge/Azure/Transport/AzureApiTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
6565

6666
$response = $this->client->request('POST', 'https://'.$endpoint, [
6767
'body' => json_encode($payload),
68-
'headers' => $this->getSignedHeaders($payload, $email),
68+
'headers' => $this->getSignedHeaders($payload),
6969
]);
7070

7171
try {
@@ -189,7 +189,7 @@ private function generateAuthenticationSignature(string $content): string
189189
/**
190190
* Get authenticated headers for signed request,.
191191
*/
192-
private function getSignedHeaders(array $payload, Email $message): array
192+
private function getSignedHeaders(array $payload): array
193193
{
194194
// HTTP Method verb (uppercase)
195195
$verb = 'POST';

src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunApiTransportTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ public function testCustomHeader()
103103
*/
104104
public function testPrefixHeaderWithH()
105105
{
106-
$json = json_encode(['foo' => 'bar']);
107-
$deliveryTime = (new \DateTimeImmutable('2020-03-20 13:01:00'))->format(\DateTimeInterface::RFC2822);
108-
109106
$email = new Email();
110107
$email->getHeaders()->addTextHeader('h:bar', 'bar-value');
111108

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsReceiverTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ private function createSqsEnvelope()
6767

6868
private function createSerializer(): Serializer
6969
{
70-
$serializer = new Serializer(
70+
return new Serializer(
7171
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
7272
);
73-
74-
return $serializer;
7573
}
7674
}

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
157157
}
158158

159159
$parsedPath = explode('/', ltrim($params['path'] ?? '/', '/'));
160-
if (\count($parsedPath) > 0 && ($queueName = end($parsedPath))) {
160+
if ($queueName = end($parsedPath)) {
161161
$configuration['queue_name'] = $queueName;
162162
}
163163
$configuration['account'] = 2 === \count($parsedPath) ? $parsedPath[0] : $options['account'] ?? self::DEFAULT_OPTIONS['account'];

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function countMessagesInQueues(): int
318318
private function publishWithDelay(string $body, array $headers, int $delay, ?AmqpStamp $amqpStamp = null): void
319319
{
320320
$routingKey = $this->getRoutingKeyForMessage($amqpStamp);
321-
$isRetryAttempt = $amqpStamp ? $amqpStamp->isRetryAttempt() : false;
321+
$isRetryAttempt = $amqpStamp && $amqpStamp->isRetryAttempt();
322322

323323
$this->setupDelay($delay, $routingKey, $isRetryAttempt);
324324

src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/BeanstalkdReceiverTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,8 @@ private function createBeanstalkdEnvelope(): array
9191

9292
private function createSerializer(): Serializer
9393
{
94-
$serializer = new Serializer(
94+
return new Serializer(
9595
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
9696
);
97-
98-
return $serializer;
9997
}
10098
}

0 commit comments

Comments
 (0)