8000 minor #49897 Apply operator_linebreak PHP-CS-Fixer rule (yguedidi) · umpirsky/symfony@0133c0e · GitHub
[go: up one dir, main page]

Skip to content

Commit 0133c0e

Browse files
minor symfony#49897 Apply operator_linebreak PHP-CS-Fixer rule (yguedidi)
This PR was merged into the 6.3 branch. Discussion ---------- Apply operator_linebreak PHP-CS-Fixer rule | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | After a discussion with `@stof`, this rule should be part of the ``@Symfony`` PHP-CS-Fixer ruleset. This PR apply the rule on the Symfony code base. see PHP-CS-Fixer/PHP-CS-Fixer#6877 for the PR on PHP-CS-Fixer Commits ------- 6edc748 Apply operator_linebreak PHP-CS-Fixer rule
2 parents afe4894 + 6edc748 commit 0133c0e

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(

0 commit comments

Comments
 (0)
0