8000 minor #49241 Misc code improvements and optimizations (javiereguiluz) · symfony/symfony@c05bd6c · GitHub
[go: up one dir, main page]

Skip to content

Commit c05bd6c

Browse files
committed
minor #49241 Misc code improvements and optimizations (javiereguiluz)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- Misc code improvements and optimizations | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Made with PhpStorm and reviewed manually. Commits ------- ee5ccef Misc code improvements and optimizations
2 parents bc55b03 + ee5ccef commit c05bd6c

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/Comm 8000 and/TranslationUpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
145145
$format = $input->getOption('format');
146146
$xliffVersion = '1.2';
147147

148-
if (\in_array($format, array_keys(self::FORMATS), true)) {
148+
if (array_key_exists($format, self::FORMATS)) {
149149
[$format, $xliffVersion] = self::FORMATS[$format];
150150
}
151151

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ private function validateAlias(\DOMElement $alias, string $file)
737737
if (!$child instanceof \DOMElement || self::NS !== $child->namespaceURI) {
738738
continue;
739739
}
740-
if (!\in_array($child->localName, ['deprecated'], true)) {
740+
if ('deprecated' !== $child->localName) {
741741
throw new InvalidArgumentException(sprintf('Invalid child element "%s" defined for alias "%s" in "%s".', $child->localName, $alias->getAttribute('id'), $file));
742742
}
743743
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(
6666
) {
6767
$this->version = $version ?? $options['version'] ?? $this->version;
6868

69-
if (!\in_array($this->version, array_keys(self::NET_MAXES))) {
69+
if (!array_key_exists($this->version, self::NET_MAXES)) {
7070
throw new ConstraintDefinitionException(sprintf('The option "version" must be one of "%s".', implode('", "', array_keys(self::NET_MAXES))));
7171
}
7272

src/Symfony/Component/Yaml/Dumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private function dumpTaggedValue(TaggedValue $value, int $inline, int $indent, i
146146
{
147147
$output = sprintf('%s!%s', $prefix ? $prefix.' ' : '', $value->getTag());
148148

149-
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
149+
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) {
150150
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
151151
// http://www.yaml.org/spec/1.2/spec.html#id2793979
152152
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';

0 commit comments

Comments
 (0)
0