Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21bf85f

Browse files
minor #41157 [Console] Fixes for PHP 8.1 deprecations (jrmajor)
This PR was merged into the 4.4 branch. Discussion ---------- [Console] Fixes for PHP 8.1 deprecations | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Fixes passing `null` to non-nullable arguments. Commits ------- 545f058 [Console] Fixes for PHP 8.1 deprecations
2 parents 132e09f + 545f058 commit 21bf85f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o
117117

118118
$this->writeText('<comment>Options:</comment>', $options);
119119
foreach ($definition->getOptions() as $option) {
120-
if (\strlen($option->getShortcut()) > 1) {
120+
if (\strlen($option->getShortcut() ?? '') > 1) {
121121
$laterOptions[] = $option;
122122
continue;
123123
}

src/Symfony/Component/Console/Descriptor/XmlDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function getInputOptionDocument(InputOption $option): \DOMDocument
201201

202202
$dom->appendChild($objectXML = $dom->createElement('option'));
203203
$objectXML->setAttribute('name', '--'.$option->getName());
204-
$pos = strpos($option->getShortcut(), '|');
204+
$pos = strpos($option->getShortcut() ?? '', '|');
205205
if (false !== $pos) {
206206
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
207207
$objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));

src/Symfony/Component/Console/Helper/ProgressIndicator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function display()
197197
}
198198

199199
return $matches[0];
200-
}, $this->format));
200+
}, $this->format ?? ''));
201201
}
202202

203203
private function determineBestFormat(): string

src/Symfony/Component/Console/Helper/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ private function buildTableRows(array $rows): TableRows
561561
if (isset($this->columnMaxWidths[$column]) && Helper::strlenWithoutDecoration($formatter, $cell) > $this->columnMaxWidths[$column]) {
562562
$cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
563563
}
564-
if (!strstr($cell, "\n")) {
564+
if (!strstr($cell ?? '', "\n")) {
565565
continue;
566566
}
567567
$escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));

0 commit comments

Comments
 (0)