Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitcce5a42

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: Use ::class keyword when possible
2 parents742dd13 +84ce026 commitcce5a42

File tree

21 files changed

+160
-160
lines changed

21 files changed

+160
-160
lines changed

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

Lines 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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DoctrineOrmTypeGuesserTest extends TestCase
2828
*/
2929
publicfunctiontestTypeGuesser(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‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgno
300300
{
301301
$entity1 =newSingleIntIdEntity(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
publicfunctiontestDedicatedEntityManagerNullObject()
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 =newUniqueEntity([
622622
'message' =>'myMessage',
@@ -636,7 +636,7 @@ public function testDedicatedEntityManagerNullObject()
636636

637637
publicfunctiontestEntityManagerNullObject()
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 =newUniqueEntity([
642642
'message' =>'myMessage',
@@ -718,7 +718,7 @@ public function testValidateInheritanceUniqueness()
718718

719719
publicfunctiontestInvalidateRepositoryForInheritance()
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 =newUniqueEntity([
724724
'message' =>'myMessage',

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

Lines 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
publicfunctiontestExclusionsWithoutCode()
6767
{
68-
$this->expectException('LogicException');
68+
$this->expectException(\LogicException::class);
6969
newHttpCodeActivationStrategy(newRequestStack(), [['urls' => []]],newErrorLevelActivationStrategy(Logger::WARNING));
7070
}
7171

7272
publicfunctiontestExclusionsWithoutUrls()
7373
{
74-
$this->expectException('LogicException');
74+
$this->expectException(\LogicException::class);
7575
newHttpCodeActivationStrategy(newRequestStack(), [['code' =>404]],newErrorLevelActivationStrategy(Logger::WARNING));
7676
}
7777

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function testPropertyAccessCacheWithDebug()
137137

138138
publicfunctiontestCsrfProtectionNeedsSessionToBeEnabled()
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
publicfunctiontestWorkflowAreValidated()
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
publicfunctiontestWorkflowCannotHaveBothSupportsAndSupportStrategy()
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
publicfunctiontestWorkflowShouldHaveOneOfSupportsAndSupportStrategy()
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
publicfunctiontestRouterRequiresResourceOption()
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 =newFrameworkExtension();
531531
$loader->load([['router' =>true]],$container);
@@ -796,14 +796,14 @@ public function testMessengerWithMultipleBuses()
796796

797797
publicfunctiontestMessengerMiddlewareFactoryErroneousFormat()
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
publicfunctiontestMessengerInvalidTransportRouting()
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
publicfunctiontestAnnotations()

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

Lines 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 =newPhpFileLoader($container,newFileLocator(__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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testCreateTableCellStyle()
2121
$tableCellStyle =newTableCellStyle(['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
newTableCellStyle(['wrong_key' =>null]);
2626
}
2727
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FragmentHandlerTest extends TestCase
2626

2727
protectedfunctionsetUp():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
publicfunctiontestRenderWhenRendererDoesNotExist()
4141
{
42-
$this->expectException('InvalidArgumentException');
42+
$this->expectException(\InvalidArgumentException::class);
4343
$handler =newFragmentHandler($this->requestStack);
4444
$handler->render('/','foo');
4545
}
4646

4747
publicfunctiontestRenderWithUnknownRenderer()
4848
{
49-
$this->expectException('InvalidArgumentException');
49+
$this->expectException(\InvalidArgumentException::class);
5050
$handler =$this->getHandler($this->returnValue(newResponse('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
protectedfunctiongetHandler($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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testSingleAddressCanBeSetAndFetched()
2525

2626
publicfunctiontestAddressMustComplyWithRfc2822()
2727
{
28-
$this->expectException('Exception');
28+
$this->expectException(\Exception::class);
2929
newPathHeader('Return-Path',newAddress('chr is@swiftmailer.org'));
3030
}
3131

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp