8000 minor #39996 Use import instead of FQCN (OskarStark) · symfony/symfony@ea2ced0 · GitHub
[go: up one dir, main page]

Skip to content

Commit ea2ced0

Browse files
minor #39996 Use import instead of FQCN (OskarStark)
This PR was merged into the 5.1 branch. Discussion ---------- Use import instead of FQCN | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | --- | License | MIT | Doc PR | --- Commits ------- b2fee7a Use import instead of FQCN
2 parents 75fd4ce + b2fee7a commit ea2ced0

File tree

12 files changed

+31
-22
lines changed

12 files changed

+31
-22
lines changed

src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\BrowserKit\CookieJar;
16+
use Symfony\Component\BrowserKit\Exception\BadMethodCallException;
1617
use Symfony\Component\BrowserKit\History;
1718
use Symfony\Component\BrowserKit\Request;
1819
use Symfony\Component\BrowserKit\Response;
@@ -46,7 +47,7 @@ public function testGetRequest()
4647

4748
public function testGetRequestNull()
4849
{
49-
$this->expectException(\Symfony\Component\BrowserKit\< 57AE /span>Exception\BadMethodCallException::class);
50+
$this->expectException(BadMethodCallException::class);
5051
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getRequest()".');
5152

5253
$client = $this->getBrowser();
@@ -83,7 +84,7 @@ public function testGetResponse()
8384

8485
public function testGetResponseNull()
8586
{
86-
$this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class);
87+
$this->expectException(BadMethodCallException::class);
8788
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getResponse()".');
8889

8990
$client = $this->getBrowser();
@@ -92,7 +93,7 @@ public function testGetResponseNull()
9293

9394
public function testGetInternalResponseNull()
9495
{
95-
$this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class);
96+
$this->expectException(BadMethodCallException::class);
9697
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalResponse()".');
9798

9899
$client = $this->getBrowser();
@@ -119,7 +120,7 @@ public function testGetCrawler()
119120

120121
public function testGetCrawlerNull()
121122
{
122-
$this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class);
123+
$this->expectException(BadMethodCallException::class);
123124
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getCrawler()".');
124125

125126
$client = $this->getBrowser();
@@ -832,7 +833,7 @@ public function testInternalRequest()
832833

833834
public function testInternalRequestNull()
834835
{
835-
$this->expectException(\Symfony\Component\BrowserKit\Exception\BadMethodCallException::class);
836+
$this->expectException(BadMethodCallException::class);
836837
$this->expectExceptionMessage('The "reques F438 t()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalRequest()".');
837838

838839
$client = $this->getBrowser();

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\DependencyInjection\Compiler\RegisterEnvVarProcessorsPass;
2121
use Symfony\Component\DependencyInjection\Compiler\ValidateEnvPlaceholdersPass;
2222
use Symfony\Component\DependencyInjection\ContainerBuilder;
23+
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
2324
use Symfony\Component\DependencyInjection\Extension\Extension;
2425

2526
class ValidateEnvPlaceholdersPassTest extends TestCase
@@ -59,7 +60,7 @@ public function testDefaultEnvIsValidatedInConfig()
5960

6061
public function testDefaultEnvWithoutPrefixIsValidatedInConfig()
6162
{
62-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
63+
$this->expectException(RuntimeException::class);
6364
$this->expectExceptionMessage('The default value of an env() parameter must be a string or null, but "float" given to "env(FLOATISH)".');
6465

6566
$container = new ContainerBuilder();
@@ -219,7 +220,7 @@ public function testEmptyEnvWhichCannotBeEmptyForScalarNode()
219220

220221
public function testEmptyEnvWhichCannotBeEmptyForScalarNodeWithValidation()
221222
{
222-
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
223+
$this->expectException(InvalidConfigurationException::class);
223224
$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.');
224225

225226
$container = new ContainerBuilder();

src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
17+
use Symfony\Component\DependencyInjection\Exception\LogicException;
1718
use Symfony\Component\DependencyInjection\Extension\Extension;
1819
use Symfony\Component\DependencyInjection\Tests\Fixtures\Extension\InvalidConfig\InvalidConfigExtension;
1920
use Symfony\Component\DependencyInjection\Tests\Fixtures\Extension\SemiValidConfig\SemiValidConfigExtension;
@@ -71,7 +72,7 @@ public function testSemiValidConfiguration()
7172

7273
public function testInvalidConfiguration()
7374
{
74-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\LogicException::class);
75+
$this->expectException(LogicException::class);
7576
$this->expectExceptionMessage('The extension configuration class "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\Extension\\InvalidConfig\\Configuration" must implement "Symfony\\Component\\Config\\Definition\\ConfigurationInterface".');
7677

7778
$extension = new InvalidConfigExtension();

src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function testMergeWithDifferentIdentifiersForPlaceholders()
113113

114114
public function testResolveEnvRequiresStrings()
115115
{
116-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
116+
$this->expectException(RuntimeException::class);
117117
$this->expectExceptionMessage('The default value of env parameter "INT_VAR" must be a string or null, "int" given.');
118118

119119
$bag = new EnvPlaceholderParameterBag();
@@ -124,7 +124,7 @@ public function testResolveEnvRequiresStrings()
124124

125125
public function testGetDefaultScalarEnv()
126126
{
127-
$this->expectException(\Symfony\Component\DependencyInjection\Exception\RuntimeException::class);
127+
$this->expectException(RuntimeException::class);
128128
$this->expectExceptionMessage('The default value of an env() parameter must be a string or null, but "int" given to "env(INT_VAR)".');
129129

130130
$bag = new EnvPlaceholderParameterBag();

src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public function testAttributesException()
350350

351351
public function testActionCannotBeNull()
352352
{
353-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidOptionsException::class);
353+
$this->expectException(InvalidOptionsException::class);
354354
$this->factory->create(static::TESTED_TYPE, null, ['action' => null]);
355355
}
356356

src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Exception\LogicException;
15+
use Symfony\Component\Form\Exception\TransformationFailedException;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
class NumberTypeTest extends BaseTypeTest
@@ -80,7 +81,7 @@ public function testDefaultFormattingWithScaleAndStringInput()
8081

8182
public function testStringInputWithFloatData()
8283
{
83-
$this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
84+
$this->expectException(TransformationFailedException::class);
8485
$this->expectExceptionMessage('Expected a numeric 10000 string.');
8586

8687
$this->factory->create(static::TESTED_TYPE, 12345.6789, [
@@ -91,7 +92,7 @@ public function testStringInputWithFloatData()
9192

9293
public function testStringInputWithIntData()
9394
{
94-
$this->expectException(\Symfony\Component\Form\Exception\TransformationFailedException::class);
95+
$this->expectException(TransformationFailedException::class);
9596
$this->expectExceptionMessage('Expected a numeric string.');
9697

9798
$this->factory->create(static::TESTED_TYPE, 12345, [

src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
1515
use Symfony\Component\Form\Exception\InvalidConfigurationException;
16+
use Symfony\Component\Form\Exception\LogicException;
1617
use Symfony\Component\Form\FormError;
1718
use Symfony\Component\Form\FormInterface;
1819
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
@@ -478,7 +479,7 @@ public function testSetDataDifferentTimezonesDuringDaylightSavingTime()
478479

479480
public function testSetDataDifferentTimezonesWithoutReferenceDate()
480481
{
481-
$this->expectException(\Symfony\Component\Form\Exception\LogicException::class);
482+
$this->expectException(LogicException::class);
482483
$this->expectExceptionMessage('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.');
483484

484485
$form = $this->factory->create(static::TESTED_TYPE, null, [

src/Symfony/Component/Form/Tests/FormRendererTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Form\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Form\Exception\BadMethodCallException;
1516
use Symfony\Component\Form\FormRenderer;
1617
use Symfony\Component\Form\FormRendererEngineInterface;
1718
use Symfony\Component\Form\FormView;
@@ -32,7 +33,7 @@ public function testHumanize()
3233

3334
public function testRenderARenderedField()
3435
{
35-
$this->expectException(\Symfony\Component\Form\Exception\BadMethodCallException::class);
36+
$this->expectException(BadMethodCallException::class);
3637
$this->expectExceptionMessage('Field "foo" has already been rendered, save the result of previous render call to a variable and output that instead.');
3738

3839
$formView = new FormView();

src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,7 @@ public function testAccessToParentOptionFromNestedNormalizerAndLazyOption()
24042404

24052405
public function testFailsIfOptionIsAlreadyDefined()
24062406
{
2407-
$this->expectException(\Symfony\Component\OptionsResolver\Exception\OptionDefinitionException::class);
2407+
$this->expectException(OptionDefinitionException::class);
24082408
$this->expectExceptionMessage('The option "foo" is already defined.');
24092409
$this->resolver->define('foo');
24102410
$this->resolver->define('foo');

src/Symfony/Component/Security/Core/Tests/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
16+
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
1617
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1718
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1819
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
@@ -30,7 +31,7 @@ public function testSupports()
3031
$this->assertTrue($provider->supports($this->getSupportedToken()));
3132
$this->assertFalse($provider->supports($this->createMock(TokenInterface::class)));
3233

33-
$token = $this->createMock(\Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken::class);
34+
$token = $this->createMock(PreAuthenticatedToken::class);
3435
$token
3536
->expects($this->once())
3637
->method('getProviderKey')
@@ -66,7 +67,7 @@ public function testAuthenticate()
6667
$provider = $this->getProvider($user);
6768

6869
$token = $provider->authenticate($this->getSupportedToken('fabien', 'pass'));
69-
$this->assertInstanceOf(\Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken::class, $token);
70+
$this->assertInstanceOf(PreAuthenticatedToken::class, $token);
7071
$this->assertEquals('pass', $token->getCredentials());
7172
$this->assertEquals('key', $token->getProviderKey());
7273
$this->assertEquals([], $token->getRoleNames());
@@ -92,7 +93,7 @@ public function testAuthenticateWhenUserCheckerThrowsException()
9293

9394
protected function getSupportedToken($user = false, $credentials = false)
9495
{
95-
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken::class)->setMethods(['getUser', 'getCredentials', 'getProviderKey'])->disableOriginalConstructor()->getMock();
96+
$token = $this->getMockBuilder(PreAuthenticatedToken::class)->setMethods(['getUser', 'getCredentials', 'getProviderKey'])->disableOriginalConstructor()->getMock();
9697
< 341A span class=pl-k>if (false !== $user) {
9798
$token->expects($this->once())
9899
->method('getUser')

src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Validator\Constraints\AtLeastOneOf;
1616
use Symfony\Component\Validator\Constraints\Valid;
17+
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1718

1819
/**
1920
* @author Przemysław Bogusz <przemyslaw.bogusz@tubotax.pl>
@@ -22,15 +23,15 @@ class AtLeastOneOfTest extends TestCase
2223
{
2324
public function testRejectNonConstraints()
2425
{
25-
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
26+
$this->expectException(ConstraintDefinitionException::class);
2627
new AtLeastOneOf([
2728
'foo',
2829
]);
2930
}
3031

3132
public function testRejectValidConstraint()
3233
{
33-
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
34+
$this->expectException(ConstraintDefinitionException::class);
3435
new AtLeastOneOf([
3536
new Valid(),
3637
]);

src/Symfony/Component/Validator/Tests/Constraints/HostnameValidatorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Validator\Constraints\Hostname;
1515
use Symfony\Component\Validator\Constraints\HostnameValidator;
16+
use Symfony\Component\Validator\Exception\UnexpectedValueException;
1617
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
1718

1819
/**
@@ -36,7 +37,7 @@ public function testEmptyStringIsValid()
3637

3738
public function testExpectsStringCompatibleType()
3839
{
39-
$this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
40+
$this->expectException(UnexpectedValueException::class);
4041

4142
$this->validator->validate(new \stdClass(), new Hostname());
4243
}

0 commit comments

Comments
 (0)
0