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
This commit is contained in:
Nicolas Grekas 2017-12-20 12:05:09 +01:00
commit a8755cc7d7
40 changed files with 73 additions and 58 deletions

View File

@ -10,6 +10,7 @@ return PhpCsFixer\Config::create()
'@Symfony:risky' => true,
'array_syntax' => array('syntax' => 'long'),
'protected_to_private' => false,
'php_unit_dedicate_assert' => array('target' => '3.5'),
))
->setRiskyAllowed(true)
->setFinder(

View File

@ -12,7 +12,6 @@
namespace Symfony\Bridge\Doctrine;
use ProxyManager\Proxy\LazyLoadingInterface;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
@ -26,7 +25,7 @@ use Doctrine\Common\Persistence\AbstractManagerRegistry;
abstract class ManagerRegistry extends AbstractManagerRegistry implements ContainerAwareInterface
{
/**
* @var ContainerInterface
* @var Container
*/
protected $container;
@ -75,7 +74,7 @@ abstract class ManagerRegistry extends AbstractManagerRegistry implements Contai
$name = $this->aliases[$name];
}
if (isset($this->fileMap[$name])) {
$wrappedInstance = $this->load($this->fileMap[$name], false);
$wrappedInstance = $this->load($this->fileMap[$name]);
} else {
$method = !isset($this->methodMap[$name]) ? 'get'.strtr($name, $this->underscoreMap).'Service' : $this->methodMap[$name];
$wrappedInstance = $this->{$method}(false);

View File

@ -15,8 +15,7 @@ class RegisterMappingsPassTest extends TestCase
*/
public function testNoDriverParmeterException()
{
$container = $this->createBuilder(array(
));
$container = $this->createBuilder();
$this->process($container, array(
'manager.param.one',
'manager.param.two',

View File

@ -19,12 +19,18 @@ use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class DoctrineChoiceLoaderTest extends TestCase
{
/**
* @var ChoiceListFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $factory;
/**
* @var ObjectManager|\PHPUnit_Framework_MockObject_MockObject
*/

View File

@ -31,7 +31,6 @@ use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Tests\Extension\Core\Type\BaseTypeTest;
use Symfony\Component\Form\Tests\Extension\Core\Type\FormTypeTest;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
@ -1120,10 +1119,7 @@ class EntityTypeTest extends BaseTypeTest
$repo = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
$entityType = new EntityType(
$this->emRegistry,
PropertyAccess::createPropertyAccessor()
);
$entityType = new EntityType($this->emRegistry);
$entityTypeGuesser = new DoctrineOrmTypeGuesser($this->emRegistry);
@ -1183,10 +1179,7 @@ class EntityTypeTest extends BaseTypeTest
$repo = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
$entityType = new EntityType(
$this->emRegistry,
PropertyAccess::createPropertyAccessor()
);
$entityType = new EntityType($this->emRegistry);
$entityTypeGuesser = new DoctrineOrmTypeGuesser($this->emRegistry);

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\PropertyInfo\Tests;
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo;
use Doctrine\DBAL\Types\Type as DBALType;
use Doctrine\ORM\EntityManager;

View File

@ -116,7 +116,7 @@ class CodeHelper extends Helper
{
if (is_readable($file)) {
if (extension_loaded('fileinfo')) {
$finfo = new \Finfo();
$finfo = new \finfo();
// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) {

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\Tests;
namespace Symfony\Bundle\SecurityBundle\Tests\Debug;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener;

View File

@ -9,12 +9,13 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Tests;
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;
class CacheWarmingTest extends TestCase

View File

@ -9,12 +9,13 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Tests;
namespace Symfony\Bundle\TwigBundle\Tests\Functional;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;
class NoTemplatingEntryTest extends TestCase

View File

@ -250,6 +250,8 @@
mode: arguments[0].mode,
redirect: arguments[0].redirect
};
} else {
url = String(url);
}
if (!url.match(new RegExp({{ excluded_ajax_paths|json_encode|raw }}))) {
var method = 'GET';

View File

@ -12,13 +12,9 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder as CustomNodeBuilder;
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
require __DIR__.'/../../Fixtures/Builder/NodeBuilder.php';
require __DIR__.'/../../Fixtures/Builder/BarNodeDefinition.php';
require __DIR__.'/../../Fixtures/Builder/VariableNodeDefinition.php';
class TreeBuilderTest extends TestCase
{
public function testUsingACustomNodeBuilder()
@ -28,11 +24,11 @@ class TreeBuilderTest extends TestCase
$nodeBuilder = $root->children();
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder', $nodeBuilder);
$nodeBuilder = $nodeBuilder->arrayNode('deeper')->children();
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder', $nodeBuilder);
}
public function testOverrideABuiltInNodeType()
@ -42,7 +38,7 @@ class TreeBuilderTest extends TestCase
$definition = $root->children()->variableNode('variable');
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition', $definition);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\VariableNodeDefinition', $definition);
}
public function testAddANodeType()
@ -52,7 +48,7 @@ class TreeBuilderTest extends TestCase
$definition = $root->children()->barNode('variable');
$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\BarNodeDefinition', $definition);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\BarNodeDefinition', $definition);
}
public function testCreateABuiltInNodeTypeWithACustomNodeBuilder()

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition\Builder;
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Tests\Fixtures\BarNode;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition\Builder;
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Tests\Definition\Builder;
namespace Symfony\Component\Config\Tests\Fixtures\Builder;
use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition;

View File

@ -47,6 +47,12 @@ class QuestionHelper extends Helper
}
if (!$input->isInteractive()) {
if ($question instanceof ChoiceQuestion) {
$choices = $question->getChoices();
return $choices[$question->getDefault()];
}
return $question->getDefault();
}

View File

@ -83,6 +83,10 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
$question->setMultiselect(true);
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 0);
// We are supposed to get the default value since we are not in interactive mode
$this->assertEquals('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, true), $this->createOutputInterface(), $question));
}
public function testAsk()

View File

@ -261,6 +261,7 @@ class FlattenExceptionTest extends TestCase
public function testRecursionInArguments()
{
$a = null;
$a = array('foo', array(2, &$a));
$exception = $this->createException($a);

View File

@ -26,7 +26,7 @@ class RegisterEnvVarProcessorsPassTest extends TestCase
(new RegisterEnvVarProcessorsPass())->process($container);
$this->assertTrue($container->has('container.env_var_processors_locator'));
$this->assertInstanceof(SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo'));
$this->assertInstanceOf(SimpleProcessor::class, $container->get('container.env_var_processors_locator')->get('foo'));
$expected = array(
'foo' => array('string'),

View File

@ -32,7 +32,7 @@ class ResolveInstanceofConditionalsPassTest extends TestCase
$parent = 'instanceof.'.parent::class.'.0.foo';
$def = $container->getDefinition('foo');
$this->assertEmpty($def->getInstanceofConditionals());
$this->assertInstanceof(ChildDefinition::class, $def);
$this->assertInstanceOf(ChildDefinition::class, $def);
$this->assertTrue($def->isAutowired());
$this->assertSame($parent, $def->getParent());
$this->assertSame(array('tag' => array(array()), 'baz' => array(array('attr' => 123))), $def->getTags());

View File

@ -556,6 +556,7 @@ class ProjectServiceContainer extends Container
public $__foo_bar;
public $__foo_baz;
public $__internal;
protected $privates;
protected $methodMap = array(
'internal' => 'getInternalService',
'bar' => 'getBarService',

View File

@ -1539,7 +1539,7 @@ class FilesystemTest extends FilesystemTestCase
// skip mode check on Windows
if ('\\' !== DIRECTORY_SEPARATOR) {
$this->assertFilePermissions(664, $filename, 'The written file should keep the same permissions as before.');
$this->assertFilePermissions(664, $filename);
umask($oldMask);
}
}

View File

@ -82,11 +82,14 @@ class FormRegistry implements FormRegistryInterface
if (!$type) {
// Support fully-qualified class names
if (class_exists($name) && in_array('Symfony\Component\Form\FormTypeInterface', class_implements($name))) {
$type = new $name();
} else {
throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
if (!class_exists($name)) {
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not exist.', $name));
}
if (!is_subclass_of($name, 'Symfony\Component\Form\FormTypeInterface')) {
throw new InvalidArgumentException(sprintf('Could not load type "%s": class does not implement "Symfony\Component\Form\FormTypeInterface".', $name));
}
$type = new $name();
}
$this->types[$name] = $this->resolveType($type);

View File

@ -946,7 +946,7 @@ class ResponseTest extends ResponseTestCase
$ianaCodesReasonPhrases = array();
$xpath = new \DomXPath($ianaHttpStatusCodes);
$xpath = new \DOMXPath($ianaHttpStatusCodes);
$xpath->registerNamespace('ns', 'http://www.iana.org/assignments');
$records = $xpath->query('//ns:record');

View File

@ -24,8 +24,8 @@ class StrictSessionHandlerTest extends TestCase
->with('path', 'name')->willReturn(true);
$proxy = new StrictSessionHandler($handler);
$this->assertInstanceof('SessionUpdateTimestampHandlerInterface', $proxy);
$this->assertInstanceof(AbstractSessionHandler::class, $proxy);
$this->assertInstanceOf('SessionUpdateTimestampHandlerInterface', $proxy);
$this->assertInstanceOf(AbstractSessionHandler::class, $proxy);
$this->assertTrue($proxy->open('path', 'name'));
}

View File

@ -234,7 +234,7 @@ final class Intl
*/
public static function getIcuStubVersion()
{
return '60.1';
return '60.2';
}
/**

View File

@ -15,4 +15,4 @@
57 = http://source.icu-project.org/repos/icu/icu/tags/release-57-1/source
58 = http://source.icu-project.org/repos/icu/tags/release-58-2/icu4c/source
59 = http://source.icu-project.org/repos/icu/tags/release-59-1/icu4c/source
60 = http://source.icu-project.org/repos/icu/tags/release-60-1/icu4c/source
60 = http://source.icu-project.org/repos/icu/tags/release-60-2/icu4c/source

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.11",
"Version": "2.1.37.96",
"Names": {
"ADP": [
"ADP",

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.28",
"Version": "2.1.37.69",
"Names": {
"AED": [
"AED",

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.11",
"Version": "2.1.37.96",
"Names": {
"aa": "Afar",
"ab": "Abchasisch",

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.28",
"Version": "2.1.37.69",
"Names": {
"aa": "افار",
"ab": "ابقازیان",

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.11",
"Version": "2.1.37.96",
"Names": {
"AC": "Ascension",
"AD": "Andorra",

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.28",
"Version": "2.1.37.69",
"Names": {
"AC": "اسینشن آئلینڈ",
"AD": "انڈورا",

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.11",
"Version": "2.1.37.96",
"Names": {
"Afak": "Afaka",
"Aghb": "Kaukasisch-Albanisch",

View File

@ -1,5 +1,5 @@
{
"Version": "2.1.37.28",
"Version": "2.1.37.69",
"Names": {
"Arab": "عربی",
"Armn": "آرمینیائی",

View File

@ -1,7 +1,7 @@
SVN information
===============
URL: http://source.icu-project.org/repos/icu/tags/release-60-1/icu4c/source
Revision: 40662
URL: http://source.icu-project.org/repos/icu/tags/release-60-2/icu4c/source
Revision: 40727
Author: yoshito
Date: 2017-10-31T15:14:15.305164Z
Date: 2017-12-13T20:01:38.026283Z

View File

@ -1 +1 @@
60.1
60.2

View File

@ -870,7 +870,9 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
$position = null;
$formatter = $this->getDefaultDateFormatter('y');
$this->assertSame(0, $formatter->parse('1970', $position));
$this->assertNull($position);
// Since $position is not supported by the Symfony implementation, the following won't work.
// The intl implementation works this way since 60.2.
// $this->assertSame(4, $position);
}
public function testSetPattern()

View File

@ -75,7 +75,7 @@ class PhpMatcherDumperTest extends TestCase
->setMethods(array('redirect'))
->setConstructorArgs(array(new RequestContext()))
->getMock();
$matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo')->willReturn(array());
$matcher->match('/foo%3Abar');

View File

@ -1,6 +1,6 @@
<?php
namespace Symfony\Component\Workflow\Tests;
namespace Symfony\Component\Workflow\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;