Skip to content

Commit f23b9c8

Browse files
committed
bug #43947 [HttpKernel] Make sure FileLinkFormatter can be serialized (derrabus)
This PR was merged into the 6.0 branch. Discussion ---------- [HttpKernel] Make sure FileLinkFormatter can be serialized | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A We currently get a `TypeError` when serializing a `FileLinkFormatter`. This PR should help. Commits ------- 8a9b3c7db7 Make sure FileLinkFormatter can be serialized
2 parents 563aab5 + d2f0eb5 commit f23b9c8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Debug/FileLinkFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function generateUrlFormat(UrlGeneratorInterface $router, string $
9494
}
9595
}
9696

97-
private function getFileLinkFormat()
97+
private function getFileLinkFormat(): array|false
9898
{
9999
if ($this->fileLinkFormat) {
100100
return $this->fileLinkFormat;
@@ -111,6 +111,6 @@ private function getFileLinkFormat()
111111
}
112112
}
113113

114-
return null;
114+
return false;
115115
}
116116
}

Tests/Debug/FileLinkFormatterTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@ public function testIdeFileLinkFormat()
6060

6161
$this->assertSame("atom://core/open/file?filename=$file&line=3", $sut->format($file, 3));
6262
}
63+
64+
public function testSerialize()
65+
{
66+
$this->assertInstanceOf(FileLinkFormatter::class, unserialize(serialize(new FileLinkFormatter())));
67+
}
6368
}

0 commit comments

Comments
 (0)