8000 Merge branch '6.4' into 7.0 · hhamon/symfony@d6a1532 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6a1532

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [VarDumper] Fix managing collapse state in CliDumper [AssetMapper] Improve the error message when a downloaded file is missing [HtmlSanitizer] Allow league/uri v7
2 parents 8105a09 + af24405 commit d6a1532

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
"egulias/email-validator": "^2.1.10|^3.1|^4",
135135
"guzzlehttp/promises": "^1.4",
136136
"league/html-to-markdown": "^5.0",
137+
"league/uri": "^6.5|^7.0",
137138
"masterminds/html5": "^2.7.2",
138139
"monolog/monolog": "^3.0",
139140
"nyholm/psr7": "^1.0",

src/Symfony/Component/AssetMapper/ImportMap/ImportMapManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ private function convertEntriesToImports(array $entries): array
411411

412412
if (null !== $entryOptions->path) {
413413
if (!$asset = $this->assetMapper->getAsset($entryOptions->path)) {
414+
if ($entryOptions->isDownloaded) {
415+
throw new \InvalidArgumentException(sprintf('The "%s" downloaded asset is missing. Run "php bin/console importmap:require "%s" --download".', $entryOptions->path, $entryOptions->importName));
416+
}
417+
414418
throw new \InvalidArgumentException(sprintf('The asset "%s" mentioned in "%s" cannot be found in any asset map paths.', $entryOptions->path, basename($this->importMapConfigPath)));
415419
}
416420
$path = $asset->publicPath;

src/Symfony/Component/HtmlSanitizer/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=8.2",
2020
"ext-dom": "*",
21-
"league/uri": "^6.5",
21+
"league/uri": "^6.5|^7.0",
2222
"masterminds/html5": "^2.7.2"
2323
},
2424
"autoload": {

src/Symfony/Component/VarDumper/Dumper/CliDumper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function setDisplayOptions(array $displayOptions): void
124124
public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value): void
125125
{
126126
$this->dumpKey($cursor);
127+
$this->collapseNextHash = $this->expandNextHash = false;
127128

128129
$style = 'const';
129130
$attr = $cursor->attr;
@@ -184,6 +185,7 @@ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|n
184185
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut): void
185186
{
186187
$this->dumpKey($cursor);
188+
$this->collapseNextHash = $this->expandN 8000 extHash = false;
187189
$attr = $cursor->attr;
188190

189191
if ($bin) {
@@ -274,6 +276,7 @@ public function enterHash(Cursor $cursor, int $type, string|int|null $class, boo
274276
$this->colors ??= $this->supportsColors();
275277

276278
$this->dumpKey($cursor);
279+
$this->expandNextHash = false;
277280
$attr = $cursor->attr;
278281

279282
if ($this->collapseNextHash) {

src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\VarDumper\Caster\CutStub;
16+
use Symfony\Component\VarDumper\Cloner\Data;
17+
use Symfony\Component\VarDumper\Cloner\Stub;
1618
use Symfony\Component\VarDumper\Cloner\VarCloner;
1719
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
1820
use Symfony\Component\VarDumper\Dumper\CliDumper;
@@ -455,4 +457,42 @@ public function testDumpArrayWithColor($value, $flags, $expectedOut)
455457

456458
$this->assertSame($expectedOut, $out);
457459
}
460+
461+
public function testCollapse()
462+
{
463+
$stub = new Stub();
464+
$stub->type = Stub::TYPE_OBJECT;
465+
$stub->class = 'stdClass';
466+
$stub->position = 1;
467+
468+
$data = new Data([
469+
[
470+
$stub,
471+
],
472+
[
473+
"\0~collapse=1\0foo" => 123,
474+
"\0+\0bar" => [1 => 2],
475+
],
476+
[
477+
'bar' => 123,
478+
]
479+
]);
480+
481+
$dumper = new CliDumper();
482+
$dump = $dumper->dump($data, true);
483+
484+
$this->assertSame(
485+
<<<'EOTXT'
486+
{
487+
foo: 123
488+
+"bar": array:1 [
489+
"bar" => 123
490+
]
491+
}
492+
493+
EOTXT
494+
,
495+
$dump
496+
);
497+
}
458498
}

0 commit comments

Comments
 (0)
0