Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 88f7e33

Browse filesBrowse files
author
Robin Chalas
committed
Merge branch '2.7' into 2.8
* 2.7: [Serializer] Correct typing mistake in DocBlock [Config] Fix closure CS PHP CS Fixer: use PHPUnit Migration ruleset [Console] Commands with an alias should not be recognized as ambiguous
2 parents 44db4d1 + b1aba41 commit 88f7e33
Copy full SHA for 88f7e33

File tree

Expand file treeCollapse file tree

7 files changed

+62
-7
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+62
-7
lines changed

‎.php_cs.dist

Copy file name to clipboardExpand all lines: .php_cs.dist
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ return PhpCsFixer\Config::create()
88
->setRules(array(
99
'@Symfony' => true,
1010
'@Symfony:risky' => true,
11+
'@PHPUnit48Migration:risky' => true,
12+
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
1113
'array_syntax' => array('syntax' => 'long'),
1214
'protected_to_private' => false,
13-
'php_unit_dedicate_assert' => array('target' => '3.5'),
1415
))
1516
->setRiskyAllowed(true)
1617
->setFinder(

‎src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function thenEmptyArray()
161161
*/
162162
public function thenInvalid($message)
163163
{
164-
$this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException(sprintf($message, json_encode($v))); };
164+
$this->thenPart = function ($v) use ($message) { throw new \InvalidArgumentException(sprintf($message, json_encode($v))); };
165165

166166
return $this;
167167
}

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public function findNamespace($namespace)
501501
public function find($name)
502502
{
503503
$this->init();
504-
504+
$aliases = array();
505505
$allCommands = array_keys($this->commands);
506506
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
507507
$commands = preg_grep('{^'.$expr.'}', $allCommands);
@@ -529,15 +529,16 @@ public function find($name)
529529
// filter out aliases for commands which are already on the list
530530
if (count($commands) > 1) {
531531
$commandList = $this->commands;
532-
$commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
532+
$commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
533533
$commandName = $commandList[$nameOrAlias]->getName();
534+
$aliases[$nameOrAlias] = $commandName;
534535

535536
return $commandName === $nameOrAlias || !in_array($commandName, $commands);
536537
});
537538
}
538539

539-
$exact = in_array($name, $commands, true);
540-
if (count($commands) > 1 && !$exact) {
540+
$exact = in_array($name, $commands, true) || isset($aliases[$name]);
541+
if (!$exact && count($commands) > 1) {
541542
$suggestions = $this->getAbbreviationSuggestions(array_values($commands));
542543

543544
throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));

‎src/Symfony/Component/Console/Tests/ApplicationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/ApplicationTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public static function setUpBeforeClass()
4949
require_once self::$fixturesPath.'/BarBucCommand.php';
5050
require_once self::$fixturesPath.'/FooSubnamespaced1Command.php';
5151
require_once self::$fixturesPath.'/FooSubnamespaced2Command.php';
52+
require_once self::$fixturesPath.'/TestTiti.php';
53+
require_once self::$fixturesPath.'/TestToto.php';
5254
}
5355

5456
protected function normalizeLineBreaks($text)
@@ -226,6 +228,14 @@ public function testFindAmbiguousNamespace()
226228
$application->findNamespace('f');
227229
}
228230

231+
public function testFindNonAmbiguous()
232+
{
233+
$application = new Application();
234+
$application->add(new \TestTiti());
235+
$application->add(new \TestToto());
236+
$this->assertEquals('test-toto', $application->find('test')->getName());
237+
}
238+
229239
/**
230240
* @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
231241
* @expectedExceptionMessage There are no commands defined in the "bar" namespace.
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
use Symfony\Component\Console\Command\Command;
4+
use Symfony\Component\Console\Input\InputInterface;
5+
use Symfony\Component\Console\Output\OutputInterface;
6+
7+
class TestTiti extends Command
8+
{
9+
protected function configure()
10+
{
11+
$this
12+
->setName('test-titi')
13+
->setDescription('The test:titi command')
14+
;
15+
}
16+
17+
protected function execute(InputInterface $input, OutputInterface $output)
18+
{
19+
$output->write('test-titi');
20+
}
21+
}
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Symfony\Component\Console\Command\Command;
4+
use Symfony\Component\Console\Input\InputInterface;
5+
use Symfony\Component\Console\Output\OutputInterface;
6+
7+
class TestToto extends Command
8+
{
9+
protected function configure()
10+
{
11+
$this
12+
->setName('test-toto')
13+
->setDescription('The test-toto command')
14+
->setAliases(array('test'))
15+
;
16+
}
17+
18+
protected function execute(InputInterface $input, OutputInterface $output)
19+
{
20+
$output->write('test-toto');
21+
}
22+
}

‎src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function supportsNormalization($data, $format = null)
4949
}
5050

5151
/**
52-
* Checks if the given class implements the NormalizableInterface.
52+
* Checks if the given class implements the DenormalizableInterface.
5353
*
5454
* @param mixed $data Data to denormalize from
5555
* @param string $type The class to which the data should be denormalized

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.