Skip to content

Commit 7bc268e

Browse files
committed
Merge branch '3.2'
* 3.2: use HHVM 3.15 to run tests [TwigBridge] fix Twig 2.x compatibility removed some PHP CS Fixer rules Improve language [Console] SymfonyStyle: Escape trailing backslashes in user texts Mention the community review guide [Form] fix group sequence based validation [Console] Fix question formatting using SymfonyStyle::ask()
2 parents 5c5c911 + a3788e7 commit 7bc268e

File tree

16 files changed

+133
-45
lines changed

16 files changed

+133
-45
lines changed

.php_cs.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ return PhpCsFixer\Config::create()
55
'@Symfony' => true,
66
'@Symfony:risky' => true,
77
'array_syntax' => array('syntax' => 'long'),
8+
'no_unreachable_default_argument_value' => false,
9+
'heredoc_to_nowdoc' => false,
810
))
911
->setRiskyAllowed(true)
1012
->setFinder(

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env:
2020
matrix:
2121
include:
2222
# Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
23-
- php: hhvm-stable
23+
- php: hhvm-3.15
2424
sudo: required
2525
dist: trusty
2626
group: edge

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Symfony is an open source, community-driven project.
55

66
If you'd like to contribute, please read the following documents:
77

8+
* [Reviewing issues/pull requests][0]
89
* [Reporting a Bug][1]
910
* [Submitting a Patch][2]
1011
* [Symfony Core Team][3]
@@ -14,6 +15,7 @@ If you'd like to contribute, please read the following documents:
1415
* [Coding Standards][7]
1516
* [Conventions][8]
1617

18+
[0]: https://symfony.com/doc/current/contributing/community/reviews.html
1719
[1]: https://symfony.com/doc/current/contributing/code/bugs.html
1820
[2]: https://symfony.com/doc/current/contributing/code/patches.html
1921
[3]: https://symfony.com/doc/current/contributing/code/core_team.html

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ please read the [Contributing Code][3] part of the documentation. If you're subm
3333
a pull request, please follow the guidelines in the [Submitting a Patch][4] section
3434
and use [Pull Request Template][5].
3535

36+
Community Reviews
37+
-----------------
38+
39+
If you don't feel ready to contribute code or patches, reviewing issues and pull
40+
requests can be a great start to get involved and give back. In fact, people who
41+
"triage" issues are the backbone to Symfony's success!
42+
More information can be found in the [Community Reviews][8] guide.
43+
3644
Running Symfony Tests
3745
----------------------
3846

@@ -46,3 +54,4 @@ Information on how to run the Symfony test suite can be found in the
4654
[5]: https://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request
4755
[6]: https://symfony.com/doc/master/contributing/code/tests.html
4856
[7]: https://symfony.com/doc/current/book/installation.html#installing-the-symfony-installer
57+
[8]: https://symfony.com/doc/current/contributing/community/reviews.html

src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function getVariableGetterWithoutStrictCheck($name)
4949
protected function getVariableGetterWithStrictCheck($name)
5050
{
5151
if (\Twig_Environment::MAJOR_VERSION >= 2) {
52-
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : $this->notFound("%s", 0))', $name, $name, $name, $name);
52+
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name);
5353
}
5454

5555
if (PHP_VERSION_ID >= 70000) {

src/Symfony/Component/Console/Formatter/OutputFormatter.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ public static function escape($text)
3535
{
3636
$text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
3737

38+
return self::escapeTrailingBackslash($text);
39+
}
40+
41+
/**
42+
* Escapes trailing "\" in given text.
43+
*
44+
* @param string $text Text to escape
45+
*
46+
* @return string Escaped text
47+
*
48+
* @internal
49+
*/
50+
public static function escapeTrailingBackslash($text)
51+
{
3852
if ('\\' === substr($text, -1)) {
3953
$len = strlen($text);
4054
$text = rtrim($text, '\\');

src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu
5454
*/
5555
protected function writePrompt(OutputInterface $output, Question $question)
5656
{
57-
$text = OutputFormatter::escape($question->getQuestion());
57+
$text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
5858
$default = $question->getDefault();
5959

6060
switch (true) {

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function title($message)
8080
{
8181
$this->autoPrependBlock();
8282
$this->writeln(array(
83-
sprintf('<comment>%s</>', $message),
83+
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
8484
sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
8585
));
8686
$this->newLine();
@@ -93,7 +93,7 @@ public function section($message)
9393
{
9494
$this->autoPrependBlock();
9595
$this->writeln(array(
96-
sprintf('<comment>%s</>', $message),
96+
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
9797
sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
9898
));
9999
$this->newLine();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
use Symfony\Component\Console\Input\InputInterface;
4+
use Symfony\Component\Console\Output\OutputInterface;
5+
use Symfony\Component\Console\Style\SymfonyStyle;
6+
7+
//Ensure symfony style helper methods handle trailing backslashes properly when decorating user texts
8+
return function (InputInterface $input, OutputInterface $output) {
9+
$output = new SymfonyStyle($input, $output);
10+
11+
$output->title('Title ending with \\');
12+
$output->section('Section ending with \\');
13+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
Title ending with \
3+
===================
4+
5+
Section ending with \
6+
---------------------
7+

0 commit comments

Comments
 (0)