Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cce5a42

Browse filesBrowse files
committed
Merge branch '5.2' into 5.x
* 5.2: Use ::class keyword when possible
2 parents 742dd13 + 84ce026 commit cce5a42
Copy full SHA for cce5a42

File tree

21 files changed

+160
-160
lines changed
Filter options

21 files changed

+160
-160
lines changed

‎src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testFilterUid($entityClass)
160160

161161
$em = DoctrineTestHelper::createTestEntityManager();
162162

163-
$query = $this->getMockBuilder('QueryMock')
163+
$query = $this->getMockBuilder(\QueryMock::class)
164164
->setMethods(['setParameter', 'getResult', 'getSql', '_doExecute'])
165165
->getMock();
166166

@@ -173,7 +173,7 @@ public function testFilterUid($entityClass)
173173
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', [Uuid::fromString('71c5fd46-3f16-4abb-bad7-90ac1e654a2d')->toBinary(), Uuid::fromString('b98e8e11-2897-44df-ad24-d2627eb7f499')->toBinary()], Connection::PARAM_STR_ARRAY)
174174
->willReturn($query);
175175

176-
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
176+
$qb = $this->getMockBuilder(\Doctrine\ORM\QueryBuilder::class)
177177
->setConstructorArgs([$em])
178178
->setMethods(['getQuery'])
179179
->getMock();
@@ -205,7 +205,7 @@ public function testUidThrowProperException($entityClass)
205205

206206
$em = DoctrineTestHelper::createTestEntityManager();
207207

208-
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
208+
$qb = $this->getMockBuilder(\Doctrine\ORM\QueryBuilder::class)
209209
->setConstructorArgs([$em])
210210
->setMethods(['getQuery'])
211211
->getMock();

‎src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Form/DoctrineOrmTypeGuesserTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DoctrineOrmTypeGuesserTest extends TestCase
2828
*/
2929
public function testTypeGuesser(string $type, $expected)
3030
{
31-
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
31+
$classMetadata = $this->getMockBuilder(ClassMetadata::class)->disableOriginalConstructor()->getMock();
3232
$classMetadata->fieldMappings['field'] = true;
3333
$classMetadata->expects($this->once())->method('getTypeOfField')->with('field')->willReturn($type);
3434

‎src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgno
300300
{
301301
$entity1 = new SingleIntIdEntity(1, null);
302302

303-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
303+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
304304
$this->validator->validate($entity1, $constraint);
305305
}
306306

@@ -616,7 +616,7 @@ public function testValidateUniquenessWithArrayValue()
616616

617617
public function testDedicatedEntityManagerNullObject()
618618
{
619-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
619+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
620620
$this->expectExceptionMessage('Object manager "foo" does not exist.');
621621
$constraint = new UniqueEntity([
622622
'message' => 'myMessage',
@@ -636,7 +636,7 @@ public function testDedicatedEntityManagerNullObject()
636636

637637
public function testEntityManagerNullObject()
638638
{
639-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
639+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
640640
$this->expectExceptionMessage('Unable to find the object manager associated with an entity of class "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity"');
641641
$constraint = new UniqueEntity([
642642
'message' => 'myMessage',
@@ -718,7 +718,7 @@ public function testValidateInheritanceUniqueness()
718718

719719
public function testInvalidateRepositoryForInheritance()
720720
{
721-
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
721+
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
722722
$this->expectExceptionMessage('The "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity" entity repository does not support the "Symfony\Bridge\Doctrine\Tests\Fixtures\Person" entity. The entity should be an instance of or extend "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity".');
723723
$constraint = new UniqueEntity([
724724
'message' => 'myMessage',

‎src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/HttpCodeActivationStrategyTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/HttpCodeActivationStrategyTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ public function testIsActivatedLegacy($url, $record, $expected)
6565

6666
public function testExclusionsWithoutCode()
6767
{
68-
$this->expectException('LogicException');
68+
$this->expectException(\LogicException::class);
6969
new HttpCodeActivationStrategy(new RequestStack(), [['urls' => []]], new ErrorLevelActivationStrategy(Logger::WARNING));
7070
}
7171

7272
public function testExclusionsWithoutUrls()
7373
{
74-
$this->expectException('LogicException');
74+
$this->expectException(\LogicException::class);
7575
new HttpCodeActivationStrategy(new RequestStack(), [['code' => 404]], new ErrorLevelActivationStrategy(Logger::WARNING));
7676
}
7777

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function testPropertyAccessCacheWithDebug()
137137

138138
public function testCsrfProtectionNeedsSessionToBeEnabled()
139139
{
140-
$this->expectException('LogicException');
140+
$this->expectException(\LogicException::class);
141141
$this->expectExceptionMessage('CSRF protection needs sessions to be enabled.');
142142
$this->createContainerFromFile('csrf_needs_session');
143143
}
@@ -317,21 +317,21 @@ public function testWorkflows()
317317

318318
public function testWorkflowAreValidated()
319319
{
320-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
320+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
321321
$this->expectExceptionMessage('A transition from a place/state must have an unique name. Multiple transitions named "go" from place/state "first" were found on StateMachine "my_workflow".');
322322
$this->createContainerFromFile('workflow_not_valid');
323323
}
324324

325325
public function testWorkflowCannotHaveBothSupportsAndSupportStrategy()
326326
{
327-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
327+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
328328
$this->expectExceptionMessage('"supports" and "support_strategy" cannot be used together.');
329329
$this->createContainerFromFile('workflow_with_support_and_support_strategy');
330330
}
331331

332332
public function testWorkflowShouldHaveOneOfSupportsAndSupportStrategy()
333333
{
334-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
334+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
335335
$this->expectExceptionMessage('"supports" or "support_strategy" should be configured.');
336336
$this->createContainerFromFile('workflow_without_support_and_support_strategy');
337337
}
@@ -525,7 +525,7 @@ public function testRouter()
525525

526526
public function testRouterRequiresResourceOption()
527527
{
528-
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
528+
$this->expectException(\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException::class);
529529
$container = $this->createContainer();
530530
$loader = new FrameworkExtension();
531531
$loader->load([['router' => true]], $container);
@@ -796,14 +796,14 @@ public function testMessengerWithMultipleBuses()
796796

797797
public function testMessengerMiddlewareFactoryErroneousFormat()
798798
{
799-
$this->expectException('InvalidArgumentException');
799+
$this->expectException(\InvalidArgumentException::class);
800800
$this->expectExceptionMessage('Invalid middleware at path "framework.messenger": a map with a single factory id as key and its arguments as value was expected, {"foo":["qux"],"bar":["baz"]} given.');
801801
$this->createContainerFromFile('messenger_middleware_factory_erroneous_format');
802802
}
803803

804804
public function testMessengerInvalidTransportRouting()
805805
{
806-
$this->expectException('LogicException');
806+
$this->expectException(\LogicException::class);
807807
$this->expectExceptionMessage('Invalid Messenger routing configuration: the "Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage" class is being routed to a sender called "invalid". This is not a valid transport or service id.');
808808
$this->createContainerFromFile('messenger_routing_invalid_transport');
809809
}
@@ -819,19 +819,19 @@ public function testTranslator()
819819
$this->assertSame($container->getParameter('kernel.cache_dir').'/translations', $options['cache_dir']);
820820

821821
$files = array_map('realpath', $options['resource_files']['en']);
822-
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
822+
$ref = new \ReflectionClass(\Symfony\Component\Validator\Validation::class);
823823
$this->assertContains(
824824
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
825825
$files,
826826
'->registerTranslatorConfiguration() finds Validator translation resources'
827827
);
828-
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
828+
$ref = new \ReflectionClass(\Symfony\Component\Form\Form::class);
829829
$this->assertContains(
830830
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
831831
$files,
832832
'->registerTranslatorConfiguration() finds Form translation resources'
833833
);
834-
$ref = new \ReflectionClass('Symfony\Component\Security\Core\Security');
834+
$ref = new \ReflectionClass(\Symfony\Component\Security\Core\Security::class);
835835
$this->assertContains(
836836
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', \DIRECTORY_SEPARATOR),
837837
$files,
@@ -888,7 +888,7 @@ public function testValidation()
888888
$container = $this->createContainerFromFile('full');
889889
$projectDir = $container->getParameter('kernel.project_dir');
890890

891-
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
891+
$ref = new \ReflectionClass(\Symfony\Component\Form\Form::class);
892892
$xmlMappings = [
893893
\dirname($ref->getFileName()).'/Resources/config/validation.xml',
894894
strtr($projectDir.'/config/validator/foo.xml', '/', \DIRECTORY_SEPARATOR),
@@ -922,7 +922,7 @@ public function testValidationService()
922922
{
923923
$container = $this->createContainerFromFile('validation_annotations', ['kernel.charset' => 'UTF-8'], false);
924924

925-
$this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator.alias'));
925+
$this->assertInstanceOf(\Symfony\Component\Validator\Validator\ValidatorInterface::class, $container->get('validator.alias'));
926926
}
927927

928928
public function testAnnotations()

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function load(array $configs, ContainerBuilder $container)
3737
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
3838
$loader->load('twig.php');
3939

40-
if (class_exists('Symfony\Component\Form\Form')) {
40+
if (class_exists(\Symfony\Component\Form\Form::class)) {
4141
$loader->load('form.php');
4242
}
4343

‎src/Symfony/Component/Console/Tests/Helper/TableCellStyleTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/TableCellStyleTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testCreateTableCellStyle()
2121
$tableCellStyle = new TableCellStyle(['fg' => 'red']);
2222
$this->assertEquals('red', $tableCellStyle->getOptions()['fg']);
2323

24-
$this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException');
24+
$this->expectException(\Symfony\Component\Console\Exception\InvalidArgumentException::class);
2525
new TableCellStyle(['wrong_key' => null]);
2626
}
2727
}

‎src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FragmentHandlerTest extends TestCase
2626

2727
protected function setUp(): void
2828
{
29-
$this->requestStack = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
29+
$this->requestStack = $this->getMockBuilder(\Symfony\Component\HttpFoundation\RequestStack::class)
3030
->disableOriginalConstructor()
3131
->getMock()
3232
;
@@ -39,14 +39,14 @@ protected function setUp(): void
3939

4040
public function testRenderWhenRendererDoesNotExist()
4141
{
42-
$this->expectException('InvalidArgumentException');
42+
$this->expectException(\InvalidArgumentException::class);
4343
$handler = new FragmentHandler($this->requestStack);
4444
$handler->render('/', 'foo');
4545
}
4646

4747
public function testRenderWithUnknownRenderer()
4848
{
49-
$this->expectException('InvalidArgumentException');
49+
$this->expectException(\InvalidArgumentException::class);
5050
$handler = $this->getHandler($this->returnValue(new Response('foo')));
5151

5252
$handler->render('/', 'bar');
@@ -59,7 +59,7 @@ public function testDeliverWithUnsuccessfulResponse()
5959
$handler->render('/', 'foo');
6060
$this->fail('->render() throws a \RuntimeException exception if response is not successful');
6161
} catch (\Exception $e) {
62-
$this->assertInstanceOf('\RuntimeException', $e);
62+
$this->assertInstanceOf(\RuntimeException::class, $e);
6363
$this->assertEquals(0, $e->getCode());
6464
$this->assertEquals('Error when rendering "http://localhost/" (Status code is 404).', $e->getMessage());
6565

@@ -79,7 +79,7 @@ public function testRender()
7979

8080
protected function getHandler($returnValue, $arguments = [])
8181
{
82-
$renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock();
82+
$renderer = $this->getMockBuilder(\Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface::class)->getMock();
8383
$renderer
8484
->expects($this->any())
8585
->method('getName')

‎src/Symfony/Component/Mime/Tests/Header/PathHeaderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Tests/Header/PathHeaderTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testSingleAddressCanBeSetAndFetched()
2525

2626
public function testAddressMustComplyWithRfc2822()
2727
{
28-
$this->expectException('Exception');
28+
$this->expectException(\Exception::class);
2929
new PathHeader('Return-Path', new Address('chr is@swiftmailer.org'));
3030
}
3131

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.