Skip to content

Commit 29875af

Browse files
committed
Merge branch '3.0' into 3.1
* 3.0: [Yaml] fix exception contexts People - person singularization [Yaml] properly handle unindented collections [Serializer] Add test for ignored attributes during denormalization chomp newlines only at the end of YAML documents Fixed server status command when port has been omitted Update UPGRADE FROM 2.x to 3.0 fix removed commands wording in upgrade file Catch \Throwable Catch \Throwable [DependencyInjection] Avoid generating call_user_func in more cases [Validator] Support for DateTimeImmutable [FrameworkBundle] update upgrade instructions Use levenshtein level for better Bundle matching [WebProfilerBundle] Fix CORS ajax security issues remove methods that were needed for PHP 5.3 [DX][DI] Make Autowiring exceptions more future friendly
2 parents d0f788d + ffac963 commit 29875af

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Command/ServerStatusCommand.php

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

1414
use Symfony\Component\Console\Input\InputArgument;
1515
use Symfony\Component\Console\Input\InputInterface;
16+
use Symfony\Component\Console\Input\InputOption;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718
use Symfony\Component\Console\Style\SymfonyStyle;
1819

@@ -32,6 +33,7 @@ protected function configure()
3233
$this
3334
->setDefinition(array(
3435
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'),
36+
new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'),
3537
))
3638
->setName('server:status')
3739
->setDescription('Outputs the status of the built-in web server for the given address')
@@ -46,6 +48,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
4648
$io = new SymfonyStyle($input, $output);
4749
$address = $input->getArgument('address');
4850

51+
if (false === strpos($address, ':')) {
52+
$address = $address.':'.$input->getOption('port');
53+
}
54+
4955
// remove an orphaned lock file
5056
if (file_exists($this->getLockFile($address)) && !$this->isServerRunning($address)) {
5157
unlink($this->getLockFile($address));

Controller/ControllerNameParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ private function findAlternative($nonExistentBundleName)
142142
$lev = levenshtein($nonExistentBundleName, $bundleName);
143143
if ($lev <= strlen($nonExistentBundleName) / 3 && ($alternative === null || $lev < $shortest)) {
144144
$alternative = $bundleName;
145+
$shortest = $lev;
145146
}
146147
}
147148

Tests/Controller/ControllerNameParserTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public function testBuild()
5959
{
6060
$parser = $this->createParser();
6161

62-
$this->assertEquals('FooBundle:Default:index', $parser->build('TestBundle\FooBundle\Controller\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
63-
$this->assertEquals('FooBundle:Sub\Default:index', $parser->build('TestBundle\FooBundle\Controller\Sub\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
62+
$this->assertEquals('FoooooBundle:Default:index', $parser->build('TestBundle\FooBundle\Controller\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
63+
$this->assertEquals('FoooooBundle:Sub\Default:index', $parser->build('TestBundle\FooBundle\Controller\Sub\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
6464

6565
try {
6666
$parser->build('TestBundle\FooBundle\Controller\DefaultController::index');
@@ -132,8 +132,9 @@ public function testInvalidBundleName($bundleName, $suggestedBundleName)
132132
public function getInvalidBundleNameTests()
133133
{
134134
return array(
135-
array('FoodBundle:Default:index', 'FooBundle:Default:index'),
136-
array('CrazyBundle:Default:index', false),
135+
'Alternative will be found using levenshtein' => array('FoodBundle:Default:index', 'FooBundle:Default:index'),
136+
'Alternative will be found using partial match' => array('FabpotFooBund:Default:index', 'FabpotFooBundle:Default:index'),
137+
'Bundle does not exist at all' => array('CrazyBundle:Default:index', false),
137138
);
138139
}
139140

@@ -162,6 +163,7 @@ private function createParser()
162163
$bundles = array(
163164
'SensioFooBundle' => $this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'),
164165
'SensioCmsFooBundle' => $this->getBundle('TestBundle\Sensio\Cms\FooBundle', 'SensioCmsFooBundle'),
166+
'FoooooBundle' => $this->getBundle('TestBundle\FooBundle', 'FoooooBundle'),
165167
'FooBundle' => $this->getBundle('TestBundle\FooBundle', 'FooBundle'),
166168
'FabpotFooBundle' => $this->getBundle('TestBundle\Fabpot\FooBundle', 'FabpotFooBundle'),
167169
);

0 commit comments

Comments
 (0)