8000 Merge branch '4.4' into 5.4 · symfony/symfony@614a575 · GitHub
[go: up one dir, main page]

Skip to content

Commit 614a575

Browse files
Merge branch '4.4' into 5.4
* 4.4: [DowCrawler] Fix locale-sensitivity of whitespace normalization suggest to install the Twig bundle when the required component is already installed Update PULL_REQUEST_TEMPLATE.md
2 parents 12ea6e2 + fcd9c2d commit 614a575

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ This will help reviewers and should be a good start for the documentation.
1414
Additionally (see https://symfony.com/releases):
1515
- Always add tests and ensure they pass.
1616
- Bug fixes must be submitted against the lowest maintained branch where they apply
17-
(lowest branches are regularly merged to upper ones so they get the fixes too.)
17+
(lowest branches are regularly merged to upper ones so they get the fixes too).
1818
- Features and deprecations must be submitted against the latest branch.
19+
- For new features, provide some code snippets to help understand usage.
1920
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
2021
- Never break backward compatibility (see https://symfony.com/bc).
2122
-->

src/Symfony/Bridge/Twig/UndefinedCallableHandler.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig;
1313

14+
use Composer\InstalledVersions;
1415
use Symfony\Bundle\FullStack;
1516
use Twig\Error\SyntaxError;
1617
use Twig\TwigFilter;
@@ -102,6 +103,12 @@ private static function onUndefined(string $name, string $type, string $componen
102103
return sprintf('Did you forget to %s? Unknown %s "%s".', self::FULL_STACK_ENABLE[$component], $type, $name);
103104
}
104105

105-
return sprintf('Did you forget to run "composer require symfony/%s"? Unknown %s "%s".', $component, $type, $name);
106+
$missingPackage = 'symfony/'.$component;
107+
108+
if (class_exists(InstalledVersions::class) && InstalledVersions::isInstalled($missingPackage)) {
109+
$missingPackage = 'symfony/twig-bundle';
110+
}
111+
112+
return sprintf('Did you forget to run "composer require %s"? Unknown %s "%s".', $missingPackage, $type, $name);
106113
}
107114
}

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ public function text(string $default = null, bool $normalizeWhitespace = true)
623623
$text = $this->getNode(0)->nodeValue;
624624

625625
if ($normalizeWhitespace) {
626-
return trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $text));
626+
return trim(preg_replace("/(?:[ \n\r\t\x0C]{2,}+|[\n\r\t\x0C])/", ' ', $text), " \n\r\t\x0C");
627627
}
628628

629629
return $text;

src/Symfony/Component/String/AbstractString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ abstract public function chunk(int $length = 1): array;
245245
public function collapseWhitespace(): self
246246
{
247247
$str = clone $this;
248-
$str->string = trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $str->string));
248+
$str->string = trim(preg_replace("/(?:[ \n\r\t\x0C]{2,}+|[\n\r\t\x0C])/", ' ', $str->string), " \n\r\t\x0C");
249249

250250
return $str;
251251
}

0 commit comments

Comments
 (0)
0