Skip to content

Commit a13befe

Browse files
Merge branch '3.4'
* 3.4: [DI] Handle container.autowiring.strict_mode to opt-out from legacy autowiring [2.8] Fix some docblocks Escape trailing \ in QuestionHelper autocompletion [FrameworkBundle][Serializer] Remove outdated condition Add "doctrine/annotations" to top-level composer.json Fix phpdoc inconsistencies, simplify no-op sprintf. Remove inapplicable phpdoc comment nit: Fix phpdoc inconsistency and unreachable statement [DI] Register default env var provided types Fix phpdoc and unnecessary sprintf [FrameworkBundle][Workflow] Fix deprectation when checking workflow.registry service in dump command [Security] Fix BC layer for AbstractGuardAuthenticator subclasses Prefer line formatter on missing cli dumper [DI] Enhance service locator error message
2 parents a4d7843 + cb5e791 commit a13befe

File tree

21 files changed

+91
-33
lines changed

21 files changed

+91
-33
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
},
8585
"require-dev": {
8686
"cache/integration-tests": "dev-master",
87+
"doctrine/annotations": "~1.0",
8788
"doctrine/cache": "~1.6",
8889
"doctrine/data-fixtures": "1.0.*",
8990
"doctrine/dbal": "~2.4",

src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Monolog\Handler;
1313

14+
use Monolog\Formatter\LineFormatter;
1415
use Monolog\Handler\AbstractProcessingHandler;
1516
use Monolog\Logger;
1617
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
@@ -20,6 +21,7 @@
2021
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2122
use Symfony\Component\Console\Output\OutputInterface;
2223
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
24+
use Symfony\Component\VarDumper\Dumper\CliDumper;
2325

2426
/**
2527
* Writes logs to the console output depending on its verbosity setting.
@@ -162,6 +164,9 @@ protected function write(array $record)
162164
*/
163165
protected function getDefaultFormatter()
164166
{
167+
if (!class_exists(CliDumper::class)) {
168+
return new LineFormatter();
169+
}
165170
if (!$this->output) {
166171
return new ConsoleFormatter();
167172
}

src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function hasMarkedPlace($subject, $placeName, $name = null)
8585
* Returns marked places.
8686
*
8787
* @param object $subject A subject
88-
* @param string $placesNameOnly If true, returns only places name. If false returns the raw representation
88+
* @param bool $placesNameOnly If true, returns only places name. If false returns the raw representation
8989
* @param string $name A workflow name
9090
*
9191
* @return string[]|int[]

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,6 @@ protected function describeCallable($callable, array $options = array())
413413
$this->writeText($this->formatCallable($callable), $options);
414414
}
415415

416-
/**
417-
* @param array $array
418-
*/
419416
private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, $event, array $eventListeners, SymfonyStyle $io)
420417
{
421418
$tableHeaders = array('Order', 'Callable', 'Priority');

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
476476
private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
477477
{
478478
if (!$config['enabled']) {
479-
if (!class_exists(Workflow\Workflow::class)) {
480-
$container->removeDefinition(WorkflowDumpCommand::class);
481-
}
479+
$container->removeDefinition(WorkflowDumpCommand::class);
482480

483481
return;
484482
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,13 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
1313

14-
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
15-
1614
/**
1715
* @author Kévin Dunglas <[email protected]>
1816
*/
1917
class SerializerTest extends WebTestCase
2018
{
2119
public function testDeserializeArrayOfObject()
2220
{
23-
if (!class_exists(DataUriNormalizer::class)) {
24-
$this->markTestSkipped('This test is only applicable when using the Symfony Serializer Component version 3.1 or superior.');
25-
}
26-
2721
static::bootKernel(array('test_case' => 'Serializer'));
2822
$container = static::$kernel->getContainer();
2923

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
namespace Symfony\Component\Console\Helper;
1313

1414
use Symfony\Component\Console\Exception\RuntimeException;
15+
use Symfony\Component\Console\Formatter\OutputFormatter;
16+
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
1517
use Symfony\Component\Console\Input\InputInterface;
1618
use Symfony\Component\Console\Input\StreamableInputInterface;
1719
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1820
use Symfony\Component\Console\Output\OutputInterface;
19-
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
2021
use Symfony\Component\Console\Question\Question;
2122
use Symfony\Component\Console\Question\ChoiceQuestion;
2223

@@ -283,7 +284,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
283284
// Save cursor position
284285
$output->write("\0337");
285286
// Write highlighted text
286-
$output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
287+
$output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
287288
// Restore cursor position
288289
$output->write("\0338");
289290
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Table
4848
/**
4949
* Number of columns cache.
5050
*
51-
* @var array
51+
* @var int
5252
*/
5353
private $numberOfColumns;
5454

src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,46 @@ public function testAskWithAutocompleteWithNonSequentialKeys()
153153
$this->assertEquals('AsseticBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
154154
}
155155

156+
public function testAutocompleteWithTrailingBackslash()
157+
{
158+
if (!$this->hasSttyAvailable()) {
159+
$this->markTestSkipped('`stty` is required to test autocomplete functionality');
160+
}
161+
162+
$inputStream = $this->getInputStream('E');
163+
164+
$dialog = new QuestionHelper();
165+
$dialog->setInputStream($inputStream);
166+
$helperSet = new HelperSet(array(new FormatterHelper()));
167+
$dialog->setHelperSet($helperSet);
168+
169+
$question = new Question('');
170+
$expectedCompletion = 'ExampleNamespace\\';
171+
$question->setAutocompleterValues(array($expectedCompletion));
172+
173+
$output = $this->createOutputInterface();
174+
$dialog->ask($this->createInputInterfaceMock(), $output, $question);
175+
176+
$outputStream = $output->getStream();
177+
rewind($outputStream);
178+
$actualOutput = stream_get_contents($outputStream);
179+
180+
// Shell control (esc) sequences are not so important: we only care that
181+
// <hl> tag is interpreted correctly and replaced
182+
$irrelevantEscSequences = array(
183+
"\0337" => '', // Save cursor position
184+
"\0338" => '', // Restore cursor position
185+
"\033[K" => '', // Clear line from cursor till the end
186+
);
187+
188+
$importantActualOutput = strtr($actualOutput, $irrelevantEscSequences);
189+
190+
// Remove colors (e.g. "\033[30m", "\033[31;41m")
191+
$importantActualOutput = preg_replace('/\033\[\d+(;\d+)?m/', '', $importantActualOutput);
192+
193+
$this->assertEquals($expectedCompletion, $importantActualOutput);
194+
}
195+
156196
public function testAskHiddenResponse()
157197
{
158198
if ('\\' === DIRECTORY_SEPARATOR) {

src/Symfony/Component/DependencyInjection/Compiler/RegisterEnvVarProcessorsPass.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\DependencyInjection\EnvVarProcessor;
1617
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
1718
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1819
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
@@ -45,10 +46,16 @@ public function process(ContainerBuilder $container)
4546
}
4647
}
4748

48-
if ($processors) {
49-
if ($bag instanceof EnvPlaceholderParameterBag) {
50-
$bag->setProvidedTypes($types);
49+
if ($bag instanceof EnvPlaceholderParameterBag) {
50+
foreach (EnvVarProcessor::getProvidedTypes() as $prefix => $type) {
51+
if (!isset($types[$prefix])) {
52+
$types[$prefix] = self::validateProvidedTypes($type, EnvVarProcessor::class);
53+
}
5154
}
55+
$bag->setProvidedTypes($types);
56+
}
57+
58+
if ($processors) {
5259
$container->register('container.env_var_processors_locator', ServiceLocator::class)
5360
->setPublic(true)
5461
->setArguments(array($processors))

0 commit comments

Comments
 (0)