8000 Merge branch '3.3' into 3.4 · symfony/symfony@a8755cc · GitHub
[go: up one dir, main page]

Skip to content

Commit a8755cc

Browse files
Merge branch '3.3' into 3.4
* 3.3: [2.7] Fix issues found by PHPStan Add php_unit_dedicate_assert to PHPCS [WebProfilerBundle] Let fetch() cast URL to string improve FormType::getType exception message details [Intl] Update ICU data to 60.2 [Console] fix a bug when you are passing a default value and passing -n would ouput the index
2 parents 1aaec5f + d731a27 commit a8755cc

File tree

40 files changed

+73
-58
lines changed

40 files changed

+73
-58
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ return PhpCsFixer\Config::create()
1010
'@Symfony:risky' => true,
1111
'array_syntax' => array('syntax' => 'long'),
1212
'protected_to_private' => false,
13+
'php_unit_dedicate_assert' => array('target' => '3.5'),
1314
))
1415
->setRiskyAllowed(true)
1516
->setFinder(

src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\Doctrine;
1313

1414
use ProxyManager\Proxy\LazyLoadingInterface;
15-
use Psr\Container\ContainerInterface;
1615
use Symfony\Component\DependencyInjection\Container;
1716
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1817
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
@@ -26,7 +25,7 @@
2625
abstract class ManagerRegistry extends AbstractManagerRegistry implements ContainerAwareInterface
2726
{
2827
/**
29-
* @var ContainerInterface
28+
* @var Container
3029
*/
3130
protected $container;
3231

@@ -75,7 +74,7 @@ function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
7574
$name = $this->aliases[$name];
7675
}
7776
if (isset($this->fileMap[$name])) {
78-
$wrappedInstance = $this->load($this->fileMap[$name], false);
77+
$wrappedInstance = $this->load($this->fileMap[$name]);
7978
} else {
8079
$method = !isset($this->methodMap[$name]) ? 'get'.strtr($name, $this->underscoreMap).'Service' : $this->methodMap[$name];
8180
$wrappedInstance = $this->{$method}(false);

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class RegisterMappingsPassTest extends TestCase
1515
*/
1616
public function testNoDriverParmeterException()
1717
{
18-
$container = $this->createBuilder(array(
19-
));
18+
$container = $this->createBuilder();
2019
$this->process($container, array(
2120
'manager.param.one',
2221
'manager.param.two',

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@
1919
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
2020
use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
2121
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
22+
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
2223

2324
/**
2425
* @author Bernhard Schussek <bschussek@gmail.com>
2526
*/
2627
class DoctrineChoiceLoaderTest extends TestCase
2728
{
29+
/**
30+
* @var ChoiceListFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
31+
*/
32+
private $factory;
33+
2834
/**
2935
* @var ObjectManager|\PHPUnit_Framework_MockObject_MockObject
3036
*/

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use Symfony\Component\Form\Forms;
3232
use Symfony\Component\Form\Tests\Extension\Core\Type\BaseTypeTest;
3333
use Symfony\Component\Form\Tests\Extension\Core\Type\FormTypeTest;
34-
use Symfony\Component\PropertyAccess\PropertyAccess;
3534
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity;
3635
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
3736

@@ -1120,10 +1119,7 @@ public function testLoaderCaching()
11201119

11211120
$repo = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
11221121

1123-
$entityType = new EntityType(
1124-
$this->emRegistry,
1125-
PropertyAccess::createPropertyAccessor()
1126-
);
1122+
$entityType = new EntityType($this->emRegistry);
11271123

11281124
$entityTypeGuesser = new DoctrineOrmTypeGuesser($this->emRegistry);
11291125

@@ -1183,10 +1179,7 @@ public function testLoaderCachingWithParameters()
11831179

11841180
$repo = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
11851181

1186-
$entityType = new EntityType(
1187-
$this->emRegistry,
1188-
PropertyAccess::createPropertyAccessor()
1189-
);
1182+
$entityType = new EntityType($this->emRegistry);
11901183

11911184
$entityTypeGuesser = new DoctrineOrmTypeGuesser($this->emRegistry);
11921185

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bridge\Doctrine\PropertyInfo\Tests;
12+
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo;
1313

1414
use Doctrine\DBAL\Types\Type as DBALType;
1515
use Doctrine\ORM\EntityManager;

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function fileExcerpt($file, $line)
116116
{
117117
if (is_readable($file)) {
118118
if (extension_loaded('fileinfo')) {
119-
$finfo = new \Finfo();
119+
$finfo = new \finfo();
120120

121121
// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
122122
if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) {

src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\SecurityBundle\Tests;
12+
namespace Symfony\Bundle\SecurityBundle\Tests\Debug;
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener;

src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\TwigBundle\Tests;
12+
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
1313

1414
use Symfony\Component\HttpKernel\Kernel;
1515
use Symfony\Component\Config\Loader\LoaderInterface;
1616
use Symfony\Component\Filesystem\Filesystem;
1717
use Symfony\Bundle\FrameworkBundle\FrameworkBun D7AE dle;
18+
use Symfony\Bundle\TwigBundle\Tests\TestCase;
1819
use Symfony\Bundle\TwigBundle\TwigBundle;
1920

2021
class CacheWarmingTest extends TestCase

src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\TwigBundle\Tests;
12+
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
1313

1414
use Symfony\Component\HttpKernel\Kernel;
1515
use Symfony\Component\Config\Loader\LoaderInterface;
1616
use Symfony\Component\Filesystem\Filesystem;
1717
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
18+
use Symfony\Bundle\TwigBundle\Tests\TestCase;
1819
use Symfony\Bundle\TwigBundle\TwigBundle;
1920

2021
class NoTemplatingEntryTest extends TestCase

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@
250250
mode: arguments[0].mode,
251251
redirect: arguments[0].redirect
252252
};
253+
} else {
254+
url = String(url);
253255
}
254256
if (!url.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
255257
var method = 'GET';

src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
namespace Symfony\Component\Config\Tests\Definition\Builder;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder as CustomNodeBuilder;
15+
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
1616
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1717

18-
require __DIR__.'/../../Fixtures/Builder/NodeBuilder.php';
19-
require __DIR__.'/../../Fixtures/Builder/BarNodeDefinition.php';
20-
require __DIR__.'/../../Fixtures/Builder/VariableNodeDefinition.php';
21-
2218
class TreeBuilderTest extends TestCase
2319
{
2420
public function testUsingACustomNodeBuilder()
@@ -28,11 +24,11 @@ public function testUsingACustomNodeBuilder()
2824

2925
$nodeBuilder = $root->children();
3026

31-
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
27+
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder', $nodeBuilder);
3228

3329
$nodeBuilder = $nodeBuilder->arrayNode('deeper')->children();
3430

35-
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
31+
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder', $nodeBuilder);
3632
}
3733

3834
public function testOverrideABuiltInNodeType()
@@ -42,7 +38,7 @@ public function testOverrideABuiltInNodeType()
4238

4339
$definition = $root->children()->variableNode('variable');
4440

45-
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition', $definition);
41+
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\VariableNodeDefinition', $definition);
4642
}
4743

4844
public function testAddANodeType()
@@ -52,7 +48,7 @@ public function testAddANodeType()
5248

5349
$definition = $root->children()->barNode('variable');
5450

55-
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\BarNodeDefinition', $definition);
51+
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\BarNodeDefinition', $definition);
5652
}
5753

5854
public function testCreateABuiltInNodeTypeWithACustomNodeBuilder()

src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\Config\Tests\Definition\Builder;
12+
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
1313

1414
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
1515
use Symfony\Component\Config\Tests\Fixtures\BarNode;

src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\Config\Tests\Definition\Builder;
12+
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
1313

1414
use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder;
1515

src/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Component\Config\Tests\Definition\Builder;
12+
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
1313

1414
use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition;
1515

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu
4747
}
4848

4949
if (!$input->isInteractive()) {
50+
if ($question instanceof ChoiceQuestion) {
51+
$choices = $question->getChoices();
52+
53+
return $choices[$question->getDefault()];
54+
}
55+
5056
return $question->getDefault();
5157
}
5258

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public function testAskChoice()
8383
$question->setMultiselect(true);
8484

8585
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
86+
87+
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 0);
88+
// We are supposed to get the default value since we are not in interactive mode
89+
$this->assertEquals('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, true), $this->createOutputInterface(), $question));
8690
}
8791

8892
public function testAsk()

src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ function () {},
261261

262262
public function testRecursionInArguments()
263263
{
264+
$a = null;
264265
$a = array('foo', array(2, &$a));
265266
$exception = $this->createException($a);
266267

src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testSimpleProcessor()
2626
(new RegisterEnvVarProcessorsPass())->process($container);
2727

2828
$this->assertTrue($container->has('container.env_var_processors_locator'));
29-
$this->assertInstanceof(SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo'));
29+
$this->assertInstanceOf(SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo'));
3030

3131
$expected = array(
3232
'foo' => array('string'),

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testProcess()
3232
$parent = 'instanceof.'.parent::class.'.0.foo';
3333
$def = $container->getDefinition('foo');
3434
$this->assertEmpty($def->getInstanceofConditionals());
35-
$this->assertInstanceof(ChildDefinition::class, $def);
35+
$this->assertInstanceOf(ChildDefinition::class, $def);
3636
$this->assertTrue($def->isAutowired());
3737
$this->assertSame($parent, $def->getParent());
3838
$this->assertSame(array('tag' => array(array()), 'baz' => array(array('attr' => 123))), $def->getTags());

src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ class ProjectServiceContainer extends Container
556556
public $__foo_bar;
557557
public $__foo_baz;
558558
public $__internal;
559+
protected $privates;
559560
protected $methodMap = array(
560561
'internal' => 'getInternalService',
561562
'bar' => 'getBarService',

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ public function testAppendToFile()
15391539

15401540
// skip mode check on Windows
15411541
if ('\\' !== DIRECTORY_SEPARATOR) {
1542-
$this->assertFilePermissions(664, $filename, 'The written file should keep the same permissions as before.');
1542+
$this->assertFilePermissions(664, $filename);
15431543
umask($oldMask);
15441544
}
15451545
}

src/Symfony/Component/Form/FormRegistry.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@ public function getType($name)
8282

8383
if (!$type) {
8484
// Support fully-qualified class names
85-
if (class_exists($name) && in_array('Symfony\Component\Form\FormTypeInterface', class_implements($name))) {
86-
$type = new $name();
87-
} else {
88-
throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
85+
if (!class_exists($name)) {
86+
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not exist.', $name));
8987
}
88+
if (!is_subclass_of($name, 'Symfony\Component\Form\FormTypeInterface')) {
89+
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not implement "Symfony\Component\Form\FormTypeInterface".', $name));
90+
}
91+
92+
$type = new $name();
9093
}
9194

9295
$this->types[$name] = $this->resolveType($type);

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ public function ianaCodesReasonPhrasesProvider()
946946

947947
$ianaCodesReasonPhrases = array();
948948

949-
$xpath = new \DomXPath($ianaHttpStatusCodes);
949+
$xpath = new \DOMXPath($ianaHttpStatusCodes);
950950
$xpath->registerNamespace('ns', 'http://www.iana.org/assignments');
951951

952952
$records = $xpath->query('//ns:record');

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public function testOpen()
2424
->with('path', 'name')->willReturn(true);
2525
$proxy = new StrictSessionHandler($handler);
2626

27-
$this->assertInstanceof('SessionUpdateTimestampHandlerInterface', $proxy);
28-
$this->assertInstanceof(AbstractSessionHandler::class, $proxy);
27+
$this->assertInstanceOf('SessionUpdateTimestampHandlerInterface', $proxy);
28+
$this->assertInstanceOf(AbstractSessionHandler::class, $proxy);
2929
$this->assertTrue($proxy->open('path', 'name'));
3030
}
3131

src/Symfony/Component/Intl/Intl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public static function getIcuDataVersion()
234234
*/
235235
public static function getIcuStubVersion()
236236
{
237-
return '60.1';
237+
return '60.2';
238238
}
239239

240240
/**

src/Symfony/Component/Intl/Resources/bin/icu.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
57 = http://source.icu-project.org/repos/icu/icu/tags/release-57-1/source
1616
58 = http://source.icu-project.org/repos/icu/tags/release-58-2/icu4c/source
1717
59 = http://source.icu-project.org/repos/icu/tags/release-59-1/icu4c/source
18-
60 = http://source.icu-project.org/repos/icu/tags/release-60-1/icu4c/source
18+
60 = http://source.icu-project.org/repos/icu/tags/release-60-2/icu4c/source

src/Symfony/Component/Intl/Resources/data/currencies/de.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.37.11",
2+
"Version": "2.1.37.96",
33
"Names": {
44
"ADP": [
55
"ADP",

src/Symfony/Component/Intl/Resources/data/currencies/ur.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.37.28",
2+
"Version": "2.1.37.69",
33
"Names": {
44
"AED": [
55
"AED",

src/Symfony/Component/Intl/Resources/data/languages/de.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.37.11",
2+
"Version": "2.1.37.96",
33
"Names": {
44
"aa": "Afar",
55
"ab": "Abchasisch",

src/Symfony/Component/Intl/Resources/data/languages/ur.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.37.28",
2+
"Version": "2.1.37.69",
33
"Names": {
44
"aa": "افار",
55
"ab": "ابقازیان",

src/Symfony/Component/Intl/Resources/data/regions/de.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.37.11",
2+
"Version": "2.1.37.96",
33
"Names": {
44
"AC": "Ascension",
55
"AD": "Andorra",

src/Symfony/Component/Intl/Resources/data/regions/ur.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": "2.1.37.28",
2+
"Version": "2.1.37.69",
33
"Names": {
44
"AC": "اسینشن آئلینڈ",
55
"AD": "انڈورا",

0 commit comments

Comments
 (0)
0