diff --git a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php index 622aaf8c92..b71f5454d3 100644 --- a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\BrowserKit\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\BrowserKit\CookieJar; +use Symfony\Component\BrowserKit\Exception\BadMethodCallException; use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\Request; use Symfony\Component\BrowserKit\Response; @@ -46,7 +47,7 @@ class AbstractBrowserTest extends TestCase public function testGetRequestNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getRequest()".'); $client = $this->getBrowser(); @@ -83,7 +84,7 @@ class AbstractBrowserTest extends TestCase public function testGetResponseNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getResponse()".'); $client = $this->getBrowser(); @@ -92,7 +93,7 @@ class AbstractBrowserTest extends TestCase public function testGetInternalResponseNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalResponse()".'); $client = $this->getBrowser(); @@ -119,7 +120,7 @@ class AbstractBrowserTest extends TestCase public function testGetCrawlerNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getCrawler()".'); $client = $this->getBrowser(); @@ -832,7 +833,7 @@ class AbstractBrowserTest extends TestCase public function testInternalRequestNull() { - $this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalRequest()".'); $client = $this->getBrowser(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php index 6a485d8bb4..9d94628f33 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php @@ -20,6 +20,7 @@ use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPa use Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass; use Symfony\Component\DependencyInjection\Compiler\ValidateEnvPlaceholdersPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Extension\Extension; class ValidateEnvPlaceholdersPassTest extends TestCase @@ -59,7 +60,7 @@ class ValidateEnvPlaceholdersPassTest extends TestCase public function testDefaultEnvWithoutPrefixIsValidatedInConfig() { - $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The default value of an env() parameter must be a string or null, but "float" given to "env(FLOATISH)".'); $container = new ContainerBuilder(); @@ -219,7 +220,7 @@ class ValidateEnvPlaceholdersPassTest extends TestCase public function testEmptyEnvWhichCannotBeEmptyForScalarNodeWithValidation() { - $this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class); + $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage('The path "env_extension.scalar_node_not_empty_validated" cannot contain an environment variable when empty values are not allowed by definition and are validated.'); $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php index e19d838b60..37fa0ad9d9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php @@ -14,6 +14,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Extension; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\LogicException; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Tests\Fixtures\Extension\InvalidConfig\InvalidConfigExtension; use Symfony\Component\DependencyInjection\Tests\Fixtures\Extension\SemiValidConfig\SemiValidConfigExtension; @@ -71,7 +72,7 @@ class ExtensionTest extends TestCase public function testInvalidConfiguration() { - $this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class); + $this->expectException(LogicException::class); $this->expectExceptionMessage('The extension configuration class "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Extension\\InvalidConfig\\Configuration" must implement "Symfony\\Component\\Config\\Definition\\ConfigurationInterface".'); $extension = new InvalidConfigExtension(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php index 88c7830493..9134f1f6c0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php @@ -113,7 +113,7 @@ class EnvPlaceholderParameterBagTest extends TestCase public function testResolveEnvRequiresStrings() { - $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The default value of env parameter "INT_VAR" must be a string or null, "int" given.'); $bag = new EnvPlaceholderParameterBag(); @@ -124,7 +124,7 @@ class EnvPlaceholderParameterBagTest extends TestCase public function testGetDefaultScalarEnv() { - $this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The default value of an env() parameter must be a string or null, but "int" given to "env(INT_VAR)".'); $bag = new EnvPlaceholderParameterBag(); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php index 416815c887..b98d32f04b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php @@ -350,7 +350,7 @@ class FormTypeTest extends BaseTypeTest public function testActionCannotBeNull() { - $this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class); + $this->expectException(InvalidOptionsException::class); $this->factory->create(static::TESTED_TYPE, null, ['action' => null]); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php index f66afb6b60..4aa86db62b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Intl\Util\IntlTestHelper; class NumberTypeTest extends BaseTypeTest @@ -80,7 +81,7 @@ class NumberTypeTest extends BaseTypeTest public function testStringInputWithFloatData() { - $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class); + $this->expectException(TransformationFailedException::class); $this->expectExceptionMessage('Expected a numeric string.'); $this->factory->create(static::TESTED_TYPE, 12345.6789, [ @@ -91,7 +92,7 @@ class NumberTypeTest extends BaseTypeTest public function testStringInputWithIntData() { - $this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class); + $this->expectException(TransformationFailedException::class); $this->expectExceptionMessage('Expected a numeric string.'); $this->factory->create(static::TESTED_TYPE, 12345, [ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index 80a79c3a21..3c61306564 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\Exception\InvalidConfigurationException; +use Symfony\Component\Form\Exception\LogicException; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormInterface; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; @@ -478,7 +479,7 @@ class TimeTypeTest extends BaseTypeTest public function testSetDataDifferentTimezonesWithoutReferenceDate() { - $this->expectException(\Symfony\Component\Form\Exception\LogicException::class); + $this->expectException(LogicException::class); $this->expectExceptionMessage('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.'); $form = $this->factory->create(static::TESTED_TYPE, null, [ diff --git a/src/Symfony/Component/Form/Tests/FormRendererTest.php b/src/Symfony/Component/Form/Tests/FormRendererTest.php index 373a2e7f7d..50a35eddab 100644 --- a/src/Symfony/Component/Form/Tests/FormRendererTest.php +++ b/src/Symfony/Component/Form/Tests/FormRendererTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; +use Symfony\Component\Form\Exception\BadMethodCallException; use Symfony\Component\Form\FormRenderer; use Symfony\Component\Form\FormRendererEngineInterface; use Symfony\Component\Form\FormView; @@ -32,7 +33,7 @@ class FormRendererTest extends TestCase public function testRenderARenderedField() { - $this->expectException(\Symfony\Component\Form\Exception\BadMethodCallException::class); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('Field "foo" has already been rendered, save the result of previous render call to a variable and output that instead.'); $formView = new FormView(); diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php index 44ede17251..205f3fa1e8 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php @@ -2404,7 +2404,7 @@ class OptionsResolverTest extends TestCase public function testFailsIfOptionIsAlreadyDefined() { - $this->expectException(\Symfony\Component\OptionsResolver\Exception\OptionDefinitionException::class); + $this->expectException(OptionDefinitionException::class); $this->expectExceptionMessage('The option "foo" is already defined.'); $this->resolver->define('foo'); $this->resolver->define('foo'); diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php index f9efe296ed..a0d6041327 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider; +use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\BadCredentialsException; @@ -30,7 +31,7 @@ class PreAuthenticatedAuthenticationProviderTest extends TestCase $this->assertTrue($provider->supports($this->getSupportedToken())); $this->assertFalse($provider->supports($this->createMock(TokenInterface::class))); - $token = $this->createMock(\Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken::class); + $token = $this->createMock(PreAuthenticatedToken::class); $token ->expects($this->once()) ->method('getFirewallName') @@ -66,7 +67,7 @@ class PreAuthenticatedAuthenticationProviderTest extends TestCase $provider = $this->getProvider($user); $token = $provider->authenticate($this->getSupportedToken('fabien', 'pass')); - $this->assertInstanceOf(\Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken::class, $token); + $this->assertInstanceOf(PreAuthenticatedToken::class, $token); $this->assertEquals('pass', $token->getCredentials()); $this->assertEquals('key', $token->getFirewallName()); $this->assertEquals([], $token->getRoleNames()); @@ -92,7 +93,7 @@ class PreAuthenticatedAuthenticationProviderTest extends TestCase protected function getSupportedToken($user = false, $credentials = false) { - $token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken::class)->setMethods(['getUser', 'getCredentials', 'getFirewallName'])->disableOriginalConstructor()->getMock(); + $token = $this->getMockBuilder(PreAuthenticatedToken::class)->setMethods(['getUser', 'getCredentials', 'getFirewallName'])->disableOriginalConstructor()->getMock(); if (false !== $user) { $token->expects($this->once()) ->method('getUser') diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfTest.php index 3ceaacdcf3..66b8168dfb 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfTest.php @@ -14,6 +14,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\AtLeastOneOf; use Symfony\Component\Validator\Constraints\Valid; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * @author Przemysław Bogusz @@ -22,7 +23,7 @@ class AtLeastOneOfTest extends TestCase { public function testRejectNonConstraints() { - $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class); + $this->expectException(ConstraintDefinitionException::class); new AtLeastOneOf([ 'foo', ]); @@ -30,7 +31,7 @@ class AtLeastOneOfTest extends TestCase public function testRejectValidConstraint() { - $this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class); + $this->expectException(ConstraintDefinitionException::class); new AtLeastOneOf([ new Valid(), ]); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/HostnameValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/HostnameValidatorTest.php index 4764176795..16c3121705 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/HostnameValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/HostnameValidatorTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; use Symfony\Component\Validator\Constraints\Hostname; use Symfony\Component\Validator\Constraints\HostnameValidator; +use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; /** @@ -36,7 +37,7 @@ class HostnameValidatorTest extends ConstraintValidatorTestCase public function testExpectsStringCompatibleType() { - $this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class); + $this->expectException(UnexpectedValueException::class); $this->validator->validate(new \stdClass(), new Hostname()); }