Skip to content

Commit 21f327f

Browse files
Reduce common control flows
1 parent 943fe90 commit 21f327f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

DataCollector/DumpDataCollector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
121121
) {
122122
if ($response->headers->has('Content-Type') && str_contains($response->headers->get('Content-Type') ?? '', 'html')) {
123123
$dumper = new HtmlDumper('php://output', $this->charset);
124-
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
125124
} else {
126125
$dumper = new CliDumper('php://output', $this->charset);
127-
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
128126
}
129127

128+
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
129+
130130
foreach ($this->data as $dump) {
131131
$this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line'], $dump['label'] ?? '');
132132
}
@@ -235,12 +235,12 @@ public function __destruct()
235235

236236
if ($this->webMode) {
237237
$dumper = new HtmlDumper('php://output', $this->charset);
238-
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
239238
} else {
240239
$dumper = new CliDumper('php://output', $this->charset);
241-
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
242240
}
243241

242+
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
243+
244244
foreach ($this->data as $i => $dump) {
245245
$this->data[$i] = null;
246246
$this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line'], $dump['label'] ?? '');

Tests/Log/LoggerTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ public function testContextReplacement()
129129

130130
public function testObjectCastToString()
131131
{
132-
if (method_exists($this, 'createPartialMock')) {
133-
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
134-
} else {
135-
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
136-
}
132+
$dummy = $this->createPartialMock(DummyTest::class, ['__toString']);
137133
$dummy->expects($this->atLeastOnce())
138134
->method('__toString')
139135
->willReturn('DUMMY');

0 commit comments

Comments
 (0)