Skip to content

Commit 32ff2cd

Browse files
Merge branch '6.3' into 6.4
* 6.3: [Config] Prefixing FileExistenceResource::__toString() to avoid conflict with FileResource [String] Method toByteString conversion using iconv is unreachable Accept mixed key on DsPairStub [HttpKernel] Fix PHP deprecation
2 parents f04ea7c + 54398ed commit 32ff2cd

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

src/Symfony/Component/Config/Resource/FileExistenceResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(string $resource)
3838

3939
public function __toString(): string
4040
{
41-
return $this->resource;
41+
return 'existence.'.$this->resource;
4242
}
4343

4444
public function getResource(): string

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

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

3737
public function testToString()
3838
{
39-
$this->assertSame($this->file, (string) $this->resource);
39+
$this->assertSame('existence.'.$this->file, (string) $this->resource);
4040
}
4141

4242
public function testGetResource()

src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function getContainerDeprecationLogs(): array
201201

202202
private function getContainerCompilerLogs(string $compilerLogsFilepath = null): array
203203
{
204-
if (!is_file($compilerLogsFilepath)) {
204+
if (!$compilerLogsFilepath || !is_file($compilerLogsFilepath)) {
205205
return [];
206206
}
207207

src/Symfony/Component/String/AbstractString.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,11 @@ public function toByteString(string $toEncoding = null): ByteString
512512
try {
513513
try {
514514
$b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8');
515-
} catch (InvalidArgumentException $e) {
515+
} catch (InvalidArgumentException|\ValueError $e) {
516516
if (!\function_exists('iconv')) {
517+
if ($e instanceof \ValueError) {
518+
throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
519+
}
517520
throw $e;
518521
}
519522

src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,4 +1581,22 @@ public static function provideWidth(): array
15811581
[17, "\u{007f}\u{007f}f\u{001b}[0moo\u{0001}bar\u{007f}cccïf\u{008e}cy\u{0005}1", false], // f[0moobarcccïfcy1
15821582
];
15831583
}
1584+
1585+
/**
1586+
* @dataProvider provideToByteString
1587+
*/
1588+
public function testToByteString(string $origin, string $encoding)
1589+
{
1590+
$instance = static::createFromString($origin)->toByteString($encoding);
1591+
$this->assertInstanceOf(ByteString::class, $instance);
1592+
}
1593+
1594+
public static function provideToByteString(): array
1595+
{
1596+
return [
1597+
['žsžsý', 'UTF-8'],
1598+
['žsžsý', 'windows-1250'],
1599+
['žsžsý', 'Windows-1252'],
1600+
];
1601+
}
15841602
}

src/Symfony/Component/VarDumper/Caster/DsPairStub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class DsPairStub extends Stub
2020
{
21-
public function __construct(string|int $key, mixed $value)
21+
public function __construct(mixed $key, mixed $value)
2222
{
2323
$this->value = [
2424
Caster::PREFIX_VIRTUAL.'key' => $key,

0 commit comments

Comments
 (0)