8000 minor #44679 CS fixes (nicolas-grekas) · symfony/symfony@f1914c0 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1914c0

Browse files
minor #44679 CS fixes (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- CS fixes | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Running php-cs-fixer on the codebase Commits ------- 6e3b711 CS fixes
2 parents ee211c4 + 6e3b711 commit f1914c0

File tree

17 files changed

+30
-28
lines changed

17 files changed

+30
-28
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'@Symfony' => true,
1212
'@Symfony:risky' => true,
1313
'protected_to_private' => false,
14+
'native_constant_invocation' => ['strict' => false],
1415
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => false],
1516
])
1617
->setRiskyAllowed(true)

src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function pingConnection(EntityManagerInterface $entityManager)
4040

4141
try {
4242
$connection->executeQuery($connection->getDatabasePlatform()->getDummySelectSQL());
43-
} catch (DBALException | Exception $e) {
43+
} catch (DBALException|Exception $e) {
4444
$connection->close();
4545
$connection->connect();
4646
}

src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private function getMetadata(string $class): ?ClassMetadata
230230
{
231231
try {
232232
return $this->entityManager ? $this->entityManager->getClassMetadata($class) : $this->classMetadataFactory->getMetadataFor($class);
233-
} catch (MappingException | OrmMappingException $exception) {
233+
} catch (MappingException|OrmMappingException $exception) {
234234
return null;
235235
}
236236
}

src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool
4949
$className = $metadata->getClassName();
5050
try {
5151
$doctrineMetadata = $this->entityManager->getClassMetadata($className);
52-
} catch (MappingException | OrmMappingException $exception) {
52+
} catch (MappingException|OrmMappingException $exception) {
5353
return false;
5454
}
5555

src/Symfony/Component/Cache/Traits/PdoTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ protected function doSave(array $values, int $lifetime)
412412
if (null === $driver && !(\is_object($result) ? $result->rowCount() : $stmt->rowCount())) {
413413
try {
414414
$insertStmt->execute();
415-
} catch (DBALException | Exception $e) {
415+
} catch (DBALException|Exception $e) {
416416
} catch (\PDOException $e) {
417417
// A concurrent write won, let it be
418418
}

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,11 +1222,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U
12221222

12231223
try {
12241224
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
1225-
} catch (\Exception | \ValueError $e) {
1225+
} catch (\Exception|\ValueError $e) {
12261226
try {
12271227
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
12281228
$htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
1229-
} catch (\Exception | \ValueError $e) {
1229+
} catch (\Exception|\ValueError $e) {
12301230
}
12311231

12321232
return $htmlContent;

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public function __construct(bool $usePutenv = true)
5454
/**
5555
* Loads one or several .env files.
5656
*
57-
* @param string $path A file to load
58-
* @param ...string $extraPaths A list of additional files to load
57+
* @param string $path A file to load
58+
* @param string[] ...$extraPaths A list of additional files to load
5959
*
6060
* @throws FormatException when a file has a syntax error
6161
* @throws PathException when a file does not exist or is not readable
@@ -112,8 +112,8 @@ public function loadEnv(string $path, string $varName = 'APP_ENV', string $defau
112112
/**
113113
* Loads one or several .env files and enables override existing vars.
114114
*
115-
* @param string $path A file to load
116-
* @param ...string $extraPaths A list of additional files to load
115+
* @param string $path A file to load
116+
* @param string[] ...$extraPaths A list of additional files to load
117117
*
118118
* @throws FormatException when a file has a syntax error
119119
* @throws PathException when a file does not exist or is not readable

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ protected function doRead($sessionId)
626626
$selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
627627
$insertStmt = null;
628628

629-
do {
629+
while (true) {
630630
$selectStmt->execute();
631631
$sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM);
632632

@@ -675,7 +675,7 @@ protected function doRead($sessionId)
675675
}
676676

677677
return '';
678-
} while (true);
678+
}
679679
}
680680

681681
/**

src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getController(Request $request)
4747
if (isset($controller[0]) && \is_string($controller[0]) && isset($controller[1])) {
4848
try {
4949
$controller[0] = $this->instantiateController($controller[0]);
50-
} catch (\Error | \LogicException $e) {
50+
} catch (\Error|\LogicException $e) {
5151
try {
5252
// We cannot just check is_callable but have to use reflection because a non-static method
5353
// can still be called statically in PHP but we don't want that. This is deprecated in PHP 7, so we
@@ -120,7 +120,7 @@ protected function createController($controller)
120120

121121
try {
122122
$controller = [$this->instantiateController($class), $method];
123-
} catch (\Error | \LogicException $e) {
123+
} catch (\Error|\LogicException $e) {
124124
try {
125125
if ((new \ReflectionMethod($class, $method))->isStatic()) {
126126
return $class.'::'.$method;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function save(Key $key)
127127

128128
try {
129129
$stmt->execute();
130-
} catch (DBALException | Exception $e) {
130+
} catch (DBALException|Exception $e) {
131131
// the lock is already acquired. It could be us. Let's try to put off.
132132
$this->putOffExpiration($key, $this->initialTtl);
133133
} catch (\PDOException $e) {

src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function ack(string $id): bool
225225
{
226226
try {
227227
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
228-
} catch (DBALException | Exception $exception) {
228+
} catch (DBALException|Exception $exception) {
229229
throw new TransportException($exception->getMessage(), 0, $exception);
230230
}
231231
}
@@ -234,7 +234,7 @@ public function reject(string $id): bool
234234
{
235235
try {
236236
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
237-
} catch (DBALException | Exception $exception) {
237+
} catch (DBALException|Exception $exception) {
238238
throw new TransportException($exception->getMessage(), 0, $exception);
239239
}
240240
}

src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineReceiver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function get(): iterable
5959
}
6060

6161
return [];
62-
} catch (DBALException | Exception $exception) {
62+
} catch (DBALException|Exception $exception) {
6363
throw new TransportException($exception->getMessage(), 0, $exception);
6464
}
6565

@@ -77,7 +77,7 @@ public function ack(Envelope $envelope): void
7777
{
7878
try {
7979
$this->connection->ack($this->findDoctrineReceivedStamp($envelope)->getId());
80-
} catch (DBALException | Exception $exception) {
80+
} catch (DBALException|Exception $exception) {
8181
throw new TransportException($exception->getMessage(), 0, $exception);
8282
}
8383
}
@@ -89,7 +89,7 @@ public function reject(Envelope $envelope): void
8989
{
9090
try {
9191
$this->connection->reject($this->findDoctrineReceivedStamp($envelope)->getId());
92-
} catch (DBALException | Exception $exception) {
92+
} catch (DBALException|Exception $exception) {
9393
throw new TransportException($exception->getMessage(), 0, $exception);
9494
}
9595
}
@@ -101,7 +101,7 @@ public function getMessageCount(): int
101101
{
102102
try {
103103
return $this->connection->getMessageCount();
104-
} catch (DBALException | Exception $exception) {
104+
} catch (DBALException|Exception $exception) {
105105
throw new TransportException($exception->getMessage(), 0, $exception);
106106
}
107107
}
@@ -113,7 +113,7 @@ public function all(int $limit = null): iterable
113113
{
114114
try {
115115
$doctrineEnvelopes = $this->connection->findAll($limit);
116-
} catch (DBALException | Exception $exception) {
116+
} catch (DBALException|Exception $exception) {
117117
throw new TransportException($exception->getMessage(), 0, $exception);
118118
}
119119

@@ -129,7 +129,7 @@ public function find($id): ?Envelope
129129
{
130130
try {
131131
$doctrineEnvelope = $this->connection->find($id);
132-
} catch (DBALException | Exception $exception) {
132+
} catch (DBALException|Exception $exception) {
133133
throw new TransportException($exception->getMessage(), 0, $exception);
134134
}
135135

src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineSender.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function send(Envelope $envelope): Envelope
4848

4949
try {
5050
$id = $this->connection->send($encodedMessage['body'], $encodedMessage['headers'] ?? [], $delay);
51-
} catch (DBALException | Exception $exception) {
51+
} catch (DBALException|Exception $exception) {
5252
throw new TransportException($exception->getMessage(), 0, $exception);
5353
}
5454

src/Symfony/Component/Process/Pipes/AbstractPipes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected function write(): ?array
133133
}
134134

135135
if ($input) {
136-
for (;;) {
136+
while (true) {
137137
$data = fread($input, self::CHUNK_SIZE);
138138
if (!isset($data[0])) {
139139
break;

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ public function testIterateOverProcessWithTimeout()
772772
$start = microtime(true);
773773
try {
774774
$process->start();
775-
foreach ($process as $buffer);
775+
foreach ($process as $buffer) {
776+
}
776777
$this->fail('A RuntimeException should have been raised');
777778
} catch (RuntimeException $e) {
778779
}

src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function authenticate(TokenInterface $token)
8181
$this->userChecker->checkPreAuth($user);
8282
$this->checkAuthentication($user, $token);
8383
$this->userChecker->checkPostAuth($user);
84-
} catch (AccountStatusException | BadCredentialsException $e) {
84+
} catch (AccountStatusException|BadCredentialsException $e) {
8585
if ($this->hideUserNotFoundExceptions) {
8686
throw new BadCredentialsException('Bad credentials.', 0, $e);
8787
}

src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testHandleNonStringUsernameWithObject(bool $postOnly)
160160
/**
161161
* @dataProvider postOnlyDataProvider
162162
*/
163-
public function testHandleNonStringUsernameWith__toString(bool $postOnly)
163+
public function testHandleNonStringUsernameWithToString(bool $postOnly)
164164
{
165165
$usernameClass = $this->createMock(DummyUserClass::class);
166166
$usernameClass

0 commit comments

Comments
 (0)
0