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 273eb48

Browse filesBrowse files
committed
Merge branch '3.0' into 3.1
* 3.0: Minor fixes [Console] Overcomplete argument exception message tweak. fixed bad auto merge Console table cleanup undefined offset fix (#19406) [EventDispatcher] Removed unused variable
2 parents b1fb82d + ca71e74 commit 273eb48
Copy full SHA for 273eb48

File tree

19 files changed

+68
-47
lines changed
Filter options

19 files changed

+68
-47
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Symfony\Component\Serializer\Normalizer\DataUriNormalizer;
2929
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
3030
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
31-
use Symfony\Component\Validator\Validation;
3231

3332
/**
3433
* FrameworkExtension.

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function welcomeAction(Request $request, $name = null)
4545

4646
public function logoutAction(Request $request)
4747
{
48-
$request->getSession('session')->invalidate();
48+
$request->getSession()->invalidate();
4949

5050
return new Response('Session cleared.');
5151
}

‎src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
105105

106106
return 1;
107107
}
108-
$passwordQuestion = $this->createPasswordQuestion($input, $output);
108+
$passwordQuestion = $this->createPasswordQuestion();
109109
$password = $io->askQuestion($passwordQuestion);
110110
}
111111

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/Table.php
+18-17Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ public static function getStyleDefinition($name)
115115
self::$styles = self::initStyles();
116116
}
117117

118-
if (!self::$styles[$name]) {
119-
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
118+
if (isset(self::$styles[$name])) {
119+
return self::$styles[$name];
120120
}
121121

122-
return self::$styles[$name];
122+
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
123123
}
124124

125125
/**
@@ -131,13 +131,7 @@ public static function getStyleDefinition($name)
131131
*/
132132
public function setStyle($name)
133133
{
134-
if ($name instanceof TableStyle) {
135-
$this->style = $name;
136-
} elseif (isset(self::$styles[$name])) {
137-
$this->style = self::$styles[$name];
138-
} else {
139-
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
140-
}
134+
$this->style = $this->resolveStyle($name);
141135

142136
return $this;
143137
}
@@ -164,13 +158,7 @@ public function setColumnStyle($columnIndex, $name)
164158
{
165159
$columnIndex = intval($columnIndex);
166160

167-
if ($name instanceof TableStyle) {
168-
$this->columnStyles[$columnIndex] = $name;
169-
} elseif (isset(self::$styles[$name])) {
170-
$this->columnStyles[$columnIndex] = self::$styles[$name];
171-
} else {
172-
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
173-
}
161+
$this->columnStyles[$columnIndex] = $this->resolveStyle($name);
174162

175163
return $this;
176164
}
@@ -701,4 +689,17 @@ private static function initStyles()
701689
'symfony-style-guide' => $styleGuide,
702690
);
703691
}
692+
693+
private function resolveStyle($name)
694+
{
695+
if ($name instanceof TableStyle) {
696+
return $name;
697+
}
698+
699+
if (isset(self::$styles[$name])) {
700+
return self::$styles[$name];
701+
}
702+
703+
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
704+
}
704705
}

‎src/Symfony/Component/Console/Input/ArgvInput.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/ArgvInput.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ private function parseArgument($token)
176176

177177
// unexpected argument
178178
} else {
179-
throw new RuntimeException('Too many arguments.');
179+
$all = $this->definition->getArguments();
180+
if (count($all)) {
181+
throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
182+
}
183+
184+
throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
180185
}
181186
}
182187

‎src/Symfony/Component/Console/Tests/Helper/TableTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/TableTest.php
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,25 @@ public function testColumnWiths()
694694
$this->assertEquals($expected, $this->getOutputContent($output));
695695
}
696696

697+
/**
698+
* @expectedException Symfony\Component\Console\Exception\InvalidArgumentException
699+
* @expectedExceptionMessage Style "absent" is not defined.
700+
*/
701+
public function testIsNotDefinedStyleException()
702+
{
703+
$table = new Table($this->getOutputStream());
704+
$table->setStyle('absent');
705+
}
706+
707+
/**
708+
* @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
709+
* @expectedExceptionMessage Style "absent" is not defined.
710+
*/
711+
public function testGetStyleDefinition()
712+
{
713+
Table::getStyleDefinition('absent');
714+
}
715+
697716
protected function getOutputStream()
698717
{
699718
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false);

‎src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,17 @@ public function provideInvalidInput()
183183
array(
184184
array('cli.php', 'foo', 'bar'),
185185
new InputDefinition(),
186-
'Too many arguments.',
186+
'No arguments expected, got "foo".',
187+
),
188+
array(
189+
array('cli.php', 'foo', 'bar'),
190+
new InputDefinition(array(new InputArgument('number'))),
191+
'Too many arguments, expected arguments "number".',
192+
),
193+
array(
194+
array('cli.php', 'foo', 'bar', 'zzz'),
195+
new InputDefinition(array(new InputArgument('number'), new InputArgument('county'))),
196+
'Too many arguments, expected arguments "number" "county".',
187197
),
188198
array(
189199
array('cli.php', '--foo'),

‎src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Debug\DebugClassLoader;
1515
use Symfony\Component\Debug\ErrorHandler;
16-
use Symfony\Component\Debug\Exception\ContextErrorException;
1716

1817
class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
1918
{

‎src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\DependencyInjection\Alias;
15-
use Symfony\Component\DependencyInjection\Definition;
1615
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
1716
use Symfony\Component\DependencyInjection\Reference;
1817
use Symfony\Component\DependencyInjection\ContainerBuilder;

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testProcess()
4848

4949
$this->assertTrue($container->has('container'));
5050

51-
$resolvedFactory = $aDefinition->getFactory(false);
51+
$resolvedFactory = $aDefinition->getFactory();
5252
$this->assertSame('b_alias', (string) $resolvedFactory[0]);
5353
}
5454

‎src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function testGet()
114114
try {
115115
@$builder->get('baz');
116116
$this->fail('->get() throws a ServiceCircularReferenceException if the service has a circular reference to itself');
117-
} catch (\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException $e) {
117+
} catch (ServiceCircularReferenceException $e) {
118118
$this->assertEquals('Circular reference detected for service "baz", path: "baz".', $e->getMessage(), '->get() throws a LogicException if the service has a circular reference to itself');
119119
}
120120

‎src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Bridge\PhpUnit\ErrorAssert;
1515
use Symfony\Component\DependencyInjection\ContainerInterface;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
17-
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1817
use Symfony\Component\DependencyInjection\Reference;
1918
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2019
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

‎src/Symfony/Component/DomCrawler/Tests/FormTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Tests/FormTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\DomCrawler\Form;
1515
use Symfony\Component\DomCrawler\FormFieldRegistry;
16-
use Symfony\Component\DomCrawler\Field;
1716

1817
class FormTest extends \PHPUnit_Framework_TestCase
1918
{

‎src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/BarCommand.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command;
44

55
use Symfony\Component\Console\Command\Command;
6-
use Symfony\Component\HttpKernel\Bundle;
76

87
/**
98
* This command has a required parameter on the constructor and will be ignored by the default Bundle implementation.

‎src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ public function testParseTypeInt32($value, $expected, $message = '')
656656
{
657657
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
658658
$parsedValue = $formatter->parse($value, NumberFormatter::TYPE_INT32);
659-
$this->assertSame($expected, $parsedValue);
659+
$this->assertSame($expected, $parsedValue, $message);
660660
}
661661

662662
public function parseTypeInt32Provider()

‎src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ public function testIsReadable($collection, $path)
8181
*/
8282
public function testIsWritable($collection, $path)
8383
{
84-
$this->assertTrue($this->propertyAccessor->isWritable($collection, $path, 'Updated'));
84+
$this->assertTrue($this->propertyAccessor->isWritable($collection, $path));
8585
}
8686
}

‎src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorCollectionTest.php
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,33 +166,25 @@ public function testSetValueFailsIfNoAdderNorRemoverFound()
166166
public function testIsWritableReturnsTrueIfAdderAndRemoverExists()
167167
{
168168
$car = $this->getMock(__CLASS__.'_Car');
169-
$axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third'));
170-
171-
$this->assertTrue($this->propertyAccessor->isWritable($car, 'axes', $axes));
169+
$this->assertTrue($this->propertyAccessor->isWritable($car, 'axes'));
172170
}
173171

174172
public function testIsWritableReturnsFalseIfOnlyAdderExists()
175173
{
176174
$car = $this->getMock(__CLASS__.'_CarOnlyAdder');
177-
$axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third'));
178-
179-
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes', $axes));
175+
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
180176
}
181177

182178
public function testIsWritableReturnsFalseIfOnlyRemoverExists()
183179
{
184180
$car = $this->getMock(__CLASS__.'_CarOnlyRemover');
185-
$axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third'));
186-
187-
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes', $axes));
181+
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
188182
}
189183

190184
public function testIsWritableReturnsFalseIfNoAdderNorRemoverExists()
191185
{
192186
$car = $this->getMock(__CLASS__.'_CarNoAdderAndRemover');
193-
$axes = $this->getContainer(array(1 => 'first', 2 => 'second', 3 => 'third'));
194-
195-
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes', $axes));
187+
$this->assertFalse($this->propertyAccessor->isWritable($car, 'axes'));
196188
}
197189

198190
/**

‎src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function testGetInvalidEngine()
121121
$secondEngine = $this->getEngineMock('template.php', false);
122122

123123
$delegatingEngine = new DelegatingEngine(array($firstEngine, $secondEngine));
124-
$delegatingEngine->getEngine('template.php', array('foo' => 'bar'));
124+
$delegatingEngine->getEngine('template.php');
125125
}
126126

127127
private function getEngineMock($template, $supports)

‎src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PluralizationRulesTest extends \PHPUnit_Framework_TestCase
3737
*/
3838
public function testFailedLangcodes($nplural, $langCodes)
3939
{
40-
$matrix = $this->generateTestData($nplural, $langCodes);
40+
$matrix = $this->generateTestData($langCodes);
4141
$this->validateMatrix($nplural, $matrix, false);
4242
}
4343

@@ -46,7 +46,7 @@ public function testFailedLangcodes($nplural, $langCodes)
4646
*/
4747
public function testLangcodes($nplural, $langCodes)
4848
{
49-
$matrix = $this->generateTestData($nplural, $langCodes);
49+
$matrix = $this->generateTestData($langCodes);
5050
$this->validateMatrix($nplural, $matrix);
5151
}
5252

@@ -108,7 +108,7 @@ protected function validateMatrix($nplural, $matrix, $expectSuccess = true)
108108
}
109109
}
110110

111-
protected function generateTestData($plural, $langCodes)
111+
protected function generateTestData($langCodes)
112112
{
113113
$matrix = array();
114114
foreach ($langCodes as $langCode) {

0 commit comments

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