diff --git a/.php_cs.dist b/.php_cs.dist index a73e16918c..9b8d082116 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -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( diff --git a/CHANGELOG-4.0.md b/CHANGELOG-4.0.md index 2a4c1db371..7efe25d165 100644 --- a/CHANGELOG-4.0.md +++ b/CHANGELOG-4.0.md @@ -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) diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 0cee61b0cf..8bd9ce3466 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -627,7 +627,7 @@ HttpKernel # ... # explicit commands registration - AppBundle\Command: + AppBundle\Command\: resource: '../../src/AppBundle/Command/*' tags: ['console.command'] ``` diff --git a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php index fd09e82ded..c019c31a9a 100644 --- a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php +++ b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php @@ -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); diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php index ed76f8db68..692ee89e4b 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterMappingsPassTest.php @@ -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', diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php index 4999bda42e..b24a374fed 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php @@ -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 */ class DoctrineChoiceLoaderTest extends TestCase { + /** + * @var ChoiceListFactoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $factory; + /** * @var ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index c41629b4de..0213714397 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -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); diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php index 2f86ac0dde..fd6c23279c 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php @@ -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; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index a3b9c573bc..fa610e5c06 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -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)) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 7ae826734e..e6bdd5fbf1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -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'); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php index 3ddbb1fd4c..287ba531f4 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Debug/TraceableFirewallListenerTest.php @@ -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; diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php index a7a330859f..a21c11adca 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php @@ -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 diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php index 3cf0268203..952b5e6ae1 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php @@ -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 diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index e83e95ae13..aac9e3a0d4 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -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'; diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php index 13304fae36..0a9312346e 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php @@ -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() diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php b/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php index 0d46f3d2c8..b9c62e5377 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php @@ -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; diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php index aa5986311b..22b8b32fb6 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php @@ -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; diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php b/src/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php index 1017880c11..6126ed434f 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php @@ -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; diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index 0bc1bb4ba9..dc088a0565 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -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(); } diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index 4ba20fe797..3b8c07d393 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -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() diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index d68f9a035e..c4cf58315a 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -258,6 +258,7 @@ class FlattenExceptionTest extends TestCase public function testRecursionInArguments() { + $a = null; $a = array('foo', array(2, &$a)); $exception = $this->createException($a); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php index d807a6fa41..cddb62dce9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php @@ -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'), diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php index 1ca36e974f..21a2810578 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php @@ -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()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index 78fe2954af..2ad4ac34fa 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -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', diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 8d21ca3523..def1e5fc09 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -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); } } diff --git a/src/Symfony/Component/Form/FormRegistry.php b/src/Symfony/Component/Form/FormRegistry.php index 7d08d690df..6be83ab95d 100644 --- a/src/Symfony/Component/Form/FormRegistry.php +++ b/src/Symfony/Component/Form/FormRegistry.php @@ -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); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index e3318822bd..b35727962e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -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'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php index 9d2c1949f3..8e97848763 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php @@ -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')); } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 37ac752a6b..e4c18c47b1 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -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'); diff --git a/src/Symfony/Component/Workflow/Tests/DependencyInjection/ValidateWorkflowsPassTest.php b/src/Symfony/Component/Workflow/Tests/DependencyInjection/ValidateWorkflowsPassTest.php index 3b7ddf6d6d..d728cc1195 100644 --- a/src/Symfony/Component/Workflow/Tests/DependencyInjection/ValidateWorkflowsPassTest.php +++ b/src/Symfony/Component/Workflow/Tests/DependencyInjection/ValidateWorkflowsPassTest.php @@ -1,6 +1,6 @@