Skip to content

Commit d9e51a8

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: CS: Apply ternary_to_null_coalescing fixer
2 parents a009e6e + e6e9189 commit d9e51a8

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Caster/ExceptionCaster.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, boo
138138

139139
$frame = new FrameStub(
140140
[
141-
'object' => isset($f['object']) ? $f['object'] : null,
142-
'class' => isset($f['class']) ? $f['class'] : null,
143-
'type' => isset($f['type']) ? $f['type'] : null,
144-
'function' => isset($f['function']) ? $f['function'] : null,
141+
'object' => $f['object'] ?? null,
142+
'class' => $f['class'] ?? null,
143+
'type' => $f['type'] ?? null,
144+
'function' => $f['function'] ?? null,
145145
] + $frames[$i - 1],
146146
false,
147147
true
@@ -160,7 +160,7 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, boo
160160
}
161161
$f = $frames[$i - 1];
162162
if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
163-
$frame->value['arguments'] = new ArgsStub($f['args'], isset($f['function']) ? $f['function'] : null, isset($f['class']) ? $f['class'] : null);
163+
$frame->value['arguments'] = new ArgsStub($f['args'], $f['function'] ?? null, $f['class'] ?? null);
164164
}
165165
} elseif ('???' !== $lastCall) {
166166
$label = new ClassStub($lastCall);
@@ -209,12 +209,12 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, boo
209209
$srcKey = $f['file'];
210210
$ellipsis = new LinkStub($srcKey, 0);
211211
$srcAttr = 'collapse='.(int) $ellipsis->inVendor;
212-
$ellipsisTail = isset($ellipsis->attr['ellipsis-tail']) ? $ellipsis->attr['ellipsis-tail'] : 0;
213-
$ellipsis = isset($ellipsis->attr['ellipsis']) ? $ellipsis->attr['ellipsis'] : 0;
212+
$ellipsisTail = $ellipsis->attr['ellipsis-tail'] ?? 0;
213+
$ellipsis = $ellipsis->attr['ellipsis'] ?? 0;
214214

215215
if (is_file($f['file']) && 0 <= self::$srcContext) {
216216
if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
217-
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
217+
$template = $f['object'] ?? unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
218218

219219
$ellipsis = 0;
220220
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
@@ -312,7 +312,7 @@ private static function extractSource(string $srcLines, int $line, int $srcConte
312312
$src = [];
313313

314314
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
315-
$src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
315+
$src[] = ($srcLines[$i] ?? '')."\n";
316316
}
317317

318318
if ($frame['function'] ?? false) {

Caster/ReflectionCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a
124124
}
125125
$function = $c->getFunction();
126126
$frame = [
127-
'class' => isset($function->class) ? $function->class : null,
127+
'class' => $function->class ?? null,
128128
'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
129129
'function' => $function->name,
130130
'file' => $c->getExecutingFile(),

Dumper/CliDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ protected function dumpKey(Cursor $cursor)
405405
}
406406
}
407407

408-
$this->line .= $bin.$this->style($style, $key[1], $attr).(isset($attr['separator']) ? $attr['separator'] : ': ');
408+
$this->line .= $bin.$this->style($style, $key[1], $attr).($attr['separator'] ?? ': ');
409409
} else {
410410
// This case should not happen
411411
$this->line .= '-'.$bin.'"'.$this->style('private', $key, ['class' => '']).'": ';
@@ -463,7 +463,7 @@ protected function style($style, $value, $attr = [])
463463
$s = $startCchr;
464464
$c = $c[$i = 0];
465465
do {
466-
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
466+
$s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
467467
} while (isset($c[++$i]));
468468

469469
return $s.$endCchr;
@@ -484,7 +484,7 @@ protected function style($style, $value, $attr = [])
484484

485485
href:
486486
if ($this->colors && $this->handlesHrefGracefully) {
487-
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
487+
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {
488488
if ('note' === $style) {
489489
$value .= "\033]8;;{$href}\033\\^\033]8;;\033\\";
490490
} else {

Dumper/HtmlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,13 +923,13 @@ protected function style($style, $value, $attr = [])
923923
$s .= '">';
924924
}
925925

926-
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
926+
$s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
927927
} while (isset($c[++$i]));
928928

929929
return $s.'</span>';
930930
}, $v).'</span>';
931931

932-
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
932+
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {
933933
$attr['href'] = $href;
934934
}
935935
if (isset($attr['href'])) {

0 commit comments

Comments
 (0)