Merge branch '4.0'

* 4.0:
  [2.7] Fix issues found by PHPStan
  [Command] Fix upgrade guide example
  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
  [FrameworkBundle] fix merge of 3.3 into 3.4
  bumped Symfony version to 4.0.3
  updated VERSION for 4.0.2
  updated CHANGELOG for 4.0.2
  bumped Symfony version to 3.4.3
  updated VERSION for 3.4.2
  updated CHANGELOG for 3.4.2
This commit is contained in:
Nicolas Grekas 2017-12-20 12:11:10 +01:00
commit 12a269a4e0
30 changed files with 94 additions and 59 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

@ -7,6 +7,42 @@ in 4.0 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.0.0...v4.0.1
* 4.0.2 (2017-12-15)
* bug #25489 [FrameworkBundle] remove esi/ssi renderers if inactive (dmaicher)
* bug #25502 Fixing wrong class_exists on interface (weaverryan)
* bug #25427 Preserve percent-encoding in URLs when performing redirects in the UrlMatcher (mpdude)
* bug #25480 [FrameworkBundle] add missing validation options to XSD file (xabbuh)
* bug #25487 [Console] Fix a bug when passing a letter that could be an alias (Simperfit)
* bug #25425 When available use AnnotationRegistry::registerUniqueLoader (jrjohnson)
* bug #25474 [DI] Optimize Container::get() for perf (nicolas-grekas)
* bug #24594 [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files (BjornTwachtmann)
* bug #25233 [TwigBridge][Form] Fix hidden currency element with Bootstrap 3 theme (julienfalque)
* bug #25413 [HttpKernel] detect deprecations thrown by container initialization during tests (nicolas-grekas)
* bug #25408 [Debug] Fix catching fatal errors in case of nested error handlers (nicolas-grekas)
* bug #25330 [HttpFoundation] Support 0 bit netmask in IPv6 (`::/0`) (stephank)
* bug #25378 [VarDumper] Fixed file links leave blank pages when ide is configured (antalaron)
* bug #25410 [HttpKernel] Fix logging of post-terminate errors/exceptions (nicolas-grekas)
* bug #25409 [Bridge/Doctrine] Drop "memcache" type (nicolas-grekas)
* bug #25417 [Process] Dont rely on putenv(), it fails on ZTS PHP (nicolas-grekas)
* bug #25333 [DI] Impossible to set an environment variable and then an array as container parameter (Phantas0s)
* bug #25447 [Process] remove false-positive BC breaking exception on Windows (nicolas-grekas)
* bug #25381 [DI] Add context to service-not-found exceptions thrown by service locators (nicolas-grekas)
* bug #25438 [Yaml] empty lines don't count for indent detection (xabbuh)
* bug #25412 Extend Argon2i support check to account for sodium_compat (mbabker)
* bug #25392 [HttpFoundation] Fixed default user-agent (3.X -> 4.X) (lyrixx)
* bug #25389 [Yaml] fix some edge cases with indented blocks (xabbuh)
* bug #25396 [Form] Fix debug:form command definition (yceruto)
* bug #25398 [HttpFoundation] don't prefix cookies with "Set-Cookie:" (pableu)
* bug #25354 [DI] Fix non-string class handling in PhpDumper (nicolas-grekas, sroze)
* bug #25340 [Serializer] Unset attributes when creating child context (dunglas)
* bug #25325 [Yaml] do not evaluate PHP constant names (xabbuh)
* bug #25380 [FrameworkBundle][Cache] register system cache clearer only if it's used (xabbuh)
* bug #25323 [ExpressionLanguage] throw an SyntaxError instead of an undefined index notice (Simperfit)
* bug #25363 [HttpKernel] Disable inlining on PHP 5 (nicolas-grekas)
* bug #25364 [DependencyInjection] Prevent a loop in aliases within the `findDefinition` method (sroze)
* bug #25337 Remove Exclusive Lock That Breaks NFS Caching (brianfreytag)
* 4.0.1 (2017-12-05)
* bug #25304 [Bridge/PhpUnit] Prefer $_SERVER['argv'] over $argv (ricknox)

View File

@ -627,7 +627,7 @@ HttpKernel
# ...
# explicit commands registration
AppBundle\Command:
AppBundle\Command\:
resource: '../../src/AppBundle/Command/*'
tags: ['console.command']
```

View File

@ -12,7 +12,6 @@
namespace Symfony\Bridge\Doctrine;
use ProxyManager\Proxy\LazyLoadingInterface;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Doctrine\Common\Persistence\AbstractManagerRegistry;
@ -24,7 +23,7 @@ use Doctrine\Common\Persistence\AbstractManagerRegistry;
abstract class ManagerRegistry extends AbstractManagerRegistry
{
/**
* @var ContainerInterface
* @var Container
*/
protected $container;
@ -58,7 +57,7 @@ abstract class ManagerRegistry extends AbstractManagerRegistry
$name = $this->aliases[$name];
}
if (isset($this->fileMap[$name])) {
$wrappedInstance = $this->load($this->fileMap[$name], false);
$wrappedInstance = $this->load($this->fileMap[$name]);
} else {
$method = $this->methodMap[$name] ?? 'get'.strtr($name, $this->underscoreMap).'Service'; // BC with DI v3.4
$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

@ -141,13 +141,6 @@ abstract class FrameworkExtensionTest extends TestCase
$container = $this->createContainerFromFile('esi_disabled');
$this->assertFalse($container->hasDefinition('fragment.renderer.esi'), 'The ESI fragment renderer is not registered');
}
public function testEsiInactive()
{
$container = $this->createContainerFromFile('default_config');
$this->assertFalse($container->hasDefinition('fragment.renderer.esi'));
$this->assertFalse($container->hasDefinition('esi'));
}
@ -164,6 +157,7 @@ abstract class FrameworkExtensionTest extends TestCase
$container = $this->createContainerFromFile('ssi_disabled');
$this->assertFalse($container->hasDefinition('fragment.renderer.ssi'), 'The SSI fragment renderer is not registered');
$this->assertFalse($container->hasDefinition('ssi'));
}
public function testEsiAndSsiWithoutFragments()
@ -175,14 +169,6 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertTrue($container->hasDefinition('fragment.renderer.ssi'), 'The SSI fragment renderer is registered');
}
public function testSsiInactive()
{
$container = $this->createContainerFromFile('default_config');
$this->assertFalse($container->hasDefinition('fragment.renderer.ssi'));
$this->assertFalse($container->hasDefinition('ssi'));
}
public function testEnabledProfiler()
{
$container = $this->createContainerFromFile('profiler');

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

@ -46,6 +46,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

@ -258,6 +258,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

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

View File

@ -1519,7 +1519,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

@ -989,7 +989,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

@ -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;