Skip to content

Commit

Permalink
[Console] Fixes for PHP 8.1 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed May 10, 2021
1 parent 36bbd07 commit 1ab187a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Descriptor/TextDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o

$this->writeText('<comment>Options:</comment>', $options);
foreach ($definition->getOptions() as $option) {
if (\strlen($option->getShortcut()) > 1) {
if (\strlen($option->getShortcut() ?? '') > 1) {
$laterOptions[] = $option;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Descriptor/XmlDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private function getInputOptionDocument(InputOption $option): \DOMDocument

$dom->appendChild($objectXML = $dom->createElement('option'));
$objectXML->setAttribute('name', '--'.$option->getName());
$pos = strpos($option->getShortcut(), '|');
$pos = strpos($option->getShortcut() ?? '', '|');
if (false !== $pos) {
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
$objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
Expand Down
2 changes: 1 addition & 1 deletion Helper/ProgressIndicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private function display()
}

return $matches[0];
}, $this->format));
}, $this->format ?? ''));
}

private function determineBestFormat(): string
Expand Down
2 changes: 1 addition & 1 deletion Helper/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ private function buildTableRows(array $rows): TableRows
if (isset($this->columnMaxWidths[$column]) && Helper::strlenWithoutDecoration($formatter, $cell) > $this->columnMaxWidths[$column]) {
$cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
}
if (!strstr($cell, "\n")) {
if (!strstr($cell ?? '', "\n")) {
continue;
}
$escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
Expand Down

0 comments on commit 1ab187a

Please sign in to comment.