Skip to content

Commit c73ee30

Browse files
Merge branch '2.8' into 3.3
* 2.8: [2.8] Fix some docblocks Escape trailing \ in QuestionHelper autocompletion Add "doctrine/annotations" to top-level composer.json Remove inapplicable phpdoc comment nit: Fix phpdoc inconsistency and unreachable statement
2 parents 2dc8534 + 2627081 commit c73ee30

File tree

9 files changed

+51
-14
lines changed

9 files changed

+51
-14
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
},
8888
"require-dev": {
8989
"cache/integration-tests": "dev-master",
90+
"doctrine/annotations": "~1.0",
9091
"doctrine/cache": "~1.6",
9192
"doctrine/data-fixtures": "1.0.*",
9293
"doctrine/dbal": "~2.4",

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

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

420-
/**
421-
* @param array $array
422-
*/
423420
private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, $event, array $eventListeners, SymfonyStyle $io)
424421
{
425422
$tableHeaders = array('Order', 'Callable', 'Priority');

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313

1414
use Symfony\Component\Console\Exception\InvalidArgumentException;
1515
use Symfony\Component\Console\Exception\RuntimeException;
16+
use Symfony\Component\Console\Formatter\OutputFormatter;
17+
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
1618
use Symfony\Component\Console\Input\InputInterface;
1719
use Symfony\Component\Console\Input\StreamableInputInterface;
1820
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1921
use Symfony\Component\Console\Output\OutputInterface;
20-
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
2122
use Symfony\Component\Console\Question\Question;
2223
use Symfony\Component\Console\Question\ChoiceQuestion;
2324

@@ -324,7 +325,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
324325
// Save cursor position
325326
$output->write("\0337");
326327
// Write highlighted text
327-
$output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
328+
$output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
328329
// Restore cursor position
329330
$output->write("\0338");
330331
}

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/Routing/RouteCollectionBuilder.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class RouteCollectionBuilder
3838
private $methods;
3939
private $resources = array();
4040

41-
/**
42-
* @param LoaderInterface $loader
43-
*/
4441
public function __construct(LoaderInterface $loader = null)
4542
{
4643
$this->loader = $loader;

src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public function __construct(TokenStorageInterface $tokenStorage, EventDispatcher
4444

4545
/**
4646
* Authenticates the given token in the system.
47-
*
48-
* @param TokenInterface $token
49-
* @param Request $request
5047
*/
5148
public function authenticateWithToken(TokenInterface $token, Request $request)
5249
{

src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Serializer\Encoder\ChainEncoder;
16+
use Symfony\Component\Serializer\Encoder\EncoderInterface;
1617
use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface;
1718

1819
class ChainEncoderTest extends TestCase
@@ -123,10 +124,14 @@ class ChainNormalizationAwareEncoder extends ChainEncoder implements Normalizati
123124
{
124125
}
125126

126-
class NormalizationAwareEncoder implements NormalizationAwareInterface
127+
class NormalizationAwareEncoder implements EncoderInterface, NormalizationAwareInterface
127128
{
128129
public function supportsEncoding($format)
129130
{
130131
return true;
131132
}
133+
134+
public function encode($data, $format, array $context = array())
135+
{
136+
}
132137
}

src/Symfony/Component/Translation/PluralizationRules.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public static function get($number, $locale)
7171
case 'vi':
7272
case 'zh':
7373
return 0;
74-
break;
7574

7675
case 'af':
7776
case 'bn':

0 commit comments

Comments
 (0)