Skip to content

Use import instead of FQCN #39996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

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;
Expand Down Expand Up @@ -46,7 +47,7 @@ public function testGetRequest()

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();
Expand Down Expand Up @@ -83,7 +84,7 @@ public function testGetResponse()

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();
Expand All @@ -92,7 +93,7 @@ public function testGetResponseNull()

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();
Expand All @@ -119,7 +120,7 @@ public function testGetCrawler()

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();
Expand Down Expand Up @@ -832,7 +833,7 @@ public function testInternalRequest()

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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
Expand Down Expand Up @@ -59,7 +60,7 @@ public function testDefaultEnvIsValidatedInConfig()

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();
Expand Down Expand Up @@ -219,7 +220,7 @@ public function testEmptyEnvWhichCannotBeEmptyForScalarNode()

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
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;
Expand Down Expand Up @@ -71,7 +72,7 @@ public function testSemiValidConfiguration()

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function testMergeWithDifferentIdentifiersForPlaceholders()

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();
Expand All @@ -124,7 +124,7 @@ public function testResolveEnvRequiresStrings()

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public function testAttributesException()

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -80,7 +81,7 @@ public function testDefaultFormattingWithScaleAndStringInput()

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, [
Expand All @@ -91,7 +92,7 @@ public function testStringInputWithFloatData()

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, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

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;
Expand Down Expand Up @@ -478,7 +479,7 @@ public function testSetDataDifferentTimezonesDuringDaylightSavingTime()

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, [
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Form/Tests/FormRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,7 +33,7 @@ public function testHumanize()

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,7 @@ public function testAccessToParentOptionFromNestedNormalizerAndLazyOption()

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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

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;
Expand All @@ -30,7 +31,7 @@ public function testSupports()
$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('getProviderKey')
Expand Down Expand Up @@ -66,7 +67,7 @@ public function testAuthenticate()
$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->getProviderKey());
$this->assertEquals([], $token->getRoleNames());
Expand All @@ -92,7 +93,7 @@ public function testAuthenticateWhenUserCheckerThrowsException()

protected function getSupportedToken($user = false, $credentials = false)
{
$token = $this->getMockBuilder(\Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken::class)->setMethods(['getUser', 'getCredentials', 'getProviderKey'])->disableOriginalConstructor()->getMock();
$token = $this->getMockBuilder(PreAuthenticatedToken::class)->setMethods(['getUser', 'getCredentials', 'getProviderKey'])->disableOriginalConstructor()->getMock();
if (false !== $user) {
$token->expects($this->once())
->method('getUser')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
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 <przemyslaw.bogusz@tubotax.pl>
Expand All @@ -22,15 +23,15 @@ class AtLeastOneOfTest extends TestCase
{
public function testRejectNonConstraints()
{
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectException(ConstraintDefinitionException::class);
new AtLeastOneOf([
'foo',
]);
}

public function testRejectValidConstraint()
{
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectException(ConstraintDefinitionException::class);
new AtLeastOneOf([
new Valid(),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\Validator\Constraints\Hostname;
use Symfony\Component\Validator\Constraints\HostnameValidator;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

/**
Expand All @@ -36,7 +37,7 @@ public function testEmptyStringIsValid()

public function testExpectsStringCompatibleType()
{
$this->expectException(\Symfony\Component\Validator\Exception\UnexpectedValueException::class);
$this->expectException(UnexpectedValueException::class);

$this->validator->validate(new \stdClass(), new Hostname());
}
Expand Down