Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CS fixes #44679

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 1 commit into from
Dec 16, 2021
Merged

CS fixes #44679

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
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'@Symfony' => true,
'@Symfony:risky' => true,
'protected_to_private' => false,
'native_constant_invocation' => ['strict' => false],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => false],
])
->setRiskyAllowed(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private function pingConnection(EntityManagerInterface $entityManager)

try {
$connection->executeQuery($connection->getDatabasePlatform()->getDummySelectSQL());
} catch (DBALException | Exception $e) {
} catch (DBALException|Exception $e) {
$connection->close();
$connection->connect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private function getMetadata(string $class): ?ClassMetadata
{
try {
return $this->entityManager ? $this->entityManager->getClassMetadata($class) : $this->classMetadataFactory->getMetadataFor($class);
} catch (MappingException | OrmMappingException $exception) {
} catch (MappingException|OrmMappingException $exception) {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool
$className = $metadata->getClassName();
try {
$doctrineMetadata = $this->entityManager->getClassMetadata($className);
} catch (MappingException | OrmMappingException $exception) {
} catch (MappingException|OrmMappingException $exception) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Traits/PdoTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ protected function doSave(array $values, int $lifetime)
if (null === $driver && !(\is_object($result) ? $result->rowCount() : $stmt->rowCount())) {
try {
$insertStmt->execute();
} catch (DBALException | Exception $e) {
} catch (DBALException|Exception $e) {
} catch (\PDOException $e) {
// A concurrent write won, let it be
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1222,11 +1222,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U

try {
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
} catch (\Exception | \ValueError $e) {
} catch (\Exception|\ValueError $e) {
try {
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
$htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
} catch (\Exception | \ValueError $e) {
} catch (\Exception|\ValueError $e) {
}

return $htmlContent;
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Dotenv/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function __construct(bool $usePutenv = true)
/**
* Loads one or several .env files.
*
* @param string $path A file to load
* @param ...string $extraPaths A list of additional files to load
* @param string $path A file to load
* @param string[] ...$extraPaths A list of additional files to load
*
* @throws FormatException when a file has a syntax error
* @throws PathException when a file does not exist or is not readable
Expand Down Expand Up @@ -112,8 +112,8 @@ public function loadEnv(string $path, string $varName = 'APP_ENV', string $defau
/**
* Loads one or several .env files and enables override existing vars.
*
* @param string $path A file to load
* @param ...string $extraPaths A list of additional files to load
* @param string $path A file to load
* @param string[] ...$extraPaths A list of additional files to load
*
* @throws FormatException when a file has a syntax error
* @throws PathException when a file does not exist or is not readable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ protected function doRead($sessionId)
$selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
$insertStmt = null;

do {
while (true) {
$selectStmt->execute();
$sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM);

Expand Down Expand Up @@ -675,7 +675,7 @@ protected function doRead($sessionId)
}

return '';
} while (true);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getController(Request $request)
if (isset($controller[0]) && \is_string($controller[0]) && isset($controller[1])) {
try {
$controller[0] = $this->instantiateController($controller[0]);
} catch (\Error | \LogicException $e) {
} catch (\Error|\LogicException $e) {
try {
// We cannot just check is_callable but have to use reflection because a non-static method
// can still be called statically in PHP but we don't want that. This is deprecated in PHP 7, so we
Expand Down Expand Up @@ -120,7 +120,7 @@ protected function createController($controller)

try {
$controller = [$this->instantiateController($class), $method];
} catch (\Error | \LogicException $e) {
} catch (\Error|\LogicException $e) {
try {
if ((new \ReflectionMethod($class, $method))->isStatic()) {
return $class.'::'.$method;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Lock/Store/PdoStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function save(Key $key)

try {
$stmt->execute();
} catch (DBALException | Exception $e) {
} catch (DBALException|Exception $e) {
// the lock is already acquired. It could be us. Let's try to put off.
$this->putOffExpiration($key, $this->initialTtl);
} catch (\PDOException $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function ack(string $id): bool
{
try {
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -234,7 +234,7 @@ public function reject(string $id): bool
{
try {
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function get(): iterable
}

return [];
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}

Expand All @@ -77,7 +77,7 @@ public function ack(Envelope $envelope): void
{
try {
$this->connection->ack($this->findDoctrineReceivedStamp($envelope)->getId());
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -89,7 +89,7 @@ public function reject(Envelope $envelope): void
{
try {
$this->connection->reject($this->findDoctrineReceivedStamp($envelope)->getId());
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -101,7 +101,7 @@ public function getMessageCount(): int
{
try {
return $this->connection->getMessageCount();
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -113,7 +113,7 @@ public function all(int $limit = null): iterable
{
try {
$doctrineEnvelopes = $this->connection->findAll($limit);
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}

Expand All @@ -129,7 +129,7 @@ public function find($id): ?Envelope
{
try {
$doctrineEnvelope = $this->connection->find($id);
} catch (DBALException | Exception $exception) {
} catch (DBALException|Exception $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function send(Envelope $envelope): Envelope

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

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Process/Pipes/AbstractPipes.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected function write(): ?array
}

if ($input) {
for (;;) {
while (true) {
$data = fread($input, self::CHUNK_SIZE);
if (!isset($data[0])) {
break;
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Process/Tests/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,8 @@ public function testIterateOverProcessWithTimeout()
$start = microtime(true);
try {
$process->start();
foreach ($process as $buffer);
foreach ($process as $buffer) {
}
$this->fail('A RuntimeException should have been raised');
} catch (RuntimeException $e) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function authenticate(TokenInterface $token)
$this->userChecker->checkPreAuth($user);
$this->checkAuthentication($user, $token);
$this->userChecker->checkPostAuth($user);
} catch (AccountStatusException | BadCredentialsException $e) {
} catch (AccountStatusException|BadCredentialsException $e) {
if ($this->hideUserNotFoundExceptions) {
throw new BadCredentialsException('Bad credentials.', 0, $e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function testHandleNonStringUsernameWithObject(bool $postOnly)
/**
* @dataProvider postOnlyDataProvider
*/
public function testHandleNonStringUsernameWith__toString(bool $postOnly)
public function testHandleNonStringUsernameWithToString(bool $postOnly)
{
$usernameClass = $this->createMock(DummyUserClass::class);
$usernameClass
Expand Down