Skip to content

Commit 8b3ee1c

Browse files
alexandre-dauboisnicolas-grekas
authored andcommitted
[Cache][Config][Console][DependencyInjection][FrameworkBundle] Remove dead code and useless casts
1 parent 2d8cffd commit 8b3ee1c

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

Command/CompleteCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9898
'',
9999
'<comment>'.date('Y-m-d H:i:s').'</>',
100100
'<info>Input:</> <comment>("|" indicates the cursor position)</>',
101-
' '.(string) $completionInput,
101+
' '.$completionInput,
102102
'<info>Command:</>',
103-
' '.(string) implode(' ', $_SERVER['argv']),
103+
' '.implode(' ', $_SERVER['argv']),
104104
'<info>Messages:</>',
105105
]);
106106

107-
$command = $this->findCommand($completionInput, $output);
107+
$command = $this->findCommand($completionInput);
108108
if (null === $command) {
109109
$this->log(' No command found, completing using the Application class.');
110110

@@ -185,7 +185,7 @@ private function createCompletionInput(InputInterface $input): CompletionInput
185185
return $completionInput;
186186
}
187187

188-
private function findCommand(CompletionInput $completionInput, OutputInterface $output): ?Command
188+
private function findCommand(CompletionInput $completionInput): ?Command
189189
{
190190
try {
191191
$inputName = $completionInput->getFirstArgument();

Descriptor/ReStructuredTextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function describeInputOption(InputOption $option, array $options = [])
9292
protected function describeInputDefinition(InputDefinition $definition, array $options = []): void
9393
{
9494
if ($showArguments = ((bool) $definition->getArguments())) {
95-
$this->write("Arguments\n".str_repeat($this->subsubsectionChar, 9))."\n\n";
95+
$this->write("Arguments\n".str_repeat($this->subsubsectionChar, 9));
9696
foreach ($definition->getArguments() as $argument) {
9797
$this->write("\n\n");
9898
$this->describeInputArgument($argument);

Descriptor/XmlDescriptor.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,9 @@ private function getInputOptionDocument(InputOption $option): \DOMDocument
208208
$defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
209209
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
210210

211-
if ($defaults) {
212-
foreach ($defaults as $default) {
213-
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
214-
$defaultXML->appendChild($dom->createTextNode($default));
215-
}
211+
foreach ($defaults as $default) {
212+
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
213+
$defaultXML->appendChild($dom->createTextNode($default));
216214
}
217215
}
218216

Output/AnsiColorMode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function convertFromHexToAnsiColorCode(string $hexColor): string
6262

6363
return match ($this) {
6464
self::Ansi4 => (string) $this->convertFromRGB($r, $g, $b),
65-
self::Ansi8 => '8;5;'.((string) $this->convertFromRGB($r, $g, $b)),
65+
self::Ansi8 => '8;5;'.$this->convertFromRGB($r, $g, $b),
6666
self::Ansi24 => \sprintf('8;2;%d;%d;%d', $r, $g, $b),
6767
};
6868
}

Output/TrimmedBufferOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ protected function doWrite(string $message, bool $newline): void
5353
$this->buffer .= \PHP_EOL;
5454
}
5555

56-
$this->buffer = substr($this->buffer, 0 - $this->maxLength);
56+
$this->buffer = substr($this->buffer, -$this->maxLength);
5757
}
5858
}

0 commit comments

Comments
 (0)