Skip to content

Commit ffbb988

Browse files
Merge branch '5.1' into 5.x
* 5.1: [Contracts] add branch-aliases for dev-main [Cache] Make Redis initializers static [Messenger] Fixed typos in Connection [CI] Fixed build on AppVeyor Fix tests typo [Lock] Reset Key lifetime time before we acquire it [CI] Silence errors when remove file/dir on test tearDown() Fix tests Remove content-type check on toArray methods
2 parents 8553361 + 3e587d7 commit ffbb988

File tree

43 files changed

+211
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+211
-128
lines changed

src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected function tearDown(): void
142142
{
143143
foreach ($this->files as $file) {
144144
if (file_exists($file)) {
145-
unlink($file);
145+
@unlink($file);
146146
}
147147
}
148148
}

src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ protected function tearDown(): void
121121
{
122122
foreach ($this->files as $file) {
123123
if (file_exists($file)) {
124-
unlink($file);
124+
@unlink($file);
125125
}
126126
}
127-
rmdir(sys_get_temp_dir().'/xliff-lint-test');
127+
@rmdir(sys_get_temp_dir().'/xliff-lint-test');
128128
}
129129
}

src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ protected function tearDown(): void
168168
{
169169
foreach ($this->files as $file) {
170170
if (file_exists($file)) {
171-
unlink($file);
171+
@unlink($file);
172172
}
173173
}
174-
rmdir(sys_get_temp_dir().'/yml-lint-test');
174+
@rmdir(sys_get_temp_dir().'/yml-lint-test');
175175
}
176176
}

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public static function createConnection($dsn, array $options = [])
175175
$connect = $params['persistent'] || $params['persistent_id'] ? 'pconnect' : 'connect';
176176
$redis = new $class();
177177

178-
$initializer = function ($redis) use ($connect, $params, $dsn, $auth, $hosts) {
178+
$initializer = static function ($redis) use ($connect, $params, $dsn, $auth, $hosts) {
179179
try {
180180
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
181181

@@ -227,7 +227,7 @@ public static function createConnection($dsn, array $options = [])
227227
$redis->setOption(\Redis::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']);
228228
}
229229
} elseif (is_a($class, \RedisCluster::class, true)) {
230-
$initializer = function () use ($class, $params, $dsn, $hosts) {
230+
$initializer = static function () use ($class, $params, $dsn, $hosts) {
231231
foreach ($hosts as $i => $host) {
232232
$hosts[$i] = 'tcp' === $host['scheme'] ? $host['host'].':'.$host['port'] : $host['path'];
233233
}

src/Symfony/Component/Config/Tests/ConfigCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function tearDown(): void
3030

3131
foreach ($files as $file) {
3232
if (file_exists($file)) {
33-
unlink($file);
33+
@unlink($file);
3434
}
3535
}
3636
}

src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function setUp(): void
3030
protected function tearDown(): void
3131
{
3232
if (file_exists($this->file)) {
33-
unlink($this->file);
33+
@unlink($this->file);
3434
}
3535
}
3636

src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ protected function setUp(): void
3030

3131
protected function tearDown(): void
3232
{
33-
if (!file_exists($this->file)) {
34-
return;
33+
if (file_exists($this->file)) {
34+
@unlink($this->file);
3535
}
36-
37-
unlink($this->file);
3836
}
3937

4038
public function testGetResource()

src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function tearDown(): void
3131

3232
foreach ($files as $file) {
3333
if (file_exists($file)) {
34-
unlink($file);
34+
@unlink($file);
3535
}
3636
}
3737
}

src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ public function toArray(bool $throw = true): array
8888
return $this->jsonData;
8989
}
9090

91-
$contentType = $this->headers['content-type'][0] ?? 'application/json';
92-
93-
if (!preg_match('/\bjson\b/i', $contentType)) {
94-
throw new JsonException(sprintf('Response content-type is "%s" while a JSON-compatible one was expected for "%s".', $contentType, $this->getInfo('url')));
95-
}
96-
9791
try {
9892
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
9993
} catch (\JsonException $e) {

src/Symfony/Component/HttpClient/Tests/Response/MockResponseTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ public function toArrayErrors()
5454
'message' => 'Response body is empty.',
5555
];
5656

57-
yield [
58-
'content' => '{}',
59-
'responseHeaders' => ['content-type' => 'plain/text'],
60-
'message' => 'Response content-type is "plain/text" while a JSON-compatible one was expected for "https://example.com/file.json".',
61-
];
62-
6357
yield [
6458
'content' => 'not json',
6559
'responseHeaders' => [],

0 commit comments

Comments
 (0)