8000 Apply operator_linebreak PHP-CS-Fixer rule · umpirsky/symfony@6edc748 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6edc748

Browse files
committed
Apply operator_linebreak PHP-CS-Fixer rule
1 parent cc7cdf2 commit 6edc748

File tree

25 files changed

+68
-71
lines changed

25 files changed

+68
-71
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,14 @@ private function detectMappingType(string $directory, ContainerBuilder $containe
305305
$content = file_get_contents($file);
306306

307307
if (
308-
preg_match('/^#\[.*'.$quotedMappingObjectName.'\b/m', $content) ||
309-
preg_match('/^#\[.*Embeddable\b/m', $content)
308+
preg_match('/^#\[.*'.$quotedMappingObjectName.'\b/m', $content)
309+
|| preg_match('/^#\[.*Embeddable\b/m', $content)
310310
) {
311311
break;
312312
}
313313
if (
314-
preg_match('/^(?: \*|\/\*\*) @.*'.$quotedMappingObjectName.'\b/m', $content) ||
315-
preg_match('/^(?: \*|\/\*\*) @.*Embeddable\b/m', $content)
314+
preg_match('/^(?: \*|\/\*\*) @.*'.$quotedMappingObjectName.'\b/m', $content)
315+
|| preg_match('/^(?: \*|\/\*\*) @.*Embeddable\b/m', $content)
316316
) {
317317
$type = 'annotation';
318318
break;

src/Symfony/Bridge/Twig/Extension/RoutingExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public function isUrlGenerationSafe(Node $argsNode): array
7979
$argsNode->hasNode(1) ? $argsNode->getNode(1) : null
8080
);
8181

82-
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2 &&
83-
(!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression)
82+
if (null === $paramsNode || $paramsNode instanceof ArrayExpression && \count($paramsNode) <= 2
83+
&& (!$paramsNode->hasNode(1) || $paramsNode->getNode(1) instanceof ConstantExpression)
8484
) {
8585
return ['html'];
8686
}

src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ protected function doEnterNode(Node $node, Environment $env): Node
5656
}
5757

5858
if (
59-
$node instanceof FilterExpression &&
60-
'trans' === $node->getNode('filter')->getAttribute('value') &&
61-
$node->getNode('node') instanceof ConstantExpression
59+
$node instanceof FilterExpression
60+
&& 'trans' === $node->getNode('filter')->getAttribute('value')
61+
&& $node->getNode('node') instanceof ConstantExpression
6262
) {
6363
// extract constant nodes with a trans filter
6464
$this->messages[] = [
6565
$node->getNode('node')->getAttribute('value'),
6666
$this->getReadDomainFromArguments($node->getNode('arguments'), 1),
6767
];
6868
} elseif (
69-
$node instanceof FunctionExpression &&
70-
't' === $node->getAttribute('name')
69+
$node instanceof FunctionExpression
70+
&& 't' === $node->getAttribute('name')
7171
) {
7272
$nodeArguments = $node->getNode('arguments');
7373

@@ -84,10 +84,10 @@ protected function doEnterNode(Node $node, Environment $env): Node
8484
$node->hasNode('domain') ? $this->getReadDomainFromNode($node->getNode('domain')) : null,
8585
];
8686
} elseif (
87-
$node instanceof FilterExpression &&
88-
'trans' === $node->getNode('filter')->getAttribute('value') &&
89-
$node->getNode('node') instanceof ConcatBinary &&
90-
$message = $this->getConcatValueFromNode($node->getNode('node'), null)
87+
$node instanceof FilterExpression
88+
&& 'trans' === $node->getNode('filter')->getAttribute('value')
89+
&& $node->getNode('node') instanceof ConcatBinary
90+
&& $message = $this->getConcatValueFromNode($node->getNode('node'), null)
9191
) {
9292
$this->messages[] = [
9393
$message,

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,8 +1622,8 @@ private function registerValidatorMapping(ContainerBuilder $container, array $co
16221622
$configDir = is_dir($bundle['path'].'/Resources/config') ? $bundle['path'].'/Resources/config' : $bundle['path'].'/config';
16231623

16241624
if (
1625-
$container->fileExists($file = $configDir.'/validation.yaml', false) ||
1626-
$container->fileExists($file = $configDir.'/validation.yml', false)
1625+
$container->fileExists($file = $configDir.'/validation.yaml', false)
1626+
|| $container->fileExists($file = $configDir.'/validation.yml', false)
16271627
) {
16281628
$fileRecorder('yml', $file);
16291629
}
@@ -1859,8 +1859,8 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
18591859
}
18601860

18611861
if (
1862-
$container->fileExists($file = $configDir.'/serialization.yaml', false) ||
1863-
$container->fileExists($file = $configDir.'/serialization.yml', false)
1862+
$container->fileExists($file = $configDir.'/serialization.yaml', false)
1863+
|| $container->fileExists($file = $configDir.'/serialization.yml', false)
18641864
) {
18651865
$fileRecorder('yml', $file);
18661866
}

src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ private function phpize(string $value): mixed
8989
'off' === $lowercaseValue,
9090
'none' === $lowercaseValue => false,
9191
isset($value[1]) && (
92-
("'" === $value[0] && "'" === $value[\strlen($value) - 1]) ||
93-
('"' === $value[0] && '"' === $value[\strlen($value) - 1])
92+
("'" === $value[0] && "'" === $value[\strlen($value) - 1])
93+
|| ('"' === $value[0] && '"' === $value[\strlen($value) - 1])
9494
) => substr($value, 1, -1), // quoted string
9595
default => XmlUtils::phpize($value),
9696
};

src/Symfony/Component/ExpressionLanguage/Parser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ public function parsePostfixExpression(Node\Node $node)
365365

366366
if (
367367
Token::NAME_TYPE !== $token->type
368-
&&
369368
// Operators like "not" and "matches" are valid method or property names,
370369
//
371370
// In other words, besides NAME_TYPE, OPERATOR_TYPE could also be parsed as a property or method.
@@ -377,7 +376,7 @@ public function parsePostfixExpression(Node\Node $node)
377376
// Other types, such as STRING_TYPE and NUMBER_TYPE, can't be parsed as property nor method names.
378377
//
379378
// As a result, if $token is NOT an operator OR $token->value is NOT a valid property or method name, an exception shall be thrown.
380-
(Token::OPERATOR_TYPE !== $token->type || !preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $token->value))
379+
&& (Token::OPERATOR_TYPE !== $token->type || !preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A', $token->value))
381380
) {
382381
throw new SyntaxError('Expected name.', $token->cursor, $this->stream->getExpression());
383382
}

src/Symfony/Component/Form/Form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,11 @@ public function isEmpty(): bool
636636
return $isEmptyCallback($this->modelData);
637637
}
638638

639-
return FormUtil::isEmpty($this->modelData) ||
639+
return FormUtil::isEmpty($this->modelData)
640640
// arrays, countables
641-
(is_countable($this->modelData) && 0 === \count($this->modelData)) ||
641+
|| (is_countable($this->modelData) && 0 === \count($this->modelData))
642642
// traversables that are not countable
643-
($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
643+
|| ($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
644644
}
645645

646646
public function isValid(): bool

src/Symfony/Component/Form/Guess/Guess.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public static function getBestGuess(array $guesses): ?static
8080
*/
8181
public function __construct(int $confidence)
8282
{
83-
if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
84-
self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
83+
if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence
84+
&& self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
8585
throw new InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
8686
}
8787

src/Symfony/Component/Mailer/Test/Constraint/EmailCount.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ private function countEmails(MessageEvents $events): int
5454
foreach ($events->getEvents($this->transport) as $event) {
5555
if (
5656
($this->queued && $event->isQueued())
57-
||
58-
(!$this->queued && !$event->isQueued())
57+
|| (!$this->queued && !$event->isQueued())
5958
) {
6059
++$count;
6160
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ public function get(): ?array
173173

174174
// Append pessimistic write lock to FROM clause if db platform supports it
175175
$sql = $query->getSQL();
176-
if (($fromPart = $query->getQueryPart('from')) &&
177-
($table = $fromPart[0]['table'] ?? null) &&
178-
($alias = $fromPart[0]['alias'] ?? null)
176+
if (($fromPart = $query->getQueryPart('from'))
177+
&& ($table = $fromPart[0]['table'] ?? null)
178+
&& ($alias = $fromPart[0]['alias'] ?? null)
179179
) {
180180
$fromClause = sprintf('%s %s', $table, $alias);
181181
$sql = str_replace(

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public function get(): ?array
7676
$notification = $wrappedConnection->pgsqlGetNotify(\PDO::FETCH_ASSOC, $this->configuration['get_notify_timeout']);
7777
if (
7878
// no notifications, or for another table or queue
79-
(false === $notification || $notification['message'] !== $this->configuration['table_name'] || $notification['payload'] !== $this->configuration['queue_name']) &&
79+
(false === $notification || $notification['message'] !== $this->configuration['table_name'] || $notification['payload'] !== $this->configuration['queue_name'])
8080
// delayed messages
81-
(microtime(true) * 1000 - $this->queueEmptiedAt < $this->configuration['check_delayed_interval'])
81+
&& (microtime(true) * 1000 - $this->queueEmptiedAt < $this->configuration['check_delayed_interval'])
8282
) {
8383
usleep(1000);
8484

src/Symfony/Component/Mime/Header/AbstractHeader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ private function tokensToString(array $tokens): string
269269
// Build all tokens back into compliant header
270270
foreach ($tokens as $i => $token) {
271271
// Line longer than specified maximum or token was just a new line
272-
if (("\r\n" === $token) ||
273-
($i > 0 && \strlen($currentLine.$token) > $this->lineLength)
272+
if (("\r\n" === $token)
273+
|| ($i > 0 && \strlen($currentLine.$token) > $this->lineLength)
274274
&& '' !== $currentLine) {
275275
$headerLines[] = '';
276276
$currentLine = &$headerLines[$lineCount++];

src/Symfony/Component/Mime/MessageConverter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ private static function createEmailFromAlternativePart(Message $message, Alterna
8080
{
8181
$parts = $part->getParts();
8282
if (
83-
2 === \count($parts) &&
84-
$parts[0] instanceof TextPart && 'text' === $parts[0]->getMediaType() && 'plain' === $parts[0]->getMediaSubtype() &&
85-
$parts[1] instanceof TextPart && 'text' === $parts[1]->getMediaType() && 'html' === $parts[1]->getMediaSubtype()
83+
2 === \count($parts)
84+
&& $parts[0] instanceof TextPart && 'text' === $parts[0]->getMediaType() && 'plain' === $parts[0]->getMediaSubtype()
85+
&& $parts[1] instanceof TextPart && 'text' === $parts[1]->getMediaType() && 'html' === $parts[1]->getMediaSubtype()
8686
) {
8787
return (new Email(clone $message->getHeaders()))
8888
->text($parts[0]->getBody(), $parts[0]->getPreparedHeaders()->getHeaderParameter('Content-Type', 'charset') ?: 'utf-8')

src/Symfony/Component/Notifier/Test/Constraint/NotificationCount.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ private function countNotifications(NotificationEvents $events): int
5757
foreach ($events->getEvents($this->transport) as $event) {
5858
if (
5959
($this->queued && $event->isQueued())
60-
||
61-
(!$this->queued && !$event->isQueued())
60+
|| (!$this->queued && !$event->isQueued())
6261
) {
6362
++$count;
6463
}

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ private function readPropertiesUntil(array $zval, PropertyPathInterface $propert
301301

302302
if ($isIndex) {
303303
// Create missing nested arrays on demand
304-
if (($zval[self::VALUE] instanceof \ArrayAccess && !$zval[self::VALUE]->offsetExists($property)) ||
305-
(\is_array($zval[self::VALUE]) && !isset($zval[self::VALUE][$property]) && !\array_key_exists($property, $zval[self::VALUE]))
304+
if (($zval[self::VALUE] instanceof \ArrayAccess && !$zval[self::VALUE]->offsetExists($property))
305+
|| (\is_array($zval[self::VALUE]) && !isset($zval[self::VALUE][$property]) && !\array_key_exists($property, $zval[self::VALUE]))
306306
) {
307307
if (!$ignoreInvalidIndices) {
308308
if (!\is_array($zval[self::VALUE])) {

src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ private function getDocBlockFromMethod(string $class, string $ucFirstProperty, i
301301
}
302302

303303
if (
304-
(self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) ||
305-
(self::MUTATOR === $type && $reflectionMethod->getNumberOfParameters() >= 1)
304+
(self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters())
305+
|| (self::MUTATOR === $type && $reflectionMethod->getNumberOfParameters() >= 1)
306306
) {
307307
break;
308308
}

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ public function getTypes(string $class, string $property, array $context = []):
144144
}
145145

146146
if (
147-
($context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction) &&
148-
$fromConstructor = $this->extractFromConstructor($class, $property)
147+
($context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction)
148+
&& $fromConstructor = $this->extractFromConstructor($class, $property)
149149
) {
150150
return $fromConstructor;
151151
}

src/Symfony/Component/Security/Http/Firewall/ContextListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ private static function hasUserChanged(UserInterface $originalUser, TokenInterfa
307307
}
308308

309309
if (
310-
\count($userRoles) !== \count($refreshedToken->getRoleNames()) ||
311-
\count($userRoles) !== \count(array_intersect($userRoles, $refreshedToken->getRoleNames()))
310+
\count($userRoles) !== \count($refreshedToken->getRoleNames())
311+
|| \count($userRoles) !== \count(array_intersect($userRoles, $refreshedToken->getRoleNames()))
312312
) {
313313
return true;
314314
}

src/Symfony/Component/Serializer/Encoder/XmlEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ final protected function appendComment(\DOMNode $node, string $data): bool
227227
*/
228228
final protected function isElementNameValid(string $name): bool
229229
{
230-
return $name &&
231-
!str_contains($name, ' ') &&
232-
preg_match('#^[\pL_][\pL0-9._:-]*$#ui', $name);
230+
return $name
231+
&& !str_contains($name, ' ')
232+
&& preg_match('#^[\pL_][\pL0-9._:-]*$#ui', $name);
233233
}
234234

235235
/**

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ protected function getAllowedAttributes(string|object $classOrObject, array $con
236236

237237
// If you update this check, update accordingly the one in Symfony\Component\PropertyInfo\Extractor\SerializerExtractor::getProperties()
238238
if (
239-
!$ignore &&
240-
([] === $groups || array_intersect(array_merge($attributeMetadata->getGroups(), ['*']), $groups)) &&
241-
$this->isAllowedAttribute($classOrObject, $name = $attributeMetadata->getName(), null, $context)
239+
!$ignore
240+
&& ([] === $groups || array_intersect(array_merge($attributeMetadata->getGroups(), ['*']), $groups))
241+
&& $this->isAllowedAttribute($classOrObject, $name = $attributeMetadata->getName(), null, $context)
242242
) {
243243
$allowedAttributes[] = $attributesAsString ? $name : $attributeMetadata;
244244
}

src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,9 @@ private function isMaxDepthReached(array $attributesMetadata, string $class, str
678678
{
679679
$enableMaxDepth = $context[self::ENABLE_MAX_DEPTH] ?? $this->defaultContext[self::ENABLE_MAX_DEPTH] ?? false;
680680
if (
681-
!$enableMaxDepth ||
682-
!isset($attributesMetadata[$attribute]) ||
683-
null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth()
681+
!$enableMaxDepth
682+
|| !isset($attributesMetadata[$attribute])
683+
|| null === $maxDepth = $attributesMetadata[$attribute]->getMaxDepth()
684684
) {
685685
return false;
686686
}

src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ public function normalize(mixed $object, string $format = null, array $context =
7676

7777
$constraint = $violation->getConstraint();
7878
if (
79-
[] !== $payloadFieldsToSerialize &&
80-
$constraint &&
81-
$constraint->payload &&
79+
[] !== $payloadFieldsToSerialize
80+
&& $constraint
81+
&& $constraint->payload
8282
// If some or all payload fields are whitelisted, add them
83-
$payloadFields = null === $payloadFieldsToSerialize || true === $payloadFieldsToSerialize ? $constraint->payload : array_intersect_key($constraint->payload, $payloadFieldsToSerialize)
83+
&& $payloadFields = null === $payloadFieldsToSerialize || true === $payloadFieldsToSerialize ? $constraint->payload : array_intersect_key($constraint->payload, $payloadFieldsToSerialize)
8484
) {
8585
$violationEntry['payload'] = $payloadFields;
8686
}

src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ protected function extractAttributes(object $object, string $format = null, arra
7777

7878
foreach ($reflClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflMethod) {
7979
if (
80-
0 !== $reflMethod->getNumberOfRequiredParameters() ||
81-
$reflMethod->isStatic() ||
82-
$reflMethod->isConstructor() ||
83-
$reflMethod->isDestructor()
80+
0 !== $reflMethod->getNumberOfRequiredParameters()
81+
|| $reflMethod->isStatic()
82+
|| $reflMethod->isConstructor()
83+
|| $reflMethod->isDestructor()
8484
) {
8585
continue;
8686
}

src/Symfony/Component/Validator/Constraints/TimezoneValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public function validate(mixed $value, Constraint $constraint)
5555
}
5656

5757
if (
58-
\in_array($value, self::getPhpTimezones($constraint->zone, $constraint->countryCode), true) ||
59-
\in_array($value, self::getIntlTimezones($constraint->zone, $constraint->countryCode), true)
58+
\in_array($value, self::getPhpTimezones($constraint->zone, $constraint->countryCode), true)
59+
|| \in_array($value, self::getIntlTimezones($constraint->zone, $constraint->countryCode), true)
6060
) {
6161
return;
6262
}

src/Symfony/Component/Yaml/Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,8 @@ private function parseBlockScalar(string $style, string $chomping = '', int $ind
844844

845845
while (
846846
$notEOF && (
847-
$isCurrentLineBlank ||
848-
self::preg_match($pattern, $this->currentLine, $matches)
847+
$isCurrentLineBlank
848+
|| self::preg_match($pattern, $this->currentLine, $matches)
849849
)
850850
) {
851851
if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) {

0 commit comments

Comments
 (0)
0